20 #include FT_INTERNAL_DEBUG_H
21 #include FT_INTERNAL_CALC_H
22 #include FT_INTERNAL_STREAM_H
24 #include FT_TRUETYPE_IDS_H
25 #include FT_TRUETYPE_TAGS_H
26 #include FT_INTERNAL_SFNT_H
41 #define FT_COMPONENT trace_cffobjs
91 funcs->
destroy( internal->topfont );
93 for ( i = font->num_subfonts; i > 0; i-- )
94 funcs->
destroy( internal->subfonts[i - 1] );
116 for ( n = 0; n <
count; n++ )
120 for ( n = 0; n <
count; n++ )
124 for ( n = 0; n <
count; n++ )
128 for ( n = 0; n <
count; n++ )
139 for ( n = 0; n <
count; n++ )
143 for ( n = 0; n <
count; n++ )
167 FT_Memory memory = cffsize->face->memory;
176 error = funcs->
create( cffsize->face->memory, &priv,
177 &internal->topfont );
181 for ( i = font->num_subfonts; i > 0; i-- )
187 error = funcs->
create( cffsize->face->memory, &priv,
188 &internal->subfonts[i - 1] );
203 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
225 FT_ULong top_upm = font->top_font.font_dict.units_per_em;
230 size->metrics.x_scale, size->metrics.y_scale,
233 for (
i = font->num_subfonts;
i > 0;
i-- )
240 if ( top_upm != sub_upm )
242 x_scale =
FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );
243 y_scale =
FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );
247 x_scale = size->metrics.x_scale;
248 y_scale = size->metrics.y_scale;
252 x_scale, y_scale, 0, 0 );
270 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
279 if ( sfnt->set_sbit_strike( cffface, req, &strike_index ) )
282 return cff_size_select( size, strike_index );
297 FT_ULong top_upm = font->top_font.font_dict.units_per_em;
302 size->metrics.x_scale, size->metrics.y_scale,
305 for (
i = font->num_subfonts;
i > 0;
i-- )
312 if ( top_upm != sub_upm )
314 x_scale =
FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm );
315 y_scale =
FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm );
319 x_scale = size->metrics.x_scale;
320 y_scale = size->metrics.y_scale;
324 x_scale, y_scale, 0, 0 );
341 slot->internal->glyph_hints = 0;
366 slot->internal->glyph_hints = (
void*)funcs;
404 FT_Int32
length = strlen( name ) + 1;
408 while ( continue_search )
410 if ( length >= 7 && name[6] ==
'+' )
412 for ( idx = 0; idx < 6; idx++ )
415 if ( !(
'A' <= name[idx] && name[idx] <=
'Z' ) )
419 if ( continue_search )
421 for ( idx = 7; idx <
length; idx++ )
422 name[idx - 7] = name[idx];
438 FT_Int32 family_name_length, style_name_length;
441 family_name_length = strlen( family_name );
442 style_name_length = strlen( style_name );
444 if ( family_name_length > style_name_length )
449 for ( idx = 1; idx <= style_name_length; ++
idx )
451 if ( family_name[family_name_length - idx] !=
452 style_name[style_name_length - idx] )
456 if ( idx > style_name_length )
459 idx = family_name_length - style_name_length - 1;
464 ( family_name[idx] ==
'-' ||
465 family_name[idx] ==
' ' ||
466 family_name[idx] ==
'_' ||
467 family_name[idx] ==
'+' ) )
471 family_name[idx + 1] =
'\0';
487 FT_Service_PsCMaps psnames;
498 FT_ERROR((
"cff_face_init: cannot access `sfnt' module\n" ));
499 error = CFF_Err_Missing_Module;
506 library,
"pshinter" );
515 error = sfnt->
init_face( stream, face, face_index, num_params, params );
520 FT_TRACE2((
" not an OpenType/CFF font\n" ));
521 error = CFF_Err_Unknown_File_Format;
526 if ( face_index < 0 )
530 if ( face_index > 0 )
532 FT_ERROR((
"cff_face_init: invalid face index\n" ));
533 error = CFF_Err_Invalid_Argument;
547 error = sfnt->
load_face( stream, face, 0, num_params, params );
589 error =
cff_font_load( library, stream, face_index, cff, pure_cff );
596 cffface->face_index = face_index;
611 " cannot open CFF & CEF fonts\n"
613 " without the `PSNames' module\n" ));
614 error = CFF_Err_Missing_Module;
618 #ifdef FT_DEBUG_LEVEL_TRACE
627 for ( idx = 0; idx < cff->
num_strings + 390; idx++ )
654 if ( temp != 0x10000L )
721 if ( temp != 0x10000L )
739 char* style_name =
NULL;
755 cffface->bbox.xMax = ( dict->
font_bbox.
xMax + 0xFFFF ) >> 16;
756 cffface->bbox.yMax = ( dict->
font_bbox.
yMax + 0xFFFF ) >> 16;
760 cffface->ascender = (
FT_Short)( cffface->bbox.yMax );
761 cffface->descender = (
FT_Short)( cffface->bbox.yMin );
763 cffface->height = (
FT_Short)( ( cffface->units_per_EM * 12 ) / 10 );
764 if ( cffface->height < cffface->ascender - cffface->descender )
765 cffface->height = (
FT_Short)( cffface->ascender - cffface->descender );
767 cffface->underline_position =
769 cffface->underline_thickness =
774 if ( cffface->family_name )
779 char* family = cffface->family_name;
795 if ( full && family )
800 if ( *fullp == *family )
808 if ( *fullp ==
' ' || *fullp ==
'-' )
815 if ( *family ==
' ' || *family ==
'-' )
821 if ( !*family && *fullp )
838 char *cid_font_name =
845 cffface->family_name =
cff_strcpy( memory, cid_font_name );
849 cffface->style_name = style_name;
852 cffface->style_name =
cff_strcpy( memory, (
char *)
"Regular" );
872 if ( face->kern_pairs )
876 cffface->face_flags =
flags;
900 if ( !
ft_strncmp( cffface->style_name,
"Bold", 4 ) ||
901 !
ft_strncmp( cffface->style_name,
"Black", 5 ) )
904 cffface->style_flags =
flags;
908 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
934 for ( nn = 0; nn < (
FT_UInt)cffface->num_charmaps; nn++ )
936 cmap = cffface->charmaps[nn];
953 #ifdef FT_MAX_CHARMAP_CACHEABLE
956 FT_ERROR((
"cff_face_init: no Unicode cmap is found, "
957 "and too many subtables (%d) to add synthesized cmap\n",
964 cmaprec.
face = cffface;
967 cmaprec.
encoding = FT_ENCODING_UNICODE;
969 nn = (
FT_UInt)cffface->num_charmaps;
973 if ( error && FT_Err_No_Unicode_Glyph_Name != error )
978 if ( cffface->charmap ==
NULL && nn != (
FT_UInt)cffface->num_charmaps )
979 cffface->charmap = cffface->charmaps[nn];
985 FT_ERROR((
"cff_face_init: Unicode cmap is found, "
986 "but too many preceding subtables (%d) to access\n",
991 if ( encoding->
count > 0 )
996 cmaprec.
face = cffface;
999 if ( encoding->
offset == 0 )
1002 cmaprec.
encoding = FT_ENCODING_ADOBE_STANDARD;
1005 else if ( encoding->
offset == 1 )
1008 cmaprec.
encoding = FT_ENCODING_ADOBE_EXPERT;
1014 cmaprec.
encoding = FT_ENCODING_ADOBE_CUSTOM;
1039 memory = cffface->memory;
FT_UShort standard_width[1]
PSH_Globals_SetScaleFunc set_scale
cff_font_done(CFF_Font font)
cff_face_init(FT_Stream stream, FT_Face cffface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
TT_Init_Face_Func init_face
FT_DivFix(FT_Long a, FT_Long b)
cff_index_get_name(CFF_Font font, FT_UInt element)
SFNT_Interface * SFNT_Service
FT_BEGIN_HEADER typedef signed long FT_Pos
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
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_CID_KEYED
PSHinter_Interface * PSHinter_Service
#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET
#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET
FT_Fixed underline_position
cff_size_init(FT_Size cffsize)
#define FT_FACE_FLAG_SCALABLE
struct CFF_FontRec_ * CFF_Font
CFF_SubFont subfonts[CFF_MAX_CID_FONTS]
PSHinter_Service pshinter
#define FT_FACE_FIND_GLOBAL_SERVICE(face, ptr, id)
PSH_Globals_NewFunc create
FT_Fixed underline_thickness
EGLImageKHR EGLint * name
struct FT_Size_InternalRec_ * FT_Size_Internal
#define FT_MAX_CHARMAP_CACHEABLE
static void remove_style(FT_String *family_name, const FT_String *style_name)
#define TT_PLATFORM_MICROSOFT
static void cff_make_private_dict(CFF_SubFont subfont, PS_Private priv)
FT_Byte num_family_other_blues
GLuint GLuint GLfloat weight
TT_Loader_GotoTableFunc goto_table
FT_UShort standard_height[1]
FT_Pos family_other_blues[10]
PSH_Globals_DestroyFunc destroy
return cff_index_get_sid_string(cff, sid)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
FT_Service_PsCMaps psnames
TT_Done_Face_Func done_face
#define FT_ERROR(varformat)
cff_driver_done(FT_Module module)
#define FT_STYLE_FLAG_BOLD
struct CFF_InternalRec_ * CFF_Internal
#define FT_TRACE4(varformat)
#define TT_ADOBE_ID_CUSTOM
CFF_FontRecDictRec font_dict
#define FT_FACE_FLAG_SFNT
#define FT_FACE_FLAG_FIXED_WIDTH
cff_driver_init(FT_Module module)
PSH_Globals_Funcs(* get_globals_funcs)(FT_Module module)
FT_Request_Metrics(FT_Face face, FT_Size_Request req)
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
#define TT_ADOBE_ID_EXPERT
#define FT_HAS_FIXED_SIZES(face)
#define FT_FACE_FLAG_HORIZONTAL
#define FT_TRACE2(varformat)
#define TT_PLATFORM_ADOBE
CFF_PrivateRec private_dict
cff_slot_init(FT_GlyphSlot slot)
GLfloat GLfloat GLfloat top
struct CFF_SizeRec_ * CFF_Size
TT_Load_Face_Func load_face
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
TT_Load_Table_Func load_cmap
#define FT_FACE_FLAG_HINTER
FT_Vector_Transform_Scaled(FT_Vector *vector, const FT_Matrix *matrix, FT_Long scaling)
#define FT_STREAM_SEEK(position)
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
T2_Hints_Funcs(* get_t2_funcs)(FT_Module module)
FT_Short family_blues[14]
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
cff_slot_done(FT_GlyphSlot slot)
static PSH_Globals_Funcs cff_size_get_globals_funcs(CFF_Size size)
static FT_String * cff_strcpy(FT_Memory memory, const FT_String *source)
FT_Matrix_Multiply_Scaled(const FT_Matrix *a, FT_Matrix *b, FT_Long scaling)
#define FT_FACE_FLAG_KERNING
FT_Short snap_heights[13]
FT_Get_Module(FT_Library library, const char *module_name)
cff_size_done(FT_Size cffsize)
#define TT_PLATFORM_APPLE_UNICODE
CFF_IndexRec charstrings_index
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
#define TT_MS_ID_UNICODE_CS
FT_Byte num_family_other_blues
cff_size_request(FT_Size size, FT_Size_Request req)
#define FT_STRDUP(dst, str)
FT_Short family_other_blues[10]
T1_FIELD_DICT_FONTDICT family_name
#define FT_STYLE_FLAG_ITALIC
static void remove_subset_prefix(FT_String *name)
cff_face_done(FT_Face cffface)
GLsizei GLsizei GLchar * source
#define FT_FACE_FLAG_GLYPH_NAMES
cff_font_load(FT_Library library, FT_Stream stream, FT_Int face_index, CFF_Font font, FT_Bool pure_cff)