29 #include FT_INTERNAL_DEBUG_H 30 #include FT_INTERNAL_STREAM_H 31 #include FT_INTERNAL_OBJECTS_H 33 #include FT_TRUETYPE_IDS_H 35 #include FT_SERVICE_BDF_H 36 #include FT_SERVICE_XFREE86_NAME_H 51 #define FT_COMPONENT trace_bdfdriver 54 typedef struct BDF_CMapRec_
85 cmap->encodings =
NULL;
86 cmap->num_encodings = 0;
101 max = cmap->num_encodings;
109 code = encodings[mid].enc;
111 if ( charcode == code )
115 result = encodings[mid].glyph + 1;
119 if ( charcode < code )
141 max = cmap->num_encodings;
149 code = encodings[mid].enc;
151 if ( charcode == code )
155 result = encodings[mid].glyph + 1;
159 if ( charcode < code )
166 if ( min < cmap->num_encodings )
168 charcode = encodings[
min].enc;
173 if ( charcode > 0xFFFFFFFFUL )
175 FT_TRACE1((
"bdf_cmap_char_next: charcode 0x%x > 32bit API" ));
231 strings[1] = (
char *)
"Bold";
248 for ( len = 0, nn = 0; nn < 4; nn++ )
254 len += lengths[nn] + 1;
260 strings[0] = (
char *)
"Regular";
262 len = lengths[0] + 1;
274 for ( nn = 0; nn < 4; nn++ )
276 char*
src = strings[nn];
292 if ( nn == 0 || nn == 3 )
297 for ( mm = 0; mm <
len; mm++ )
329 FT_FREE( bdfface->family_name );
330 FT_FREE( bdfface->style_name );
332 FT_FREE( bdfface->available_sizes );
382 FT_TRACE4((
" number of glyphs: allocated %d (used %d)\n",
385 FT_TRACE4((
" number of unencoded glyphs: allocated %d (used %d)\n",
389 bdfface->num_faces = 1;
390 bdfface->face_index = 0;
412 bdfface->family_name = 0;
414 if ( (
error = bdf_interpret_style( face ) ) != 0 )
421 bdfface->num_fixed_sizes = 1;
427 FT_Short resolution_x = 0, resolution_y = 0;
444 (
FT_Pos)( ( prop->
value.
l * 64 * 7200 + 36135L ) / 72270L );
466 if ( resolution_x && resolution_y )
467 bsize->
x_ppem = bsize->
y_ppem * resolution_x / resolution_y;
484 (face->
en_table[
n]).enc = cur[n].encoding;
485 FT_TRACE4((
" idx %d, val 0x%lX\n", n, cur[n].encoding ));
494 " idx %d is too large for this system\n", n ));
509 if ( charset_registry && charset_encoding )
512 charset_encoding->format ==
BDF_ATOM &&
514 charset_encoding->value.atom )
520 charset_encoding->value.atom ) ||
528 if ( ( s[0] ==
'i' || s[0] ==
'I' ) &&
529 ( s[1] ==
's' || s[1] ==
'S' ) &&
530 ( s[2] ==
'o' || s[2] ==
'O' ) )
544 charmap.
encoding = FT_ENCODING_NONE;
549 if ( unicode_charmap )
551 charmap.
encoding = FT_ENCODING_UNICODE;
560 if ( bdfface->num_charmaps )
561 bdfface->charmap = bdfface->charmaps[0];
576 charmap.
encoding = FT_ENCODING_ADOBE_STANDARD;
583 if ( bdfface->num_charmaps )
584 bdfface->charmap = bdfface->charmaps[0];
594 return FT_THROW( Unknown_File_Format );
678 if ( glyph_index == 0 )
688 if ( glyph.
bpr > INT_MAX )
689 FT_TRACE1((
"BDF_Glyph_Load: too large pitch %d is truncated\n",
714 slot->format = FT_GLYPH_FORMAT_BITMAP;
718 slot->metrics.horiAdvance = glyph.
dwidth << 6;
719 slot->metrics.horiBearingX = glyph.
bbx.
x_offset << 6;
720 slot->metrics.horiBearingY = glyph.
bbx.
ascent << 6;
721 slot->metrics.width = bitmap->
width << 6;
722 slot->metrics.height = bitmap->
rows << 6;
743 bdf_get_bdf_property(
BDF_Face face,
744 const char* prop_name,
763 if ( prop->
value.
l > 0x7FFFFFFFL || prop->
value.
l < ( -1 - 0x7FFFFFFFL ) )
766 " too large integer 0x%x is truncated\n" ));
776 " too large cardinal 0x%x is truncated\n" ));
789 return FT_THROW( Invalid_Argument );
795 const char* *acharset_encoding,
796 const char* *acharset_registry )
805 static const FT_Service_BDFRec bdf_service_bdf =
867 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS 868 ft_stub_set_char_sizes,
869 ft_stub_set_pixel_sizes,
#define FT_ALLOC(ptr, size)
GLint GLint GLsizei GLsizei height
ft_glyphslot_set_bitmap(FT_GlyphSlot slot, FT_Byte *buffer)
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
unsigned long unencoded_size
FT_BEGIN_HEADER struct BDF_encoding_el_ BDF_encoding_el
FT_BEGIN_HEADER typedef signed long FT_Pos
ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
BDF_Glyph_Load(FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags)
FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec bdf_driver_class
FT_Select_Metrics(FT_Face face, FT_ULong strike_index)
#define TT_ADOBE_ID_STANDARD
#define FT_MEM_ZERO(dest, count)
#define FT_FACE_FLAG_FAST_GLYPHS
#define FT_REQUEST_HEIGHT(req)
BDF_Size_Request(FT_Size size, FT_Size_Request req)
GLsizei const GLchar *const * strings
return FT_THROW(Missing_Property)
FT_Bitmap_Size * available_sizes
#define FT_FACE_FLAG_FIXED_SIZES
FT_Error(* FT_BDF_GetCharsetIdFunc)(FT_Face face, const char **acharset_encoding, const char **acharset_registry)
struct FT_SizeRec_ FT_SizeRec
bdf_free_font(bdf_font_t *font)
bdf_driver_requester(FT_Module module, const char *name)
#define FT_XF86_FORMAT_BDF
BDF_Face_Done(FT_Face bdfface)
#define FT_SERVICE_ID_BDF
#define TT_PLATFORM_MICROSOFT
bdf_get_font_property(bdf_font_t *font, const char *name)
BDF_Size_Select(FT_Size size, FT_ULong strike_index)
bdf_cmap_init(FT_CMap bdfcmap, FT_Pointer init_data)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
#define FT_TRACE1(varformat)
GLenum GLuint GLint GLenum face
#define FT_ASSERT(condition)
#define FT_STYLE_FLAG_BOLD
bdf_cmap_char_index(FT_CMap bdfcmap, FT_UInt32 charcode)
#define FT_TRACE4(varformat)
struct BDF_CMapRec_ * BDF_CMap
struct BDF_FaceRec_ * BDF_Face
#define FT_FACE_FLAG_FIXED_WIDTH
unsigned long glyphs_size
#define FT_SERVICE_ID_XF86_NAME
#define FT_FACE_FLAG_HORIZONTAL
float min(float a, float b)
FT_Pointer FT_Module_Interface
#define FT_TRACE2(varformat)
#define TT_PLATFORM_ADOBE
#define FT_CALLBACK_DEF(x)
bdf_cmap_done(FT_CMap bdfcmap)
unsigned long unencoded_used
#define FT_MODULE_FONT_DRIVER
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec bdf_cmap_class
#define FT_NEW_ARRAY(ptr, count)
#define FT_STREAM_SEEK(position)
FT_Error(* FT_BDF_GetPropertyFunc)(FT_Face face, const char *prop_name, BDF_PropertyRec *aproperty)
GLuint const GLchar * name
if(!abbox) return FT_THROW(Invalid_Argument)
#define FT_CALLBACK_TABLE_DEF
#define FT_FACE_MEMORY(x)
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
bdf_load_font(FT_Stream stream, FT_Memory memory, bdf_options_t *opts, bdf_font_t **font)
GLenum const GLfloat * params
#define TT_PLATFORM_APPLE_UNICODE
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
struct BDF_CMapRec_ BDF_CMapRec
BDF_Face_Init(FT_Stream stream, FT_Face bdfface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
#define TT_MS_ID_UNICODE_CS
#define FT_MODULE_DRIVER_NO_OUTLINES
#define FT_STRDUP(dst, str)
unsigned long glyphs_used
struct FT_DriverRec_ FT_DriverRec
#define FT_STYLE_FLAG_ITALIC
bdf_cmap_char_next(FT_CMap bdfcmap, FT_UInt32 *acharcode)
#define TT_APPLE_ID_DEFAULT
BDF_encoding_el * en_table
union BDF_PropertyRec_::@0 u
union bdf_property_t_::@7 value