32#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
39#ifdef TT_CONFIG_OPTION_BDF
51#define FT_COMPONENT sfobjs
71 for (
n = 0;
n <
len;
n++ )
78 if ( code < 32 || code > 127 )
106 for (
n = 0;
n <
len;
n++ )
113 if ( code < 32 || code > 127 )
143 FT_Int found_apple_roman = -1;
144 FT_Int found_apple_english = -1;
146 FT_Int found_unicode = -1;
155 rec =
face->name_table.names;
156 for (
n = 0;
n <
face->num_names;
n++, rec++ )
186 found_apple_english =
n;
188 found_apple_roman =
n;
195 if ( found_win == -1 || ( rec->
languageID & 0x3FF ) == 0x009 )
218 found_apple = found_apple_roman;
219 if ( found_apple_english >= 0 )
220 found_apple = found_apple_english;
227 if ( found_win >= 0 && !( found_apple >= 0 && !
is_english ) )
229 rec =
face->name_table.names + found_win;
251 else if ( found_apple >= 0 )
253 rec =
face->name_table.names + found_apple;
256 else if ( found_unicode >= 0 )
258 rec =
face->name_table.names + found_unicode;
293 typedef struct TEncoding_
302 const TEncoding tt_encodings[] =
324 limit =
cur +
sizeof ( tt_encodings ) /
sizeof ( tt_encodings[0] );
328 if (
cur->platform_id == platform_id )
330 if (
cur->encoding_id == encoding_id ||
331 cur->encoding_id == -1 )
332 return cur->encoding;
336 return FT_ENCODING_NONE;
345 FT_Int* face_instance_index,
355#define FT_STRUCTURE TTC_HeaderRec
364 face->ttc_header.tag = 0;
365 face->ttc_header.version = 0;
366 face->ttc_header.count = 0;
376 FT_TRACE2((
"sfnt_open_font: file is a WOFF; synthesizing SFNT\n" ));
392 FT_TRACE2((
"sfnt_open_font: file is a WOFF2; synthesizing SFNT\n" ));
409 if (
tag != 0x00010000UL &&
416 tag != 0x00020000UL )
418 FT_TRACE2((
" not a font using the SFNT container format\n" ));
419 return FT_THROW( Unknown_File_Format );
429 FT_TRACE3((
"sfnt_open_font: file is a collection\n" ));
435 face->ttc_header.count ));
437 if (
face->ttc_header.count == 0 )
455 for (
n = 0;
n <
face->ttc_header.count;
n++ )
462 FT_TRACE3((
"sfnt_open_font: synthesize TTC\n" ));
464 face->ttc_header.version = 1 << 16;
465 face->ttc_header.count = 1;
480 FT_Int face_instance_index,
502 FT_ERROR((
"sfnt_init_face: cannot access `sfnt' module\n" ));
512#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
541 &face_instance_index,
549 FT_TRACE2((
"sfnt_init_face: %p (index %d)\n",
551 face_instance_index ));
553 face_index =
FT_ABS( face_instance_index ) & 0xFFFF;
556 if ( face_instance_index < 0 )
559 if ( face_index >=
face->ttc_header.count )
561 if ( face_instance_index >= 0 )
562 return FT_THROW( Invalid_Argument );
575#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
595 instance_index =
FT_ABS( face_instance_index ) >> 16;
617 if (
version != 0x00010000UL ||
622 !( instance_size == 4 + 4 * num_axes ||
623 instance_size == 6 + 4 * num_axes ) ||
625 num_instances > 0x7EFF ||
627 axis_size * num_axes +
628 instance_size * num_instances > fvar_len )
646 !(
FT_ALLOC( default_values, num_axes * 4 ) ||
647 FT_ALLOC( instance_values, num_axes * 4 ) ) )
651 FT_ULong default_value_offset, instance_offset;
657 default_value_offset = array_start + 8;
660 for (
i = 0;
i < num_axes;
i++ )
664 default_value_offset += axis_size;
668 instance_offset = array_start + axis_size * num_axes + 4;
670 for (
i = 0;
i < num_instances;
i++ )
676 if ( !
ft_memcmp( default_values, instance_values, num_axes * 4 ) )
679 instance_offset += instance_size;
682 if (
i == num_instances )
702 if ( instance_index > num_instances )
704 if ( face_instance_index >= 0 )
705 return FT_THROW( Invalid_Argument );
710 face->root.style_flags = (
FT_Long)num_instances << 16;
714 face->root.num_faces =
face->ttc_header.count;
715 face->root.face_index = face_instance_index;
718 if ( woff2_num_faces )
719 face->root.num_faces = woff2_num_faces;
728 FT_TRACE2(( "`" #x "' " )); \
729 FT_TRACE3(( "-->\n" )); \
731 error = sfnt->load_ ## x( face, stream ); \
733 FT_TRACE2(( "%s\n", ( !error ) \
735 : FT_ERR_EQ( error, Table_Missing ) \
737 : "failed to load" )); \
738 FT_TRACE3(( "\n" )); \
741#define LOADM_( x, vertical ) \
744 FT_TRACE2(( "`%s" #x "' ", \
745 vertical ? "vertical " : "" )); \
746 FT_TRACE3(( "-->\n" )); \
748 error = sfnt->load_ ## x( face, stream, vertical ); \
750 FT_TRACE2(( "%s\n", ( !error ) \
752 : FT_ERR_EQ( error, Table_Missing ) \
754 : "failed to load" )); \
755 FT_TRACE3(( "\n" )); \
758#define GET_NAME( id, field ) \
761 error = tt_face_get_name( face, TT_NAME_ID_ ## id, field ); \
770 FT_Int face_instance_index,
775#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
797 for (
i = 0;
i < num_params;
i++ )
800 ignore_typographic_family =
TRUE;
802 ignore_typographic_subfamily =
TRUE;
826#ifdef FT_CONFIG_OPTION_INCREMENTAL
827 has_outline =
FT_BOOL(
face->root.internal->incremental_interface ||
856 if ( !is_apple_sbit || is_apple_sbix )
867 if ( has_CBLC || has_CBDT )
872 if (
face->header.Units_Per_EM < 16 ||
873 face->header.Units_Per_EM > 16384 )
890#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
891 psnames_error =
error;
896 if ( !is_apple_sbit )
907#ifdef FT_CONFIG_OPTION_INCREMENTAL
910 if (
face->root.internal->incremental_interface &&
911 face->root.internal->incremental_interface->funcs->
914 face->horizontal.number_Of_HMetrics = 0;
925 FT_TRACE2((
"This is an SFNT Mac font.\n" ));
934#ifdef FT_CONFIG_OPTION_INCREMENTAL
937 if (
face->root.internal->incremental_interface &&
938 face->root.internal->incremental_interface->funcs->
941 face->horizontal.number_Of_HMetrics = 0;
958 face->vertical_info = 1;
968 face->os2.version = 0xFFFFU;
990 face->root.num_glyphs =
face->max_profile.numGlyphs;
1000 if (
face->os2.version != 0xFFFFU &&
face->os2.fsSelection & 256 )
1002 if ( !ignore_typographic_family )
1003 GET_NAME( TYPOGRAPHIC_FAMILY, &
face->root.family_name );
1004 if ( !
face->root.family_name )
1007 if ( !ignore_typographic_subfamily )
1008 GET_NAME( TYPOGRAPHIC_SUBFAMILY, &
face->root.style_name );
1009 if ( !
face->root.style_name )
1015 if ( !
face->root.family_name && !ignore_typographic_family )
1016 GET_NAME( TYPOGRAPHIC_FAMILY, &
face->root.family_name );
1017 if ( !
face->root.family_name )
1021 if ( !
face->root.style_name && !ignore_typographic_subfamily )
1022 GET_NAME( TYPOGRAPHIC_SUBFAMILY, &
face->root.style_name );
1023 if ( !
face->root.style_name )
1042 if ( has_outline ==
TRUE )
1050#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
1051 if ( !psnames_error &&
1052 face->postscript.FormatType != 0x00030000L )
1057 if (
face->postscript.isFixedPitch )
1061 if (
face->vertical_info )
1068#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
1089 if ( has_outline ==
TRUE &&
face->os2.version != 0xFFFFU )
1095 if (
face->os2.fsSelection & 512 )
1097 else if (
face->os2.fsSelection & 1 )
1100 if (
face->os2.fsSelection & 32 )
1107 if (
face->header.Mac_Style & 1 )
1110 if (
face->header.Mac_Style & 2 )
1131#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
1136 for (
m = 0;
m <
root->num_charmaps;
m++ )
1144#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
1146 if ( charmap->
encoding == FT_ENCODING_UNICODE ||
1147 charmap->
encoding == FT_ENCODING_MS_SYMBOL )
1160 cmaprec.
encoding = FT_ENCODING_UNICODE;
1176#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
1197 FT_UInt strike_idx, bsize_idx;
1200 if ( em_size == 0 ||
face->os2.version == 0xFFFFU )
1214 for ( strike_idx = 0; strike_idx <
count; strike_idx++ )
1225 ( avgwidth *
metrics.x_ppem + em_size / 2 ) / em_size );
1235 sbit_strike_map[bsize_idx++] = strike_idx;
1245 face->sbit_strike_map = sbit_strike_map;
1269 root->bbox.xMin =
face->header.xMin;
1270 root->bbox.yMin =
face->header.yMin;
1271 root->bbox.xMax =
face->header.xMax;
1272 root->bbox.yMax =
face->header.yMax;
1273 root->units_per_EM =
face->header.Units_Per_EM;
1312 if (
face->os2.version != 0xFFFFU &&
face->os2.fsSelection & 128 )
1314 root->ascender =
face->os2.sTypoAscender;
1315 root->descender =
face->os2.sTypoDescender;
1317 face->os2.sTypoLineGap;
1321 root->ascender =
face->horizontal.Ascender;
1322 root->descender =
face->horizontal.Descender;
1324 face->horizontal.Line_Gap;
1326 if ( !(
root->ascender ||
root->descender ) )
1328 if (
face->os2.version != 0xFFFFU )
1330 if (
face->os2.sTypoAscender ||
face->os2.sTypoDescender )
1332 root->ascender =
face->os2.sTypoAscender;
1333 root->descender =
face->os2.sTypoDescender;
1335 face->os2.sTypoLineGap;
1347 root->max_advance_width =
1349 root->max_advance_height =
1356 root->underline_position =
face->postscript.underlinePosition -
1357 face->postscript.underlineThickness / 2;
1358 root->underline_thickness =
face->postscript.underlineThickness;
1364 FT_TRACE2((
"sfnt_load_face: done\n" ));
1406#ifdef TT_CONFIG_OPTION_BDF
1408 tt_face_free_bdf_props(
face );
1416 face->ttc_header.count = 0;
1420 face->num_tables = 0;
1428 face->cmap_size = 0;
1431 face->horz_metrics_size = 0;
1432 face->vert_metrics_size = 0;
1435 if (
face->vertical_info )
1439 face->vertical_info = 0;
1444 face->gasp.numRanges = 0;
1457 face->root.num_fixed_sizes = 0;
1461#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
1468 FT_FREE(
face->palette_data.palette_entry_name_ids );
struct outqueuenode * head
static const WCHAR version[]
#define TT_MS_ID_UNICODE_CS
#define TT_PLATFORM_MICROSOFT
#define TT_PLATFORM_MACINTOSH
#define TT_MS_ID_SYMBOL_CS
#define TT_PLATFORM_APPLE_UNICODE
#define FT_FACE_FLAG_KERNING
#define FT_FACE_FLAG_SFNT
#define FT_STYLE_FLAG_ITALIC
#define FT_FACE_FLAG_FIXED_SIZES
#define FT_FACE_FLAG_SCALABLE
#define FT_FACE_FLAG_FIXED_WIDTH
#define FT_HAS_FIXED_SIZES(face)
#define FT_IS_SCALABLE(face)
#define FT_FACE_FLAG_VERTICAL
#define FT_FACE_FLAG_GLYPH_NAMES
enum FT_Encoding_ FT_Encoding
#define FT_FACE_FLAG_COLOR
#define FT_FACE_FLAG_MULTIPLE_MASTERS
#define FT_STYLE_FLAG_BOLD
#define FT_FACE_FLAG_HORIZONTAL
#define FT_ASSERT(condition)
#define FT_ERROR(varformat)
#define FT_TRACE3(varformat)
#define FT_TRACE2(varformat)
#define FT_NEW_ARRAY(ptr, count)
#define FT_ALLOC(ptr, size)
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
#define FT_QNEW_ARRAY(ptr, count)
FT_Get_Module(FT_Library library, const char *module_name)
ft_module_get_service(FT_Module module, const char *service_id, FT_Bool global)
#define FT_FACE_STREAM(x)
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
#define FT_FACE_FIND_GLOBAL_SERVICE(face, ptr, id)
#define FT_FRAME_ENTER(size)
#define FT_READ_USHORT(var)
#define FT_FRAME_RELEASE(bytes)
#define FT_STREAM_SEEK(position)
#define FT_READ_ULONG(var)
#define FT_NEXT_USHORT(buffer)
#define FT_STREAM_READ_FIELDS(fields, object)
#define FT_STREAM_SKIP(distance)
#define FT_STREAM_READ_AT(position, buffer, count)
#define FT_STREAM_READ(buffer, count)
#define FT_FRAME_START(size)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLuint GLuint GLsizei count
GLenum GLuint GLint GLenum face
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
GLenum const GLfloat * params
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
static char memory[1024 *256]
SFNT_Interface * SFNT_Service
#define LOADM_(x, vertical)
FT_String *(* TT_Name_ConvertFunc)(TT_Name entry, FT_Memory memory)
#define GET_NAME(id, field)
tt_face_get_name(TT_Face face, FT_UShort nameid, FT_String **name)
static FT_String * tt_name_ascii_from_utf16(TT_Name entry, FT_Memory memory)
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)
static FT_Error sfnt_open_font(FT_Stream stream, TT_Face face, FT_Int *face_instance_index, FT_Long *woff2_num_faces)
sfnt_done_face(TT_Face face)
static FT_Encoding sfnt_find_encoding(int platform_id, int encoding_id)
static FT_String * tt_name_ascii_from_other(TT_Name entry, FT_Memory memory)
woff2_open_font(FT_Stream stream, TT_Face face, FT_Int *face_instance_index, FT_Long *num_faces)
woff_open_font(FT_Stream stream, TT_Face face)
TT_Free_Table_Func free_eblc
TT_Free_Table_Func free_name
TT_Load_Strike_Metrics_Func load_strike_metrics
TT_Load_Table_Func load_eblc
TT_Free_Table_Func free_cpal
TT_Load_Table_Func load_font_dir
TT_Free_Table_Func free_psnames
TT_Load_Table_Func load_bhed
TT_Free_Table_Func free_colr
TT_Loader_GotoTableFunc goto_table
TT_Load_Table_Func load_cpal
#define FT_SERVICE_ID_METRICS_VARIATIONS
#define FT_SERVICE_ID_MULTI_MASTERS
tt_face_build_cmaps(TT_Face face)
FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec
tt_face_done_kern(TT_Face face)
#define TT_FACE_HAS_KERNING(face)
tt_face_lookup_table(TT_Face face, FT_ULong tag)
#define TT_MAC_LANGID_ENGLISH
@ TT_SBIT_TABLE_TYPE_CBLC
@ TT_SBIT_TABLE_TYPE_SBIX
#define TT_FACE_FLAG_VAR_FVAR