20 #include FT_INTERNAL_DEBUG_H 21 #include FT_INTERNAL_SFNT_H 22 #include FT_INTERNAL_OBJECTS_H 23 #include FT_TRUETYPE_IDS_H 32 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS 36 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES 40 #ifdef TT_CONFIG_OPTION_BDF 42 #include FT_SERVICE_BDF_H 49 #include FT_SERVICE_GLYPH_DICT_H 50 #include FT_SERVICE_POSTSCRIPT_NAME_H 51 #include FT_SERVICE_SFNT_H 52 #include FT_SERVICE_TT_CMAP_H 54 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT 55 #include FT_MULTIPLE_MASTERS_H 56 #include FT_SERVICE_MULTIPLE_MASTERS_H 67 #define FT_COMPONENT trace_sfdriver 128 return FT_THROW( Invalid_Argument );
147 sfnt_service_sfnt_table,
155 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES 189 if (
face->num_glyphs < 0 )
194 FT_TRACE0((
"Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
197 for (
i = 0;
i < max_gid;
i++ )
215 sfnt_service_glyph_dict,
230 static const unsigned char sfnt_ps_map[16] =
255 return sfnt_ps_map[
cc >> 3] & ( 1 << (
cc & 0x07 ) );
259 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT 267 sfnt_is_alphanumeric(
int c )
276 #define ROTL32( x, r ) ( x << r ) | ( x >> ( 32 - r ) ) 280 fmix32( FT_UInt32
h )
293 murmur_hash_3_128(
const void*
key,
294 const unsigned int len,
299 const int nblocks = (
int)
len / 16;
306 const FT_UInt32 c1 = 0x239b961b;
307 const FT_UInt32 c2 = 0xab0e9789;
308 const FT_UInt32 c3 = 0x38b34ae5;
309 const FT_UInt32 c4 = 0xa1e38b93;
311 const FT_UInt32*
blocks = (
const FT_UInt32*)(
data + nblocks * 16 );
316 for(
i = -nblocks;
i;
i++ )
318 FT_UInt32 k1 =
blocks[
i * 4 + 0];
319 FT_UInt32 k2 =
blocks[
i * 4 + 1];
320 FT_UInt32 k3 =
blocks[
i * 4 + 2];
321 FT_UInt32 k4 =
blocks[
i * 4 + 3];
331 h1 = h1 * 5 + 0x561ccd1b;
340 h2 = h2 * 5 + 0x0bcaa747;
349 h3 = h3 * 5 + 0x96cd1c35;
358 h4 = h4 * 5 + 0x32ac3b17;
373 k4 ^= (FT_UInt32)
tail[14] << 16;
375 k4 ^= (FT_UInt32)
tail[13] << 8;
377 k4 ^= (FT_UInt32)
tail[12];
384 k3 ^= (FT_UInt32)
tail[11] << 24;
386 k3 ^= (FT_UInt32)
tail[10] << 16;
388 k3 ^= (FT_UInt32)
tail[9] << 8;
390 k3 ^= (FT_UInt32)
tail[8];
397 k2 ^= (FT_UInt32)
tail[7] << 24;
399 k2 ^= (FT_UInt32)
tail[6] << 16;
401 k2 ^= (FT_UInt32)
tail[5] << 8;
403 k2 ^= (FT_UInt32)
tail[4];
410 k1 ^= (FT_UInt32)
tail[3] << 24;
412 k1 ^= (FT_UInt32)
tail[2] << 16;
414 k1 ^= (FT_UInt32)
tail[1] << 8;
416 k1 ^= (FT_UInt32)
tail[0];
450 ((FT_UInt32*)
out)[0] = h1;
451 ((FT_UInt32*)
out)[1] = h2;
452 ((FT_UInt32*)
out)[2] = h3;
453 ((FT_UInt32*)
out)[3] = h4;
464 #define IS_WIN( n ) ( (n)->platformID == 3 && \ 465 ( (n)->encodingID == 1 || (n)->encodingID == 0 ) && \ 466 (n)->languageID == 0x409 ) 468 #define IS_APPLE( n ) ( (n)->platformID == 1 && \ 469 (n)->encodingID == 0 && \ 470 (n)->languageID == 0 ) 477 FT_Bool report_invalid_characters )
496 entry->stringLength = 0;
497 entry->stringOffset = 0;
510 if ( char_type(
p[1] ) )
514 if ( report_invalid_characters )
517 " Character `%c' (0x%X) invalid in PS name string\n",
538 FT_Bool report_invalid_characters )
557 entry->stringOffset = 0;
558 entry->stringLength = 0;
569 if ( char_type( *
p ) )
573 if ( report_invalid_characters )
576 " Character `%c' (0x%X) invalid in PS name string\n",
603 for (
n = 0;
n <
face->num_names;
n++ )
608 if (
name->nameID ==
id &&
name->stringLength > 0 )
618 return ( *
win >= 0 ) || ( *apple >= 0 );
622 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT 638 #define MAX_VALUE_DESCRIPTOR_LEN ( 1 + 5 + 1 + 5 + 1 + 4 ) 642 #define MAX_PS_NAME_LEN 127 679 int_part = (
fixed >> 16 ) & 0xFFFF;
680 frac_part =
fixed & 0xFFFF;
684 while ( int_part > 0 )
686 *
q++ =
'0' + int_part % 10;
702 frac_part = frac_part * 10 + 5;
705 for (
i = 0;
i < 5;
i++ )
707 *
p++ =
'0' + (
char)( frac_part / 0x10000L );
709 frac_part %= 0x10000
L;
739 if ( frac_part < 34480 * 10 &&
744 else if ( frac_part == 17232 * 10 &&
748 else if ( frac_part < 17232 * 10 &&
761 static const char hexdigits[16] =
763 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
764 '8',
'9',
'A',
'B',
'C',
'D',
'E',
'F' 774 FT_Service_MultiMasters mm = (FT_Service_MultiMasters)
face->mm;
787 if ( !
face->var_postscript_prefix )
820 " Can't construct PS name prefix for font instances\n" ));
827 face->name_table.stream,
829 sfnt_is_alphanumeric,
833 face->name_table.stream,
834 face->name_table.names + apple,
835 sfnt_is_alphanumeric,
844 if (
len > MAX_PS_NAME_LEN - ( 1 + 32 + 3 ) )
846 len = MAX_PS_NAME_LEN - ( 1 + 32 + 3 );
850 " Shortening variation PS name prefix\n" 852 " to %d characters\n",
len ));
856 face->var_postscript_prefix_len =
len;
873 char* ps_name =
NULL;
878 ( psid > 255 && psid < 32768 ) )
893 char* subfamily_name;
899 if ( !subfamily_name )
902 " can't construct named instance PS name;\n" 904 " trying to construct normal instance PS name\n" ));
905 goto construct_instance_name;
936 construct_instance_name:
940 face->var_postscript_prefix_len +
941 num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) )
947 p +=
face->var_postscript_prefix_len;
949 for (
i = 0;
i < num_coords;
i++,
coords++, axis++ )
978 if (
p -
result > MAX_PS_NAME_LEN )
983 FT_UInt32 seed = 123456789;
1003 for (
i = 0;
i < 4;
i++,
h-- )
1008 for (
j = 0;
j < 8;
j++ )
1010 *
p-- = hexdigits[
v & 0xF];
1029 if (
face->postscript_name )
1030 return face->postscript_name;
1032 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT 1037 face->postscript_name = sfnt_get_var_ps_name(
face );
1038 return face->postscript_name;
1051 face->name_table.stream,
1057 face->name_table.stream,
1058 face->name_table.names + apple,
1069 sfnt_service_ps_name,
1079 tt_service_get_cmap_info,
1085 #ifdef TT_CONFIG_OPTION_BDF 1089 const char* *acharset_encoding,
1090 const char* *acharset_registry )
1111 *acharset_encoding =
encoding.u.atom;
1112 *acharset_registry =
registry.u.atom;
1138 #if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF 1147 #elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES 1155 #elif defined TT_CONFIG_OPTION_BDF 1178 #ifdef FT_CONFIG_OPTION_PIC 1195 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS 1196 #define PUT_EMBEDDED_BITMAPS( a ) a 1198 #define PUT_EMBEDDED_BITMAPS( a ) NULL 1201 #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES 1202 #define PUT_PS_NAMES( a ) a 1204 #define PUT_PS_NAMES( a ) NULL #define FT_ALLOC(ptr, size)
FT_BEGIN_HEADER tt_face_load_sbit(TT_Face face, FT_Stream stream)
tt_face_load_head(TT_Face face, FT_Stream stream)
#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_)
FT_Error(* FT_SFNT_TableLoadFunc)(FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
SFNT_Interface * SFNT_Service
FT_Error(* FT_Module_Constructor)(FT_Module module)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
FT_DEFINE_SERVICE_PSFONTNAMEREC(sfnt_service_ps_name,(FT_PsName_GetFunc) sfnt_get_ps_name) FT_DEFINE_SERVICE_TTCMAPSREC(tt_service_get_cmap_info
struct outqueuenode * tail
#define SFNT_SERVICE_SFNT_TABLE_GET
tt_face_load_hhea(TT_Face face, FT_Stream stream, FT_Bool vertical)
#define FT_DEFINE_MODULE( class_, flags_, size_, name_, version_, requires_, interface_, init_, done_, get_interface_)
GLdouble GLdouble GLdouble r
tt_face_get_kerning(TT_Face face, FT_UInt left_glyph, FT_UInt right_glyph)
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
#define SFNT_INTERFACE_GET
GLenum GLsizei GLenum GLenum const GLvoid * table
tt_face_get_metrics(TT_Face face, FT_Bool vertical, FT_UInt gindex, FT_Short *abearing, FT_UShort *aadvance)
tt_face_load_font_dir(TT_Face face, FT_Stream stream)
tt_face_load_pclt(TT_Face face, FT_Stream stream)
tt_face_get_name(TT_Face face, FT_UShort nameid, FT_String **name)
FT_Error(* FT_BDF_GetCharsetIdFunc)(FT_Face face, const char **acharset_encoding, const char **acharset_registry)
tt_face_set_sbit_strike(TT_Face face, FT_Size_Request req, FT_ULong *astrike_index)
tt_face_load_gasp(TT_Face face, FT_Stream stream)
#define SFNT_SERVICE_PS_NAME_GET
tt_face_free_name(TT_Face face)
tt_get_cmap_info(FT_CharMap charmap, TT_CMapInfo *cmap_info)
tt_face_free_ps_names(TT_Face face)
static char memory[1024 *256]
sfnt_init_face(FT_Stream stream, TT_Face face, FT_Int face_instance_index, FT_Int num_params, FT_Parameter *params)
#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1, serv_id_2, serv_data_2, serv_id_3, serv_data_3, serv_id_4, serv_data_4)
#define FT_SERVICE_ID_BDF
GLfloat GLfloat GLfloat GLfloat h
static char * get_apple_string(FT_Memory memory, FT_Stream stream, TT_Name entry, char_type_func char_type, FT_Bool report_invalid_characters)
tt_face_load_sbit_image(TT_Face face, FT_ULong strike_index, FT_UInt glyph_index, FT_UInt load_flags, FT_Stream stream, FT_Bitmap *map, TT_SBit_MetricsRec *metrics)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLenum GLuint GLenum GLsizei const GLchar * buf
FT_Error(* FT_SFNT_TableInfoFunc)(FT_Face face, FT_UInt idx, FT_ULong *tag, FT_ULong *offset, FT_ULong *length)
tt_face_load_any(TT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
static FT_Bool sfnt_get_name_id(TT_Face face, FT_UShort id, FT_Int *win, FT_Int *apple)
FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict,(FT_GlyphDict_GetNameFunc) cff_get_glyph_name,(FT_GlyphDict_NameIndexFunc) cff_get_name_index) static FT_Int cff_ps_has_glyph_names(FT_Face face)
#define FT_TRACE1(varformat)
ios_base &_STLP_CALL fixed(ios_base &__s)
void *(* FT_SFNT_TableGetFunc)(FT_Face face, FT_Sfnt_Tag tag)
enum FT_Sfnt_Tag_ FT_Sfnt_Tag
FT_Module_Interface(* FT_Module_Requester)(FT_Module module, const char *name)
GLenum GLuint GLenum GLsizei length
#define SFNT_SERVICE_BDF_GET
tt_face_load_cmap(TT_Face face, FT_Stream stream)
tt_face_load_maxp(TT_Face face, FT_Stream stream)
#define TT_SERVICE_CMAP_INFO_GET
#define TT_NAME_ID_PS_NAME
sfnt_load_face(FT_Stream stream, TT_Face face, FT_Int face_instance_index, FT_Int num_params, FT_Parameter *params)
#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1, serv_id_2, serv_data_2, serv_id_3, serv_data_3, serv_id_4, serv_data_4, serv_id_5, serv_data_5)
TT_Get_Name_Func get_name
TT_CMap_Info_GetFunc tt_get_cmap_info const char * module_interface
struct TT_FaceRec_ * TT_Face
TT_CMap_Info_GetFunc tt_get_cmap_info FT_DEFINE_SERVICEDESCREC3(sfnt_services, FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET) sfnt_get_interface(FT_Module module
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_TT_CMAP
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define TT_NAME_ID_VARIATIONS_PREFIX
#define FT_IS_NAMED_INSTANCE(face)
FT_UInt(* FT_GlyphDict_NameIndexFunc)(FT_Face face, FT_String *glyph_name)
#define FT_TRACE0(varformat)
tt_face_free_sbit(TT_Face face)
return ft_service_list_lookup(SFNT_SERVICES_GET, module_interface)
#define FT_IS_VARIATION(face)
GLdouble GLdouble GLdouble GLdouble q
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
#define FT_CALLBACK_DEF(x)
int(* char_type_func)(int c)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
#define FT_SERVICE_ID_SFNT_TABLE
#define FT_DEFINE_SFNT_INTERFACE( class_, goto_table_, init_face_, load_face_, done_face_, get_interface_, load_any_, load_head_, load_hhea_, load_cmap_, load_maxp_, load_os2_, load_post_, load_name_, free_name_, load_kern_, load_gasp_, load_pclt_, load_bhed_, load_sbit_image_, get_psname_, free_psnames_, get_kerning_, load_font_dir_, load_hmtx_, load_eblc_, free_eblc_, set_sbit_strike_, load_strike_metrics_, get_metrics_, get_name_, get_name_id_)
#define FT_STREAM_SEEK(position)
FT_Error(* FT_BDF_GetPropertyFunc)(FT_Face face, const char *prop_name, BDF_PropertyRec *aproperty)
tt_face_load_kern(TT_Face face, FT_Stream stream)
static const char * sfnt_get_ps_name(TT_Face face)
FT_Error(* TT_CMap_Info_GetFunc)(FT_CharMap charmap, TT_CMapInfo *cmap_info)
const char *(* FT_PsName_GetFunc)(FT_Face face)
#define PUT_EMBEDDED_BITMAPS(a)
sfnt_done_face(TT_Face face)
static int sfnt_is_postscript(int c)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define TT_NAME_ID_TYPOGRAPHIC_FAMILY
#define SFNT_SERVICE_GLYPH_DICT_GET
static HINSTANCE instance
static FT_Error sfnt_table_info(TT_Face face, FT_UInt idx, FT_ULong *tag, FT_ULong *offset, FT_ULong *length)
tt_face_load_os2(TT_Face face, FT_Stream stream)
tt_face_load_hmtx(TT_Face face, FT_Stream stream, FT_Bool vertical)
void(* FT_Module_Destructor)(FT_Module module)
FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info,(TT_CMap_Info_GetFunc) cff_get_cmap_info) static FT_Error cff_get_ros(CFF_Face face
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_GLYPH_DICT
#define FT_FRAME_ENTER(size)
tt_face_load_name(TT_Face face, FT_Stream stream)
#define SFNT_SERVICES_GET
#define FT_STRCPYN(dst, src, size)
FT_BEGIN_HEADER tt_face_get_ps_name(TT_Face face, FT_UInt idx, FT_String **PSname)
#define TT_NAME_ID_FONT_FAMILY
static char * get_win_string(FT_Memory memory, FT_Stream stream, TT_Name entry, char_type_func char_type, FT_Bool report_invalid_characters)
FT_Error(* FT_GlyphDict_GetNameFunc)(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
tt_face_load_post(TT_Face face, FT_Stream stream)
static void * get_sfnt_table(TT_Face face, FT_Sfnt_Tag tag)
tt_face_goto_table(TT_Face face, FT_ULong tag, FT_Stream stream, FT_ULong *length)
FT_DEFINE_SERVICE_SFNT_TABLEREC(sfnt_service_sfnt_table,(FT_SFNT_TableLoadFunc) tt_face_load_any,(FT_SFNT_TableGetFunc) get_sfnt_table,(FT_SFNT_TableInfoFunc) sfnt_table_info) static const unsigned char sfnt_ps_map[16]
GLenum GLuint GLint GLenum face
tt_face_load_strike_metrics(TT_Face face, FT_ULong strike_index, FT_Size_Metrics *metrics)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *