cff_size_select( FT_Size size, FT_ULong strike_index ) { CFF_Size cffsize = (CFF_Size)size; PSH_Globals_Funcs funcs; cffsize->strike_index = strike_index; FT_Select_Metrics( size->face, strike_index ); funcs = cff_size_get_globals_funcs( cffsize ); if ( funcs ) { CFF_Face face = (CFF_Face)size->face; CFF_Font font = (CFF_Font)face->extra.data; CFF_Internal internal = (CFF_Internal)size->internal; FT_ULong top_upm = font->top_font.font_dict.units_per_em; FT_UInt i; funcs->set_scale( internal->topfont, size->metrics.x_scale, size->metrics.y_scale, 0, 0 ); for ( i = font->num_subfonts; i > 0; i-- ) { CFF_SubFont sub = font->subfonts[i - 1]; FT_ULong sub_upm = sub->font_dict.units_per_em; FT_Pos x_scale, y_scale; if ( top_upm != sub_upm ) { x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm ); y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm ); } else { x_scale = size->metrics.x_scale; y_scale = size->metrics.y_scale; } funcs->set_scale( internal->subfonts[i - 1], x_scale, y_scale, 0, 0 ); } } return FT_Err_Ok; }
CID_Size_Reset( CID_Size size ) { PSH_Globals_Funcs funcs = CID_Size_Get_Globals_Funcs( size ); FT_Error error = 0; if ( funcs ) error = funcs->set_scale( (PSH_Globals)size->root.internal, size->root.metrics.x_scale, size->root.metrics.y_scale, 0, 0 ); return error; }
cff_size_reset( CFF_Size size ) { PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size ); FT_Error error = 0; if ( funcs ) error = funcs->set_scale( (PSH_Globals)size->internal, size->metrics.x_scale, size->metrics.y_scale, 0, 0 ); return error; }
T1_Size_Request( T1_Size size, FT_Size_Request req ) { PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); FT_Request_Metrics( size->root.face, req ); if ( funcs ) funcs->set_scale( (PSH_Globals)size->root.internal, size->root.metrics.x_scale, size->root.metrics.y_scale, 0, 0 ); return T1_Err_Ok; }
T1_Size_Request( FT_Size t1size, /* T1_Size */ FT_Size_Request req ) { T1_Size size = (T1_Size)t1size; PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); FT_Request_Metrics( size->root.face, req ); if ( funcs ) funcs->set_scale( (PSH_Globals)t1size->internal->module_data, size->root.metrics.x_scale, size->root.metrics.y_scale, 0, 0 ); return FT_Err_Ok; }
cid_size_request( FT_Size size, FT_Size_Request req ) { PSH_Globals_Funcs funcs; FT_Request_Metrics( size->face, req ); funcs = cid_size_get_globals_funcs( (CID_Size)size ); if ( funcs ) funcs->set_scale( (PSH_Globals)size->internal, size->metrics.x_scale, size->metrics.y_scale, 0, 0 ); return CID_Err_Ok; }
cid_size_reset( FT_Size cidsize, /* CID_Size */ FT_UInt char_width, FT_UInt char_height ) { CID_Size size = (CID_Size)cidsize; PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size ); FT_Error error = 0; FT_UNUSED( char_width ); FT_UNUSED( char_height ); if ( funcs ) error = funcs->set_scale( (PSH_Globals)cidsize->internal, cidsize->metrics.x_scale, cidsize->metrics.y_scale, 0, 0 ); return error; }
cff_size_request( FT_Size size, FT_Size_Request req ) { CFF_Size cffsize = (CFF_Size)size; PSH_Globals_Funcs funcs; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS if ( FT_HAS_FIXED_SIZES( size->face ) ) { CFF_Face cffface = (CFF_Face)size->face; SFNT_Service sfnt = (SFNT_Service)cffface->sfnt; FT_ULong strike_index; if ( sfnt->set_sbit_strike( cffface, req, &strike_index ) ) cffsize->strike_index = 0xFFFFFFFFUL; else return cff_size_select( size, strike_index ); } #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ FT_Request_Metrics( size->face, req ); funcs = cff_size_get_globals_funcs( cffsize ); if ( funcs ) { CFF_Face cffface = (CFF_Face)size->face; CFF_Font font = (CFF_Font)cffface->extra.data; CFF_Internal internal = (CFF_Internal)size->internal; FT_ULong top_upm = font->top_font.font_dict.units_per_em; FT_UInt i; funcs->set_scale( internal->topfont, size->metrics.x_scale, size->metrics.y_scale, 0, 0 ); for ( i = font->num_subfonts; i > 0; i-- ) { CFF_SubFont sub = font->subfonts[i - 1]; FT_ULong sub_upm = sub->font_dict.units_per_em; FT_Pos x_scale, y_scale; if ( top_upm != sub_upm ) { x_scale = FT_MulDiv( size->metrics.x_scale, top_upm, sub_upm ); y_scale = FT_MulDiv( size->metrics.y_scale, top_upm, sub_upm ); } else { x_scale = size->metrics.x_scale; y_scale = size->metrics.y_scale; } funcs->set_scale( internal->subfonts[i - 1], x_scale, y_scale, 0, 0 ); } } return FT_Err_Ok; }