📄 t2driver.c
字号:
if ( !slot ) return T2_Err_Invalid_Glyph_Handle; /* check whether we want a scaled outline or bitmap */ if ( !size ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; if ( load_flags & FT_LOAD_NO_SCALE ) size = NULL; /* reset the size object if necessary */ if ( size ) { /* these two object must have the same parent */ if ( size->face != slot->root.face ) return T2_Err_Invalid_Face_Handle; } /* now load the glyph outline if necessary */ error = T2_Load_Glyph( slot, size, glyph_index, load_flags ); /* force drop-out mode to 2 - irrelevant now */ /* slot->outline.dropout_mode = 2; */ return error; } /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** ****/ /**** C H A R A C T E R M A P P I N G S ****/ /**** ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* Get_Char_Index */ /* */ /* <Description> */ /* Uses a charmap to return a given character code's glyph index. */ /* */ /* <Input> */ /* charmap :: A handle to the source charmap object. */ /* charcode :: The character code. */ /* */ /* <Return> */ /* Glyph index. 0 means `undefined character code'. */ /* */ static FT_UInt t2_get_char_index( TT_CharMap charmap, FT_Long charcode ) { FT_Error error; T2_Face face; TT_CMapTable* cmap; cmap = &charmap->cmap; face = (T2_Face)charmap->root.face; /* Load table if needed */ if ( !cmap->loaded ) { SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt; error = sfnt->load_charmap( face, cmap, face->root.stream ); if ( error ) return 0; cmap->loaded = TRUE; } return ( cmap->get_index ? cmap->get_index( cmap, charcode ) : 0 ); } /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** ****/ /**** D R I V E R I N T E R F A C E ****/ /**** ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ static FT_Module_Interface t2_get_interface( T2_Driver driver, const char* interface ) { FT_Module sfnt; /* we simply pass our request to the `sfnt' module */ sfnt = FT_Get_Module( driver->root.root.library, "sfnt" ); return sfnt ? sfnt->clazz->get_interface( sfnt, interface ) : 0; } /* The FT_DriverInterface structure is defined in ftdriver.h. */ FT_CALLBACK_TABLE_DEF const FT_Driver_Class cff_driver_class = { /* begin with the FT_Module_Class fields */ { ft_module_font_driver | ft_module_driver_scalable, sizeof( T2_DriverRec ), "cff", 0x10000L, 0x20000L, 0, /* module-specific interface */ (FT_Module_Constructor)T2_Init_Driver, (FT_Module_Destructor) T2_Done_Driver, (FT_Module_Requester) t2_get_interface, }, /* now the specific driver fields */ sizeof( TT_FaceRec ), sizeof( FT_SizeRec ), sizeof( T2_GlyphSlotRec ), (FTDriver_initFace) T2_Init_Face, (FTDriver_doneFace) T2_Done_Face, (FTDriver_initSize) 0, (FTDriver_doneSize) 0, (FTDriver_initGlyphSlot)0, (FTDriver_doneGlyphSlot)0, (FTDriver_setCharSizes) 0, (FTDriver_setPixelSizes)0, (FTDriver_loadGlyph) Load_Glyph, (FTDriver_getCharIndex) t2_get_char_index, (FTDriver_getKerning) Get_Kerning, (FTDriver_attachFile) 0, (FTDriver_getAdvances) 0 };#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS /*************************************************************************/ /* */ /* <Function> */ /* getDriverClass */ /* */ /* <Description> */ /* This function is used when compiling the TrueType driver as a */ /* shared library (`.DLL' or `.so'). It will be used by the */ /* high-level library of FreeType to retrieve the address of the */ /* driver's generic interface. */ /* */ /* It shouldn't be implemented in a static build, as each driver must */ /* have the same function as an exported entry point. */ /* */ /* <Return> */ /* The address of the TrueType's driver generic interface. The */ /* format-specific interface can then be retrieved through the method */ /* interface->get_format_interface. */ /* */ FT_EXPORT_DEF( const FT_Driver_Class* ) getDriverClass( void ) { return &cff_driver_class; }#endif /* CONFIG_OPTION_DYNAMIC_DRIVERS *//* END */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -