|
|
|
@ -46,7 +46,7 @@ |
|
|
|
|
/* */ |
|
|
|
|
/* SIZE FUNCTIONS */ |
|
|
|
|
/* */ |
|
|
|
|
/* Note that we store the global hints in the size's "internal" root */ |
|
|
|
|
/* Note that we store the global hints in the size's `internal' root */ |
|
|
|
|
/* field. */ |
|
|
|
|
/* */ |
|
|
|
|
/*************************************************************************/ |
|
|
|
@ -140,16 +140,16 @@ |
|
|
|
|
CFF_Size size = (CFF_Size)cffsize; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( size->root.internal ) |
|
|
|
|
if ( cffsize->internal ) |
|
|
|
|
{ |
|
|
|
|
PSH_Globals_Funcs funcs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
funcs = cff_size_get_globals_funcs( size ); |
|
|
|
|
if ( funcs ) |
|
|
|
|
funcs->destroy( (PSH_Globals)size->root.internal ); |
|
|
|
|
funcs->destroy( (PSH_Globals)cffsize->internal ); |
|
|
|
|
|
|
|
|
|
size->root.internal = 0; |
|
|
|
|
cffsize->internal = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -165,7 +165,7 @@ |
|
|
|
|
if ( funcs ) |
|
|
|
|
{ |
|
|
|
|
PSH_Globals globals; |
|
|
|
|
CFF_Face face = (CFF_Face)size->root.face; |
|
|
|
|
CFF_Face face = (CFF_Face)cffsize->face; |
|
|
|
|
CFF_Font font = (CFF_FontRec *)face->extra.data; |
|
|
|
|
CFF_SubFont subfont = &font->top_font; |
|
|
|
|
|
|
|
|
@ -219,9 +219,9 @@ |
|
|
|
|
priv.lenIV = cpriv->lenIV; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
error = funcs->create( size->root.face->memory, &priv, &globals ); |
|
|
|
|
error = funcs->create( cffsize->face->memory, &priv, &globals ); |
|
|
|
|
if ( !error ) |
|
|
|
|
size->root.internal = (FT_Size_Internal)(void*)globals; |
|
|
|
|
cffsize->internal = (FT_Size_Internal)(void*)globals; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return error; |
|
|
|
@ -236,16 +236,16 @@ |
|
|
|
|
CFF_Size size = (CFF_Size)cffsize; |
|
|
|
|
PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size ); |
|
|
|
|
FT_Error error = CFF_Err_Ok; |
|
|
|
|
FT_Face face = size->root.face; |
|
|
|
|
FT_Face face = cffsize->face; |
|
|
|
|
|
|
|
|
|
FT_UNUSED( char_width ); |
|
|
|
|
FT_UNUSED( char_height ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( funcs ) |
|
|
|
|
error = funcs->set_scale( (PSH_Globals)size->root.internal, |
|
|
|
|
size->root.metrics.x_scale, |
|
|
|
|
size->root.metrics.y_scale, |
|
|
|
|
error = funcs->set_scale( (PSH_Globals)cffsize->internal, |
|
|
|
|
cffsize->metrics.x_scale, |
|
|
|
|
cffsize->metrics.y_scale, |
|
|
|
|
0, 0 ); |
|
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS |
|
|
|
@ -255,7 +255,7 @@ |
|
|
|
|
error = sbit_size_reset( size ); |
|
|
|
|
|
|
|
|
|
if ( !error && !( face->face_flags & FT_FACE_FLAG_SCALABLE ) ) |
|
|
|
|
size->root.metrics = size->strike_metrics; |
|
|
|
|
cffsize->metrics = size->strike_metrics; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
@ -290,19 +290,16 @@ |
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( void ) |
|
|
|
|
cff_slot_done( FT_GlyphSlot cffslot ) /* CFF_GlyphSlot */ |
|
|
|
|
cff_slot_done( FT_GlyphSlot slot ) |
|
|
|
|
{ |
|
|
|
|
CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; |
|
|
|
|
|
|
|
|
|
slot->root.internal->glyph_hints = 0; |
|
|
|
|
slot->internal->glyph_hints = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error ) |
|
|
|
|
cff_slot_init( FT_GlyphSlot cffslot ) /* CFF_GlyphSlot */ |
|
|
|
|
cff_slot_init( FT_GlyphSlot slot ) |
|
|
|
|
{ |
|
|
|
|
CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; |
|
|
|
|
CFF_Face face = (CFF_Face)slot->root.face; |
|
|
|
|
CFF_Face face = (CFF_Face)slot->face; |
|
|
|
|
CFF_Font font = (CFF_FontRec *)face->extra.data; |
|
|
|
|
PSHinter_Service pshinter = (PSHinter_Service)font->pshinter; |
|
|
|
|
|
|
|
|
@ -312,7 +309,7 @@ |
|
|
|
|
FT_Module module; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module = FT_Get_Module( slot->root.face->driver->root.library, |
|
|
|
|
module = FT_Get_Module( slot->face->driver->root.library, |
|
|
|
|
"pshinter" ); |
|
|
|
|
if ( module ) |
|
|
|
|
{ |
|
|
|
@ -320,7 +317,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
funcs = pshinter->get_t2_funcs( module ); |
|
|
|
|
slot->root.internal->glyph_hints = (void*)funcs; |
|
|
|
|
slot->internal->glyph_hints = (void*)funcs; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -379,14 +376,14 @@ |
|
|
|
|
goto Bad_Format; |
|
|
|
|
#else |
|
|
|
|
sfnt = (SFNT_Service)FT_Get_Module_Interface( |
|
|
|
|
face->root.driver->root.library, "sfnt" ); |
|
|
|
|
cffface->driver->root.library, "sfnt" ); |
|
|
|
|
if ( !sfnt ) |
|
|
|
|
goto Bad_Format; |
|
|
|
|
|
|
|
|
|
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); |
|
|
|
|
|
|
|
|
|
pshinter = (PSHinter_Service)FT_Get_Module_Interface( |
|
|
|
|
face->root.driver->root.library, "pshinter" ); |
|
|
|
|
cffface->driver->root.library, "pshinter" ); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/* create input stream from resource */ |
|
|
|
@ -451,8 +448,7 @@ |
|
|
|
|
{ |
|
|
|
|
CFF_Font cff; |
|
|
|
|
CFF_FontRecDict dict; |
|
|
|
|
FT_Memory memory = face->root.memory; |
|
|
|
|
FT_Face root; |
|
|
|
|
FT_Memory memory = cffface->memory; |
|
|
|
|
FT_Int32 flags; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -470,8 +466,7 @@ |
|
|
|
|
/* Complement the root flags with some interesting information. */ |
|
|
|
|
/* Note that this is only necessary for pure CFF and CEF fonts. */ |
|
|
|
|
|
|
|
|
|
root = &face->root; |
|
|
|
|
root->num_glyphs = cff->num_glyphs; |
|
|
|
|
cffface->num_glyphs = cff->num_glyphs; |
|
|
|
|
|
|
|
|
|
dict = &cff->top_font.font_dict; |
|
|
|
|
|
|
|
|
@ -492,46 +487,46 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Set up num_faces. */ |
|
|
|
|
root->num_faces = cff->num_faces; |
|
|
|
|
cffface->num_faces = cff->num_faces; |
|
|
|
|
|
|
|
|
|
/* compute number of glyphs */ |
|
|
|
|
if ( dict->cid_registry != 0xFFFFU ) |
|
|
|
|
root->num_glyphs = dict->cid_count; |
|
|
|
|
cffface->num_glyphs = dict->cid_count; |
|
|
|
|
else |
|
|
|
|
root->num_glyphs = cff->charstrings_index.count; |
|
|
|
|
cffface->num_glyphs = cff->charstrings_index.count; |
|
|
|
|
|
|
|
|
|
/* set global bbox, as well as EM size */ |
|
|
|
|
root->bbox.xMin = dict->font_bbox.xMin >> 16; |
|
|
|
|
root->bbox.yMin = dict->font_bbox.yMin >> 16; |
|
|
|
|
root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16; |
|
|
|
|
root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16; |
|
|
|
|
cffface->bbox.xMin = dict->font_bbox.xMin >> 16; |
|
|
|
|
cffface->bbox.yMin = dict->font_bbox.yMin >> 16; |
|
|
|
|
cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16; |
|
|
|
|
cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16; |
|
|
|
|
|
|
|
|
|
root->ascender = (FT_Short)( root->bbox.yMax ); |
|
|
|
|
root->descender = (FT_Short)( root->bbox.yMin ); |
|
|
|
|
root->height = (FT_Short)( |
|
|
|
|
( ( root->ascender - root->descender ) * 12 ) / 10 ); |
|
|
|
|
cffface->ascender = (FT_Short)( cffface->bbox.yMax ); |
|
|
|
|
cffface->descender = (FT_Short)( cffface->bbox.yMin ); |
|
|
|
|
cffface->height = (FT_Short)( |
|
|
|
|
( ( cffface->ascender - cffface->descender ) * 12 ) / 10 ); |
|
|
|
|
|
|
|
|
|
if ( dict->units_per_em ) |
|
|
|
|
root->units_per_EM = dict->units_per_em; |
|
|
|
|
cffface->units_per_EM = dict->units_per_em; |
|
|
|
|
else |
|
|
|
|
root->units_per_EM = 1000; |
|
|
|
|
cffface->units_per_EM = 1000; |
|
|
|
|
|
|
|
|
|
root->underline_position = |
|
|
|
|
cffface->underline_position = |
|
|
|
|
(FT_Short)( dict->underline_position >> 16 ); |
|
|
|
|
root->underline_thickness = |
|
|
|
|
cffface->underline_thickness = |
|
|
|
|
(FT_Short)( dict->underline_thickness >> 16 ); |
|
|
|
|
|
|
|
|
|
/* retrieve font family & style name */ |
|
|
|
|
root->family_name = cff_index_get_name( &cff->name_index, |
|
|
|
|
face_index ); |
|
|
|
|
cffface->family_name = cff_index_get_name( &cff->name_index, |
|
|
|
|
face_index ); |
|
|
|
|
|
|
|
|
|
if ( root->family_name ) |
|
|
|
|
if ( cffface->family_name ) |
|
|
|
|
{ |
|
|
|
|
char* full = cff_index_get_sid_string( &cff->string_index, |
|
|
|
|
dict->full_name, |
|
|
|
|
psnames ); |
|
|
|
|
char* fullp = full; |
|
|
|
|
char* family = root->family_name; |
|
|
|
|
char* family = cffface->family_name; |
|
|
|
|
|
|
|
|
|
/* We try to extract the style name from the full name. */ |
|
|
|
|
/* We need to ignore spaces and dashes during the search. */ |
|
|
|
@ -584,14 +579,14 @@ |
|
|
|
|
|
|
|
|
|
/* do we have a `/FontName' for a CID-keyed font? */ |
|
|
|
|
if ( cid_font_name ) |
|
|
|
|
root->family_name = cid_font_name; |
|
|
|
|
cffface->family_name = cid_font_name; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( style_name ) |
|
|
|
|
root->style_name = style_name; |
|
|
|
|
cffface->style_name = style_name; |
|
|
|
|
else |
|
|
|
|
/* assume "Regular" style if we don't know better */ |
|
|
|
|
root->style_name = cff_strcpy( memory, (char *)"Regular" ); |
|
|
|
|
cffface->style_name = cff_strcpy( memory, (char *)"Regular" ); |
|
|
|
|
|
|
|
|
|
/*******************************************************************/ |
|
|
|
|
/* */ |
|
|
|
@ -614,7 +609,7 @@ |
|
|
|
|
flags |= FT_FACE_FLAG_KERNING; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
root->face_flags = flags; |
|
|
|
|
cffface->face_flags = flags; |
|
|
|
|
|
|
|
|
|
/*******************************************************************/ |
|
|
|
|
/* */ |
|
|
|
@ -638,14 +633,14 @@ |
|
|
|
|
FT_FREE( weight ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
root->style_flags = flags; |
|
|
|
|
cffface->style_flags = flags; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES |
|
|
|
|
/* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */ |
|
|
|
|
/* has unset this flag because of the 3.0 `post' table */ |
|
|
|
|
if ( dict->cid_registry == 0xFFFFU ) |
|
|
|
|
root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES; |
|
|
|
|
cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/*******************************************************************/ |
|
|
|
@ -663,9 +658,9 @@ |
|
|
|
|
CFF_Encoding encoding = &cff->encoding; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ( nn = 0; nn < (FT_UInt)root->num_charmaps; nn++ ) |
|
|
|
|
for ( nn = 0; nn < (FT_UInt)cffface->num_charmaps; nn++ ) |
|
|
|
|
{ |
|
|
|
|
cmap = root->charmaps[nn]; |
|
|
|
|
cmap = cffface->charmaps[nn]; |
|
|
|
|
|
|
|
|
|
/* Windows Unicode (3,1)? */ |
|
|
|
|
if ( cmap->platform_id == 3 && cmap->encoding_id == 1 ) |
|
|
|
@ -682,18 +677,18 @@ |
|
|
|
|
goto Exit; |
|
|
|
|
|
|
|
|
|
/* we didn't find a Unicode charmap -- synthetize one */ |
|
|
|
|
cmaprec.face = root; |
|
|
|
|
cmaprec.face = cffface; |
|
|
|
|
cmaprec.platform_id = 3; |
|
|
|
|
cmaprec.encoding_id = 1; |
|
|
|
|
cmaprec.encoding = FT_ENCODING_UNICODE; |
|
|
|
|
|
|
|
|
|
nn = (FT_UInt)root->num_charmaps; |
|
|
|
|
nn = (FT_UInt)cffface->num_charmaps; |
|
|
|
|
|
|
|
|
|
FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL ); |
|
|
|
|
|
|
|
|
|
/* if no Unicode charmap was previously selected, select this one */ |
|
|
|
|
if ( root->charmap == NULL && nn != (FT_UInt)root->num_charmaps ) |
|
|
|
|
root->charmap = root->charmaps[nn]; |
|
|
|
|
if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps ) |
|
|
|
|
cffface->charmap = cffface->charmaps[nn]; |
|
|
|
|
|
|
|
|
|
Skip_Unicode: |
|
|
|
|
if ( encoding->count > 0 ) |
|
|
|
@ -701,7 +696,7 @@ |
|
|
|
|
FT_CMap_Class clazz; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmaprec.face = root; |
|
|
|
|
cmaprec.face = cffface; |
|
|
|
|
cmaprec.platform_id = 7; /* Adobe platform id */ |
|
|
|
|
|
|
|
|
|
if ( encoding->offset == 0 ) |
|
|
|
@ -741,7 +736,7 @@ |
|
|
|
|
cff_face_done( FT_Face cffface ) /* CFF_Face */ |
|
|
|
|
{ |
|
|
|
|
CFF_Face face = (CFF_Face)cffface; |
|
|
|
|
FT_Memory memory = face->root.memory; |
|
|
|
|
FT_Memory memory = cffface->memory; |
|
|
|
|
SFNT_Service sfnt = (SFNT_Service)face->sfnt; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|