20#include FT_INTERNAL_DEBUG_H
21#include FT_INTERNAL_SFNT_H
22#include FT_INTERNAL_OBJECTS_H
23#include FT_TRUETYPE_IDS_H
31#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
35#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
40#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
44#ifdef TT_CONFIG_OPTION_BDF
46#include FT_SERVICE_BDF_H
53#include FT_SERVICE_GLYPH_DICT_H
54#include FT_SERVICE_POSTSCRIPT_NAME_H
55#include FT_SERVICE_SFNT_H
56#include FT_SERVICE_TT_CMAP_H
58#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
59#include FT_MULTIPLE_MASTERS_H
60#include FT_SERVICE_MULTIPLE_MASTERS_H
71#define FT_COMPONENT sfdriver
132 return FT_THROW( Invalid_Argument );
151 sfnt_service_sfnt_table,
159#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
193 if (
face->num_glyphs < 0 )
198 FT_TRACE0((
"Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
201 for (
i = 0;
i < max_gid;
i++ )
219 sfnt_service_glyph_dict,
234 static const unsigned char sfnt_ps_map[16] =
254 if ( c < 0 || c >= 0x80 )
259 return sfnt_ps_map[
cc >> 3] & ( 1 << (
cc & 0x07 ) );
263#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
271 sfnt_is_alphanumeric(
int c )
280#define ROTL32( x, r ) ( x << r ) | ( x >> ( 32 - r ) )
284 fmix32( FT_UInt32
h )
297 murmur_hash_3_128(
const void*
key,
298 const unsigned int len,
303 const int nblocks = (
int)
len / 16;
310 const FT_UInt32 c1 = 0x239b961b;
311 const FT_UInt32 c2 = 0xab0e9789;
312 const FT_UInt32 c3 = 0x38b34ae5;
313 const FT_UInt32 c4 = 0xa1e38b93;
315 const FT_UInt32*
blocks = (
const FT_UInt32*)(
data + nblocks * 16 );
320 for(
i = -nblocks;
i;
i++ )
322 FT_UInt32 k1 =
blocks[
i * 4 + 0];
323 FT_UInt32 k2 =
blocks[
i * 4 + 1];
324 FT_UInt32 k3 =
blocks[
i * 4 + 2];
325 FT_UInt32 k4 =
blocks[
i * 4 + 3];
335 h1 = h1 * 5 + 0x561ccd1b;
344 h2 = h2 * 5 + 0x0bcaa747;
353 h3 = h3 * 5 + 0x96cd1c35;
362 h4 = h4 * 5 + 0x32ac3b17;
377 k4 ^= (FT_UInt32)
tail[14] << 16;
379 k4 ^= (FT_UInt32)
tail[13] << 8;
381 k4 ^= (FT_UInt32)
tail[12];
388 k3 ^= (FT_UInt32)
tail[11] << 24;
390 k3 ^= (FT_UInt32)
tail[10] << 16;
392 k3 ^= (FT_UInt32)
tail[9] << 8;
394 k3 ^= (FT_UInt32)
tail[8];
401 k2 ^= (FT_UInt32)
tail[7] << 24;
403 k2 ^= (FT_UInt32)
tail[6] << 16;
405 k2 ^= (FT_UInt32)
tail[5] << 8;
407 k2 ^= (FT_UInt32)
tail[4];
414 k1 ^= (FT_UInt32)
tail[3] << 24;
416 k1 ^= (FT_UInt32)
tail[2] << 16;
418 k1 ^= (FT_UInt32)
tail[1] << 8;
420 k1 ^= (FT_UInt32)
tail[0];
454 ((FT_UInt32*)
out)[0] = h1;
455 ((FT_UInt32*)
out)[1] = h2;
456 ((FT_UInt32*)
out)[2] = h3;
457 ((FT_UInt32*)
out)[3] = h4;
468#define IS_WIN( n ) ( (n)->platformID == 3 && \
469 ( (n)->encodingID == 1 || (n)->encodingID == 0 ) )
471#define IS_APPLE( n ) ( (n)->platformID == 1 && \
472 (n)->encodingID == 0 )
479 FT_Bool report_invalid_characters )
496 goto get_win_string_error;
503 if (
p[0] == 0 && char_type(
p[1] ) )
507 if ( report_invalid_characters )
509 " Character 0x%X invalid in PS name string\n",
510 ((
unsigned)
p[0])*256 + (
unsigned)
p[1] ));
522 get_win_string_error:
525 entry->stringLength = 0;
526 entry->stringOffset = 0;
538 FT_Bool report_invalid_characters )
555 goto get_apple_string_error;
562 if ( char_type( *
p ) )
566 if ( report_invalid_characters )
568 " Character `%c' (0x%X) invalid in PS name string\n",
581 get_apple_string_error:
584 entry->stringOffset = 0;
585 entry->stringLength = 0;
604 for (
n = 0;
n <
face->num_names;
n++ )
609 if (
name->nameID ==
id &&
name->stringLength > 0 )
619 return ( *
win >= 0 ) || ( *apple >= 0 );
623#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
639#define MAX_VALUE_DESCRIPTOR_LEN ( 1 + 5 + 1 + 5 + 1 + 4 )
643#define MAX_PS_NAME_LEN 127
680 int_part = (
fixed >> 16 ) & 0xFFFF;
681 frac_part =
fixed & 0xFFFF;
685 while ( int_part > 0 )
687 *
q++ =
'0' + int_part % 10;
703 frac_part = frac_part * 10 + 5;
706 for (
i = 0;
i < 5;
i++ )
708 *
p++ =
'0' + (
char)( frac_part / 0x10000L );
710 frac_part %= 0x10000L;
740 if ( frac_part < 34480 * 10 &&
745 else if ( frac_part == 17232 * 10 &&
749 else if ( frac_part < 17232 * 10 &&
762 static const char hexdigits[16] =
764 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
765 '8',
'9',
'A',
'B',
'C',
'D',
'E',
'F'
775 FT_Service_MultiMasters mm = (FT_Service_MultiMasters)
face->mm;
788 if ( !
face->var_postscript_prefix )
821 " Can't construct PS name prefix for font instances\n" ));
828 face->name_table.stream,
830 sfnt_is_alphanumeric,
832 if ( !
result && apple != -1 )
834 face->name_table.stream,
835 face->name_table.names + apple,
836 sfnt_is_alphanumeric,
842 " No valid PS name prefix for font instances found\n" ));
852 if (
len > MAX_PS_NAME_LEN - ( 1 + 32 + 3 ) )
854 len = MAX_PS_NAME_LEN - ( 1 + 32 + 3 );
858 " Shortening variation PS name prefix\n"
860 " to %d characters\n",
len ));
864 face->var_postscript_prefix_len =
len;
881 char* ps_name =
NULL;
886 ( psid > 255 && psid < 32768 ) )
901 char* subfamily_name;
907 if ( !subfamily_name )
910 " can't construct named instance PS name;\n"
912 " trying to construct normal instance PS name\n" ));
913 goto construct_instance_name;
944 construct_instance_name:
948 face->var_postscript_prefix_len +
949 num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) )
955 p +=
face->var_postscript_prefix_len;
957 for (
i = 0;
i < num_coords;
i++,
coords++, axis++ )
986 if (
p -
result > MAX_PS_NAME_LEN )
991 FT_UInt32 seed = 123456789;
1011 for (
i = 0;
i < 4;
i++,
h-- )
1016 for (
j = 0;
j < 8;
j++ )
1018 *
p-- = hexdigits[
v & 0xF];
1037 if (
face->postscript_name )
1038 return face->postscript_name;
1040#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
1045 face->postscript_name = sfnt_get_var_ps_name(
face );
1046 return face->postscript_name;
1059 face->name_table.stream,
1063 if ( !
result && apple != -1 )
1065 face->name_table.stream,
1066 face->name_table.names + apple,
1077 sfnt_service_ps_name,
1087 tt_service_get_cmap_info,
1093#ifdef TT_CONFIG_OPTION_BDF
1097 const char* *acharset_encoding,
1098 const char* *acharset_registry )
1119 *acharset_encoding =
encoding.u.atom;
1120 *acharset_registry =
registry.u.atom;
1146#if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF
1155#elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES
1163#elif defined TT_CONFIG_OPTION_BDF
1191#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
1192#define PUT_EMBEDDED_BITMAPS( a ) a
1194#define PUT_EMBEDDED_BITMAPS( a ) NULL
1197#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
1198#define PUT_COLOR_LAYERS( a ) a
1200#define PUT_COLOR_LAYERS( a ) NULL
1203#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
1204#define PUT_PS_NAMES( a ) a
1206#define PUT_PS_NAMES( a ) NULL
1297 (
const void*)&sfnt_interface,
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)
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)
return ft_service_list_lookup(sfnt_services, module_interface)
static FT_Bool sfnt_get_name_id(TT_Face face, FT_UShort id, FT_Int *win, FT_Int *apple)
#define PUT_COLOR_LAYERS(a)
static int sfnt_is_postscript(int c)
TT_CMap_Info_GetFunc tt_get_cmap_info const char * module_interface
SFNT_Interface * SFNT_Service
#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_, load_cpal_, load_colr_, free_cpal_, free_colr_, set_palette_, get_colr_layer_, colr_blend_, get_metrics_, get_name_, get_name_id_)
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_free_colr(TT_Face face)
FT_BEGIN_HEADER tt_face_load_colr(TT_Face face, FT_Stream stream)
tt_face_get_colr_layer(TT_Face face, FT_UInt base_glyph, FT_UInt *aglyph_index, FT_UInt *acolor_index, FT_LayerIterator *iterator)
tt_face_colr_blend_layer(TT_Face face, FT_UInt color_index, FT_GlyphSlot dstSlot, FT_GlyphSlot srcSlot)
FT_BEGIN_HEADER tt_face_load_cpal(TT_Face face, FT_Stream stream)
tt_face_palette_set(TT_Face face, FT_UInt palette_index)
tt_face_free_cpal(TT_Face face)
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
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out