📄 sfdriver.c
字号:
* previously selected a size that is listed in the BDF table.
* Should we change the BDF table format to include single offsets
* for `CHARSET_REGISTRY' and `CHARSET_ENCODING'?
*/
error = tt_face_find_bdf_prop( face, "CHARSET_REGISTRY", ®istry );
if ( !error )
{
error = tt_face_find_bdf_prop( face, "CHARSET_ENCODING", &encoding );
if ( !error )
{
if ( registry.type == BDF_PROPERTY_TYPE_ATOM &&
encoding.type == BDF_PROPERTY_TYPE_ATOM )
{
*acharset_encoding = encoding.u.atom;
*acharset_registry = registry.u.atom;
}
else
error = FT_Err_Invalid_Argument;
}
}
return error;
}
static const FT_Service_BDFRec sfnt_service_bdf =
{
(FT_BDF_GetCharsetIdFunc) sfnt_get_charset_id,
(FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop,
};
#endif /* TT_CONFIG_OPTION_BDF */
/*
* SERVICE LIST
*/
static const FT_ServiceDescRec sfnt_services[] =
{
{ FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table },
{ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name },
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
{ FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict },
#endif
#ifdef TT_CONFIG_OPTION_BDF
{ FT_SERVICE_ID_BDF, &sfnt_service_bdf },
#endif
{ FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info },
{ NULL, NULL }
};
FT_CALLBACK_DEF( FT_Module_Interface )
sfnt_get_interface( FT_Module module,
const char* module_interface )
{
FT_UNUSED( module );
return ft_service_list_lookup( sfnt_services, module_interface );
}
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
FT_CALLBACK_DEF( FT_Error )
tt_face_load_sfnt_header_stub( TT_Face face,
FT_Stream stream,
FT_Long face_index,
SFNT_Header header )
{
FT_UNUSED( face );
FT_UNUSED( stream );
FT_UNUSED( face_index );
FT_UNUSED( header );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( FT_Error )
tt_face_load_directory_stub( TT_Face face,
FT_Stream stream,
SFNT_Header header )
{
FT_UNUSED( face );
FT_UNUSED( stream );
FT_UNUSED( header );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( FT_Error )
tt_face_load_hdmx_stub( TT_Face face,
FT_Stream stream )
{
FT_UNUSED( face );
FT_UNUSED( stream );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( void )
tt_face_free_hdmx_stub( TT_Face face )
{
FT_UNUSED( face );
}
FT_CALLBACK_DEF( FT_Error )
tt_face_set_sbit_strike_stub( TT_Face face,
FT_UInt x_ppem,
FT_UInt y_ppem,
FT_ULong* astrike_index )
{
/*
* We simply forge a FT_Size_Request and call the real function
* that does all the work.
*
* This stub might be called by libXfont in the X.Org Xserver,
* compiled against version 2.1.8 or newer.
*/
FT_Size_RequestRec req;
req.type = FT_SIZE_REQUEST_TYPE_NOMINAL;
req.width = (FT_F26Dot6)x_ppem;
req.height = (FT_F26Dot6)y_ppem;
req.horiResolution = 0;
req.vertResolution = 0;
*astrike_index = 0x7FFFFFFFUL;
return tt_face_set_sbit_strike( face, &req, astrike_index );
}
FT_CALLBACK_DEF( FT_Error )
tt_face_load_sbit_stub( TT_Face face,
FT_Stream stream )
{
FT_UNUSED( face );
FT_UNUSED( stream );
/*
* This function was originally implemented to load the sbit table.
* However, it has been replaced by `tt_face_load_eblc', and this stub
* is only there for some rogue clients which would want to call it
* directly (which doesn't make much sense).
*/
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( void )
tt_face_free_sbit_stub( TT_Face face )
{
/* nothing to do in this stub */
FT_UNUSED( face );
}
FT_CALLBACK_DEF( FT_Error )
tt_face_load_charmap_stub( TT_Face face,
void* cmap,
FT_Stream input )
{
FT_UNUSED( face );
FT_UNUSED( cmap );
FT_UNUSED( input );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( FT_Error )
tt_face_free_charmap_stub( TT_Face face,
void* cmap )
{
FT_UNUSED( face );
FT_UNUSED( cmap );
return 0;
}
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
static
const SFNT_Interface sfnt_interface =
{
tt_face_goto_table,
sfnt_init_face,
sfnt_load_face,
sfnt_done_face,
sfnt_get_interface,
tt_face_load_any,
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_load_sfnt_header_stub,
tt_face_load_directory_stub,
#endif
tt_face_load_head,
tt_face_load_hhea,
tt_face_load_cmap,
tt_face_load_maxp,
tt_face_load_os2,
tt_face_load_post,
tt_face_load_name,
tt_face_free_name,
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_load_hdmx_stub,
tt_face_free_hdmx_stub,
#endif
tt_face_load_kern,
tt_face_load_gasp,
tt_face_load_pclt,
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* see `ttload.h' */
tt_face_load_bhed,
#else
0,
#endif
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_set_sbit_strike_stub,
tt_face_load_sbit_stub,
tt_find_sbit_image,
tt_load_sbit_metrics,
#endif
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
tt_face_load_sbit_image,
#else
0,
#endif
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_free_sbit_stub,
#endif
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
/* see `ttpost.h' */
tt_face_get_ps_name,
tt_face_free_ps_names,
#else
0,
0,
#endif
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_load_charmap_stub,
tt_face_free_charmap_stub,
#endif
/* since version 2.1.8 */
tt_face_get_kerning,
/* since version 2.2 */
tt_face_load_font_dir,
tt_face_load_hmtx,
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* see `ttsbit.h' and `sfnt.h' */
tt_face_load_eblc,
tt_face_free_eblc,
tt_face_set_sbit_strike,
tt_face_load_strike_metrics,
#else
0,
0,
0,
0,
#endif
tt_face_get_metrics
};
FT_CALLBACK_TABLE_DEF
const FT_Module_Class sfnt_module_class =
{
0, /* not a font driver or renderer */
sizeof( FT_ModuleRec ),
"sfnt", /* driver name */
0x10000L, /* driver version 1.0 */
0x20000L, /* driver requires FreeType 2.0 or higher */
(const void*)&sfnt_interface, /* module specific interface */
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) sfnt_get_interface
};
/* END */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -