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] =
250 if ( c < 0 || c >= 0x80 )
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 %= 0x10000L;
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
ios_base &_STLP_CALL fixed(ios_base &__s)
struct outqueuenode * tail
static HINSTANCE instance
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
#define FT_IS_VARIATION(face)
#define FT_IS_NAMED_INSTANCE(face)
#define FT_CALLBACK_DEF(x)
#define FT_TRACE0(varformat)
#define FT_TRACE1(varformat)
#define FT_ALLOC(ptr, size)
#define FT_STRCPYN(dst, src, size)
void(* FT_Module_Destructor)(FT_Module module)
FT_Error(* FT_Module_Constructor)(FT_Module module)
FT_Module_Interface(* FT_Module_Requester)(FT_Module module, const char *name)
#define FT_DEFINE_MODULE( class_, flags_, size_, name_, version_, requires_, interface_, init_, done_, get_interface_)
#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1, serv_id_2, serv_data_2, serv_id_3, serv_data_3)
#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_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)
#define FT_FRAME_ENTER(size)
#define FT_STREAM_SEEK(position)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLdouble GLdouble GLdouble GLdouble q
GLenum GLuint GLint GLenum face
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLfloat GLfloat GLfloat GLfloat h
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
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_FONT_FAMILY
static char memory[1024 *256]
static FT_Error sfnt_table_info(TT_Face face, FT_UInt idx, FT_ULong *tag, FT_ULong *offset, FT_ULong *length)
int(* char_type_func)(int c)
#define PUT_EMBEDDED_BITMAPS(a)
static char * get_win_string(FT_Memory memory, FT_Stream stream, TT_Name entry, char_type_func char_type, FT_Bool report_invalid_characters)
static const char * sfnt_get_ps_name(TT_Face face)
return ft_service_list_lookup(SFNT_SERVICES_GET, module_interface)
static char * get_apple_string(FT_Memory memory, FT_Stream stream, TT_Name entry, char_type_func char_type, FT_Bool report_invalid_characters)
static void * get_sfnt_table(TT_Face face, FT_Sfnt_Tag tag)
static FT_Bool sfnt_get_name_id(TT_Face face, FT_UShort id, FT_Int *win, FT_Int *apple)
static int sfnt_is_postscript(int c)
TT_CMap_Info_GetFunc tt_get_cmap_info const char * module_interface
#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_)
SFNT_Interface * SFNT_Service
#define SFNT_SERVICE_PS_NAME_GET
#define SFNT_SERVICE_BDF_GET
#define SFNT_SERVICES_GET
#define SFNT_INTERFACE_GET
#define SFNT_SERVICE_SFNT_TABLE_GET
#define TT_SERVICE_CMAP_INFO_GET
#define SFNT_SERVICE_GLYPH_DICT_GET
tt_face_get_name(TT_Face face, FT_UShort nameid, FT_String **name)
sfnt_init_face(FT_Stream stream, TT_Face face, FT_Int face_instance_index, FT_Int num_params, FT_Parameter *params)
sfnt_load_face(FT_Stream stream, TT_Face face, FT_Int face_instance_index, FT_Int num_params, FT_Parameter *params)
sfnt_done_face(TT_Face face)
TT_Get_Name_Func get_name
#define FT_SERVICE_ID_BDF
FT_Error(* FT_BDF_GetPropertyFunc)(FT_Face face, const char *prop_name, BDF_PropertyRec *aproperty)
FT_Error(* FT_BDF_GetCharsetIdFunc)(FT_Face face, const char **acharset_encoding, const char **acharset_registry)
#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_)
#define FT_SERVICE_ID_GLYPH_DICT
FT_UInt(* FT_GlyphDict_NameIndexFunc)(FT_Face face, FT_String *glyph_name)
FT_Error(* FT_GlyphDict_GetNameFunc)(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_)
#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
const char *(* FT_PsName_GetFunc)(FT_Face face)
#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_)
void *(* FT_SFNT_TableGetFunc)(FT_Face face, FT_Sfnt_Tag tag)
#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_)
FT_Error(* FT_SFNT_TableLoadFunc)(FT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
#define FT_SERVICE_ID_SFNT_TABLE
FT_Error(* FT_SFNT_TableInfoFunc)(FT_Face face, FT_UInt idx, FT_ULong *tag, FT_ULong *offset, FT_ULong *length)
FT_Error(* TT_CMap_Info_GetFunc)(FT_CharMap charmap, TT_CMapInfo *cmap_info)
#define FT_SERVICE_ID_TT_CMAP
#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_)
tt_get_cmap_info(FT_CharMap charmap, TT_CMapInfo *cmap_info)
tt_face_get_kerning(TT_Face face, FT_UInt left_glyph, FT_UInt right_glyph)
tt_face_load_kern(TT_Face face, FT_Stream stream)
tt_face_free_name(TT_Face face)
tt_face_load_post(TT_Face face, FT_Stream stream)
tt_face_load_pclt(TT_Face face, FT_Stream stream)
tt_face_load_gasp(TT_Face face, FT_Stream stream)
tt_face_load_font_dir(TT_Face face, FT_Stream stream)
tt_face_load_head(TT_Face face, FT_Stream stream)
tt_face_load_os2(TT_Face face, FT_Stream stream)
tt_face_load_maxp(TT_Face face, FT_Stream stream)
tt_face_load_any(TT_Face face, FT_ULong tag, FT_Long offset, FT_Byte *buffer, FT_ULong *length)
tt_face_goto_table(TT_Face face, FT_ULong tag, FT_Stream stream, FT_ULong *length)
tt_face_load_cmap(TT_Face face, FT_Stream stream)
tt_face_load_name(TT_Face face, FT_Stream stream)
tt_face_get_metrics(TT_Face face, FT_Bool vertical, FT_UInt gindex, FT_Short *abearing, FT_UShort *aadvance)
tt_face_load_hhea(TT_Face face, FT_Stream stream, FT_Bool vertical)
tt_face_load_hmtx(TT_Face face, FT_Stream stream, FT_Bool vertical)
#define TT_NAME_ID_TYPOGRAPHIC_FAMILY
#define TT_NAME_ID_VARIATIONS_PREFIX
#define TT_NAME_ID_PS_NAME
tt_face_free_ps_names(TT_Face face)
FT_BEGIN_HEADER tt_face_get_ps_name(TT_Face face, FT_UInt idx, FT_String **PSname)
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)
tt_face_set_sbit_strike(TT_Face face, FT_Size_Request req, FT_ULong *astrike_index)
tt_face_load_strike_metrics(TT_Face face, FT_ULong strike_index, FT_Size_Metrics *metrics)
FT_BEGIN_HEADER tt_face_load_sbit(TT_Face face, FT_Stream stream)
tt_face_free_sbit(TT_Face face)
enum FT_Sfnt_Tag_ FT_Sfnt_Tag
struct TT_FaceRec_ * TT_Face