* src/cff/*: Clean up interface.

Ensure that all driver functions use the signature of the service or driver.
This avoids pointer mismatches, which are technically undefined behaviour.
Recent compilers are more picky in catching them as part of Control Flow
Integrity tests.
This commit is contained in:
Werner Lemberg 2023-05-06 18:57:42 +02:00
parent 8fe50c2adc
commit c041411917
4 changed files with 173 additions and 155 deletions

View File

@ -108,20 +108,20 @@
* They can be implemented by format-specific interfaces. * They can be implemented by format-specific interfaces.
*/ */
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
cff_get_kerning( FT_Face ttface, /* TT_Face */ cff_get_kerning( FT_Face face, /* CFF_Face */
FT_UInt left_glyph, FT_UInt left_glyph,
FT_UInt right_glyph, FT_UInt right_glyph,
FT_Vector* kerning ) FT_Vector* kerning )
{ {
TT_Face face = (TT_Face)ttface; CFF_Face cffface = (CFF_Face)face;
SFNT_Service sfnt = (SFNT_Service)face->sfnt; SFNT_Service sfnt = (SFNT_Service)cffface->sfnt;
kerning->x = 0; kerning->x = 0;
kerning->y = 0; kerning->y = 0;
if ( sfnt ) if ( sfnt )
kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); kerning->x = sfnt->get_kerning( cffface, left_glyph, right_glyph );
return FT_Err_Ok; return FT_Err_Ok;
} }
@ -158,38 +158,38 @@
* FreeType error code. 0 means success. * FreeType error code. 0 means success.
*/ */
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
cff_glyph_load( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ cff_glyph_load( FT_GlyphSlot slot, /* CFF_GlyphSlot */
FT_Size cffsize, /* CFF_Size */ FT_Size size, /* CFF_Size */
FT_UInt glyph_index, FT_UInt glyph_index,
FT_Int32 load_flags ) FT_Int32 load_flags )
{ {
FT_Error error; FT_Error error;
CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; CFF_GlyphSlot cffslot = (CFF_GlyphSlot)slot;
CFF_Size size = (CFF_Size)cffsize; CFF_Size cffsize = (CFF_Size)size;
if ( !slot ) if ( !cffslot )
return FT_THROW( Invalid_Slot_Handle ); return FT_THROW( Invalid_Slot_Handle );
FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index )); FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index ));
/* check whether we want a scaled outline or bitmap */ /* check whether we want a scaled outline or bitmap */
if ( !size ) if ( !cffsize )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
/* reset the size object if necessary */ /* reset the size object if necessary */
if ( load_flags & FT_LOAD_NO_SCALE ) if ( load_flags & FT_LOAD_NO_SCALE )
size = NULL; size = NULL;
if ( size ) if ( cffsize )
{ {
/* these two objects must have the same parent */ /* these two objects must have the same parent */
if ( cffsize->face != cffslot->face ) if ( size->face != slot->face )
return FT_THROW( Invalid_Face_Handle ); return FT_THROW( Invalid_Face_Handle );
} }
/* now load the glyph outline if necessary */ /* now load the glyph outline if necessary */
error = cff_slot_load( slot, size, glyph_index, load_flags ); error = cff_slot_load( cffslot, cffsize, glyph_index, load_flags );
/* force drop-out mode to 2 - irrelevant now */ /* force drop-out mode to 2 - irrelevant now */
/* slot->outline.dropout_mode = 2; */ /* slot->outline.dropout_mode = 2; */
@ -216,7 +216,7 @@
/* it is no longer necessary that those values are identical to */ /* it is no longer necessary that those values are identical to */
/* the values in the `CFF' table */ /* the values in the `CFF' table */
TT_Face ttface = (TT_Face)face; CFF_Face cffface = (CFF_Face)face;
FT_Short dummy; FT_Short dummy;
@ -225,7 +225,7 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without VVAR table */ /* no fast retrieval for blended MM fonts without VVAR table */
if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
!( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) !( cffface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
return FT_THROW( Unimplemented_Feature ); return FT_THROW( Unimplemented_Feature );
#endif #endif
@ -233,7 +233,7 @@
/* otherwise we extract the info from the CFF glyphstrings */ /* otherwise we extract the info from the CFF glyphstrings */
/* (instead of synthesizing a global value using the `OS/2' */ /* (instead of synthesizing a global value using the `OS/2' */
/* table) */ /* table) */
if ( !ttface->vertical_info ) if ( !cffface->vertical_info )
goto Missing_Table; goto Missing_Table;
for ( nn = 0; nn < count; nn++ ) for ( nn = 0; nn < count; nn++ )
@ -241,11 +241,11 @@
FT_UShort ah; FT_UShort ah;
( (SFNT_Service)ttface->sfnt )->get_metrics( ttface, ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface,
1, 1,
start + nn, start + nn,
&dummy, &dummy,
&ah ); &ah );
FT_TRACE5(( " idx %d: advance height %d font unit%s\n", FT_TRACE5(( " idx %d: advance height %d font unit%s\n",
start + nn, start + nn,
@ -259,12 +259,12 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without HVAR table */ /* no fast retrieval for blended MM fonts without HVAR table */
if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
!( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) !( cffface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
return FT_THROW( Unimplemented_Feature ); return FT_THROW( Unimplemented_Feature );
#endif #endif
/* check whether we have data from the `hmtx' table at all */ /* check whether we have data from the `hmtx' table at all */
if ( !ttface->horizontal.number_Of_HMetrics ) if ( !cffface->horizontal.number_Of_HMetrics )
goto Missing_Table; goto Missing_Table;
for ( nn = 0; nn < count; nn++ ) for ( nn = 0; nn < count; nn++ )
@ -272,11 +272,11 @@
FT_UShort aw; FT_UShort aw;
( (SFNT_Service)ttface->sfnt )->get_metrics( ttface, ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface,
0, 0,
start + nn, start + nn,
&dummy, &dummy,
&aw ); &aw );
FT_TRACE5(( " idx %d: advance width %d font unit%s\n", FT_TRACE5(( " idx %d: advance width %d font unit%s\n",
start + nn, start + nn,
@ -312,13 +312,14 @@
* *
*/ */
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_glyph_name( CFF_Face face, cff_get_glyph_name( FT_Face face, /* CFF_Face */
FT_UInt glyph_index, FT_UInt glyph_index,
FT_Pointer buffer, FT_Pointer buffer,
FT_UInt buffer_max ) FT_UInt buffer_max )
{ {
CFF_Font font = (CFF_Font)face->extra.data; CFF_Face cffface = (CFF_Face)face;
CFF_Font font = (CFF_Font)cffface->extra.data;
FT_String* gname; FT_String* gname;
FT_UShort sid; FT_UShort sid;
FT_Error error; FT_Error error;
@ -338,10 +339,7 @@
if ( service && service->get_name ) if ( service && service->get_name )
return service->get_name( FT_FACE( face ), return service->get_name( face, glyph_index, buffer, buffer_max );
glyph_index,
buffer,
buffer_max );
else else
{ {
FT_ERROR(( "cff_get_glyph_name:" FT_ERROR(( "cff_get_glyph_name:"
@ -366,7 +364,7 @@
/* first, locate the sid in the charset table */ /* first, locate the sid in the charset table */
sid = font->charset.sids[glyph_index]; sid = font->charset.sids[glyph_index];
/* now, lookup the name itself */ /* now, look up the name itself */
gname = cff_index_get_sid_string( font, sid ); gname = cff_index_get_sid_string( font, sid );
if ( gname ) if ( gname )
@ -379,21 +377,19 @@
} }
static FT_UInt FT_CALLBACK_DEF( FT_UInt )
cff_get_name_index( CFF_Face face, cff_get_name_index( FT_Face face, /* CFF_Face */
const FT_String* glyph_name ) const FT_String* glyph_name )
{ {
CFF_Font cff; CFF_Face cffface = (CFF_Face)face;
CFF_Charset charset; CFF_Font cff = (CFF_Font)cffface->extra.data;
CFF_Charset charset = &cff->charset;
FT_Service_PsCMaps psnames; FT_Service_PsCMaps psnames;
FT_String* name; FT_String* name;
FT_UShort sid; FT_UShort sid;
FT_UInt i; FT_UInt i;
cff = (CFF_FontRec *)face->extra.data;
charset = &cff->charset;
/* CFF2 table does not have glyph names; */ /* CFF2 table does not have glyph names; */
/* we need to use `post' table method */ /* we need to use `post' table method */
if ( cff->version_major == 2 ) if ( cff->version_major == 2 )
@ -408,7 +404,7 @@
if ( service && service->name_index ) if ( service && service->name_index )
return service->name_index( FT_FACE( face ), glyph_name ); return service->name_index( face, glyph_name );
else else
{ {
FT_ERROR(( "cff_get_name_index:" FT_ERROR(( "cff_get_name_index:"
@ -456,22 +452,23 @@
* *
*/ */
static FT_Int FT_CALLBACK_DEF( FT_Int )
cff_ps_has_glyph_names( FT_Face face ) cff_ps_has_glyph_names( FT_Face face )
{ {
return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0; return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_ps_get_font_info( CFF_Face face, cff_ps_get_font_info( FT_Face face, /* CFF_Face */
PS_FontInfoRec* afont_info ) PS_FontInfoRec* afont_info )
{ {
CFF_Font cff = (CFF_Font)face->extra.data; CFF_Face cffface = (CFF_Face)face;
FT_Error error = FT_Err_Ok; CFF_Font cff = (CFF_Font)cffface->extra.data;
FT_Error error = FT_Err_Ok;
if ( face->is_cff2 ) if ( cffface->is_cff2 )
{ {
error = FT_THROW( Invalid_Argument ); error = FT_THROW( Invalid_Argument );
goto Fail; goto Fail;
@ -480,7 +477,7 @@
if ( cff && !cff->font_info ) if ( cff && !cff->font_info )
{ {
CFF_FontRecDict dict = &cff->top_font.font_dict; CFF_FontRecDict dict = &cff->top_font.font_dict;
FT_Memory memory = face->root.memory; FT_Memory memory = FT_FACE_MEMORY( face );
PS_FontInfoRec* font_info = NULL; PS_FontInfoRec* font_info = NULL;
@ -513,18 +510,19 @@
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_ps_get_font_extra( CFF_Face face, cff_ps_get_font_extra( FT_Face face, /* CFF_Face */
PS_FontExtraRec* afont_extra ) PS_FontExtraRec* afont_extra )
{ {
CFF_Font cff = (CFF_Font)face->extra.data; CFF_Face cffface = (CFF_Face)face;
FT_Error error = FT_Err_Ok; CFF_Font cff = (CFF_Font)cffface->extra.data;
FT_Error error = FT_Err_Ok;
if ( cff && !cff->font_extra ) if ( cff && !cff->font_extra )
{ {
CFF_FontRecDict dict = &cff->top_font.font_dict; CFF_FontRecDict dict = &cff->top_font.font_dict;
FT_Memory memory = face->root.memory; FT_Memory memory = FT_FACE_MEMORY( face );
PS_FontExtraRec* font_extra = NULL; PS_FontExtraRec* font_extra = NULL;
FT_String* embedded_postscript; FT_String* embedded_postscript;
@ -609,17 +607,18 @@
* *
*/ */
static const char* FT_CALLBACK_DEF( const char* )
cff_get_ps_name( CFF_Face face ) cff_get_ps_name( FT_Face face ) /* CFF_Face */
{ {
CFF_Font cff = (CFF_Font)face->extra.data; CFF_Face cffface = (CFF_Face)face;
SFNT_Service sfnt = (SFNT_Service)face->sfnt; CFF_Font cff = (CFF_Font)cffface->extra.data;
SFNT_Service sfnt = (SFNT_Service)cffface->sfnt;
/* following the OpenType specification 1.7, we return the name stored */ /* following the OpenType specification 1.7, we return the name stored */
/* in the `name' table for a CFF wrapped into an SFNT container */ /* in the `name' table for a CFF wrapped into an SFNT container */
if ( FT_IS_SFNT( FT_FACE( face ) ) && sfnt ) if ( FT_IS_SFNT( face ) && sfnt )
{ {
FT_Library library = FT_FACE_LIBRARY( face ); FT_Library library = FT_FACE_LIBRARY( face );
FT_Module sfnt_module = FT_Get_Module( library, "sfnt" ); FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
@ -631,7 +630,7 @@
if ( service && service->get_ps_font_name ) if ( service && service->get_ps_font_name )
return service->get_ps_font_name( FT_FACE( face ) ); return service->get_ps_font_name( face );
} }
return cff ? (const char*)cff->font_name : NULL; return cff ? (const char*)cff->font_name : NULL;
@ -655,7 +654,7 @@
* Otherwise call the service function in the sfnt module. * Otherwise call the service function in the sfnt module.
* *
*/ */
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_cmap_info( FT_CharMap charmap, cff_get_cmap_info( FT_CharMap charmap,
TT_CMapInfo *cmap_info ) TT_CMapInfo *cmap_info )
{ {
@ -697,14 +696,15 @@
* CID INFO SERVICE * CID INFO SERVICE
* *
*/ */
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_ros( CFF_Face face, cff_get_ros( FT_Face face, /* FT_Face */
const char* *registry, const char* *registry,
const char* *ordering, const char* *ordering,
FT_Int *supplement ) FT_Int *supplement )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
CFF_Font cff = (CFF_Font)face->extra.data; CFF_Face cffface = (CFF_Face)face;
CFF_Font cff = (CFF_Font)cffface->extra.data;
if ( cff ) if ( cff )
@ -754,12 +754,13 @@
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_is_cid( CFF_Face face, cff_get_is_cid( FT_Face face, /* CFF_Face */
FT_Bool *is_cid ) FT_Bool *is_cid )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
CFF_Font cff = (CFF_Font)face->extra.data; CFF_Face cffface = (CFF_Face)face;
CFF_Font cff = (CFF_Font)cffface->extra.data;
*is_cid = 0; *is_cid = 0;
@ -777,17 +778,16 @@
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_cid_from_glyph_index( CFF_Face face, cff_get_cid_from_glyph_index( FT_Face face, /* CFF_Face */
FT_UInt glyph_index, FT_UInt glyph_index,
FT_UInt *cid ) FT_UInt *cid )
{ {
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
CFF_Font cff; CFF_Face cffface = (CFF_Face)face;
CFF_Font cff = (CFF_Font)cffface->extra.data;
cff = (CFF_Font)face->extra.data;
if ( cff ) if ( cff )
{ {
FT_UInt c; FT_UInt c;
@ -848,181 +848,195 @@
* *
*/ */
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_set_mm_blend( CFF_Face face, cff_set_mm_blend( FT_Face face, /* CFF_Face */
FT_UInt num_coords, FT_UInt num_coords,
FT_Fixed* coords ) FT_Fixed* coords )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->set_mm_blend( FT_FACE( face ), num_coords, coords ); return mm->set_mm_blend( face, num_coords, coords );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_mm_blend( CFF_Face face, cff_get_mm_blend( FT_Face face, /* CFF_Face */
FT_UInt num_coords, FT_UInt num_coords,
FT_Fixed* coords ) FT_Fixed* coords )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->get_mm_blend( FT_FACE( face ), num_coords, coords ); return mm->get_mm_blend( face, num_coords, coords );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_set_mm_weightvector( CFF_Face face, cff_set_mm_weightvector( FT_Face face, /* CFF_Face */
FT_UInt len, FT_UInt len,
FT_Fixed* weightvector ) FT_Fixed* weightvector )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->set_mm_weightvector( FT_FACE( face ), len, weightvector ); return mm->set_mm_weightvector( face, len, weightvector );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_mm_weightvector( CFF_Face face, cff_get_mm_weightvector( FT_Face face, /* CFF_Face */
FT_UInt* len, FT_UInt* len,
FT_Fixed* weightvector ) FT_Fixed* weightvector )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->get_mm_weightvector( FT_FACE( face ), len, weightvector ); return mm->get_mm_weightvector( face, len, weightvector );
} }
static void FT_CALLBACK_DEF( void )
cff_construct_ps_name( CFF_Face face ) cff_construct_ps_name( FT_Face face ) /* CFF_Face */
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
mm->construct_ps_name( FT_FACE( face ) ); mm->construct_ps_name( face );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_mm_var( CFF_Face face, cff_get_mm_var( FT_Face face, /* CFF_Face */
FT_MM_Var* *master ) FT_MM_Var* *master )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->get_mm_var( FT_FACE( face ), master ); return mm->get_mm_var( face, master );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_set_var_design( CFF_Face face, cff_set_var_design( FT_Face face, /* CFF_Face */
FT_UInt num_coords, FT_UInt num_coords,
FT_Fixed* coords ) FT_Fixed* coords )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->set_var_design( FT_FACE( face ), num_coords, coords ); return mm->set_var_design( face, num_coords, coords );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_var_design( CFF_Face face, cff_get_var_design( FT_Face face, /* CFF_Face */
FT_UInt num_coords, FT_UInt num_coords,
FT_Fixed* coords ) FT_Fixed* coords )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->get_var_design( FT_FACE( face ), num_coords, coords ); return mm->get_var_design( face, num_coords, coords );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_set_named_instance( CFF_Face face, cff_set_named_instance( FT_Face face, /* CFF_Face */
FT_UInt instance_index ) FT_UInt instance_index )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->set_named_instance( FT_FACE( face ), instance_index ); return mm->set_named_instance( face, instance_index );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_get_default_named_instance( CFF_Face face, cff_get_default_named_instance( FT_Face face, /* CFF_Face */
FT_UInt *instance_index ) FT_UInt *instance_index )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->get_default_named_instance( FT_FACE( face ), instance_index ); return mm->get_default_named_instance( face, instance_index );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_load_item_variation_store( CFF_Face face, cff_load_item_variation_store( FT_Face face, /* CFF_Face */
FT_ULong offset, FT_ULong offset,
GX_ItemVarStore itemStore ) GX_ItemVarStore itemStore )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->load_item_var_store( FT_FACE(face), offset, itemStore ); return mm->load_item_var_store( face, offset, itemStore );
} }
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_load_delta_set_index_mapping( CFF_Face face, cff_load_delta_set_index_mapping( FT_Face face, /* CFF_Face */
FT_ULong offset, FT_ULong offset,
GX_DeltaSetIdxMap map, GX_DeltaSetIdxMap map,
GX_ItemVarStore itemStore, GX_ItemVarStore itemStore,
FT_ULong table_len ) FT_ULong table_len )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->load_delta_set_idx_map( FT_FACE( face ), offset, map, return mm->load_delta_set_idx_map( face, offset, map,
itemStore, table_len ); itemStore, table_len );
} }
static FT_Int FT_CALLBACK_DEF( FT_Int )
cff_get_item_delta( CFF_Face face, cff_get_item_delta( FT_Face face, /* CFF_Face */
GX_ItemVarStore itemStore, GX_ItemVarStore itemStore,
FT_UInt outerIndex, FT_UInt outerIndex,
FT_UInt innerIndex ) FT_UInt innerIndex )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->get_item_delta( FT_FACE( face ), itemStore, return mm->get_item_delta( face, itemStore, outerIndex, innerIndex );
outerIndex, innerIndex );
} }
static void FT_CALLBACK_DEF( void )
cff_done_item_variation_store( CFF_Face face, cff_done_item_variation_store( FT_Face face, /* CFF_Face */
GX_ItemVarStore itemStore ) GX_ItemVarStore itemStore )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
mm->done_item_var_store( FT_FACE( face ), itemStore ); mm->done_item_var_store( face, itemStore );
} }
static void FT_CALLBACK_DEF( void )
cff_done_delta_set_index_map( CFF_Face face, cff_done_delta_set_index_map( FT_Face face, /* CFF_Face */
GX_DeltaSetIdxMap deltaSetIdxMap ) GX_DeltaSetIdxMap deltaSetIdxMap )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
mm->done_delta_set_idx_map( FT_FACE ( face ), deltaSetIdxMap ); mm->done_delta_set_idx_map( face, deltaSetIdxMap );
} }
@ -1077,27 +1091,29 @@
* *
*/ */
static FT_Error FT_CALLBACK_DEF( FT_Error )
cff_hadvance_adjust( CFF_Face face, cff_hadvance_adjust( FT_Face face, /* CFF_Face */
FT_UInt gindex, FT_UInt gindex,
FT_Int *avalue ) FT_Int *avalue )
{ {
CFF_Face cffface = (CFF_Face)face;
FT_Service_MetricsVariations FT_Service_MetricsVariations
var = (FT_Service_MetricsVariations)face->tt_var; var = (FT_Service_MetricsVariations)cffface->tt_var;
return var->hadvance_adjust( FT_FACE( face ), gindex, avalue ); return var->hadvance_adjust( face, gindex, avalue );
} }
static void FT_CALLBACK_DEF( void )
cff_metrics_adjust( CFF_Face face ) cff_metrics_adjust( FT_Face face ) /* CFF_Face */
{ {
CFF_Face cffface = (CFF_Face)face;
FT_Service_MetricsVariations FT_Service_MetricsVariations
var = (FT_Service_MetricsVariations)face->tt_var; var = (FT_Service_MetricsVariations)cffface->tt_var;
var->metrics_adjust( FT_FACE( face ) ); var->metrics_adjust( face );
} }

View File

@ -1589,16 +1589,17 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
cff_get_var_blend( CFF_Face face, cff_get_var_blend( FT_Face face, /* CFF_Face */
FT_UInt *num_coords, FT_UInt *num_coords,
FT_Fixed* *coords, FT_Fixed* *coords,
FT_Fixed* *normalizedcoords, FT_Fixed* *normalizedcoords,
FT_MM_Var* *mm_var ) FT_MM_Var* *mm_var )
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
return mm->get_var_blend( FT_FACE( face ), return mm->get_var_blend( face,
num_coords, num_coords,
coords, coords,
normalizedcoords, normalizedcoords,
@ -1607,13 +1608,14 @@
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
cff_done_blend( CFF_Face face ) cff_done_blend( FT_Face face ) /* CFF_Face */
{ {
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; CFF_Face cffface = (CFF_Face)face;
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
if ( mm ) if ( mm )
mm->done_blend( FT_FACE( face ) ); mm->done_blend( face );
} }
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */

View File

@ -105,14 +105,14 @@ FT_BEGIN_HEADER
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_LOCAL( FT_Error ) FT_LOCAL( FT_Error )
cff_get_var_blend( CFF_Face face, cff_get_var_blend( FT_Face face,
FT_UInt *num_coords, FT_UInt *num_coords,
FT_Fixed* *coords, FT_Fixed* *coords,
FT_Fixed* *normalizedcoords, FT_Fixed* *normalizedcoords,
FT_MM_Var* *mm_var ); FT_MM_Var* *mm_var );
FT_LOCAL( void ) FT_LOCAL( void )
cff_done_blend( CFF_Face face ); cff_done_blend( FT_Face face );
#endif #endif

View File

@ -1150,7 +1150,7 @@
} }
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
cff_done_blend( face ); cff_done_blend( cffface );
face->blend = NULL; face->blend = NULL;
#endif #endif
} }