20 #include FT_INTERNAL_DEBUG_H
21 #include FT_INTERNAL_STREAM_H
22 #include FT_TRUETYPE_TAGS_H
23 #include FT_INTERNAL_SFNT_H
30 #ifdef TT_USE_BYTECODE_INTERPRETER
34 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
35 #include FT_TRUETYPE_UNPATENTED_H
38 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
49 #define FT_COMPONENT trace_ttobjs
52 #ifdef TT_USE_BYTECODE_INTERPRETER
86 zone->max_points = zone->n_points = 0;
87 zone->max_contours = zone->n_contours = 0;
124 zone->memory = memory;
132 tt_glyphzone_done( zone );
136 zone->max_points = maxPoints;
137 zone->max_contours = maxContours;
152 #define TRICK_NAMES_MAX_CHARACTERS 16
153 #define TRICK_NAMES_COUNT 8
172 if (
ft_strstr( name, trick_names[nn] ) )
191 FT_UInt32 checksum = 0;
198 for ( ; length > 3; length -= 4 )
201 for ( i = 3; length > 0; length --, i-- )
202 checksum += (FT_UInt32)(
FT_GET_BYTE() << ( i * 8 ) );
235 typedef struct tt_sfnt_id_rec_
246 #define TRICK_SFNT_IDS_PER_FACE 3
247 #define TRICK_SFNT_IDS_NUM_FACES 13
252 #define TRICK_SFNT_ID_cvt 0
253 #define TRICK_SFNT_ID_fpgm 1
254 #define TRICK_SFNT_ID_prep 2
257 { 0x05bcf058, 0x000002e4 },
258 { 0x28233bf1, 0x000087c4 },
259 { 0xa344a1ea, 0x000001e1 }
262 { 0x05bcf058, 0x000002e4 },
263 { 0x28233bf1, 0x000087c4 },
264 { 0xa344a1eb, 0x000001e1 }
267 { 0x11e5ead4, 0x00000350 },
268 { 0x5a30ca3b, 0x00009063 },
269 { 0x13a42602, 0x0000007e }
272 { 0xfffbfffc, 0x00000008 },
273 { 0x9c9e48b8, 0x0000bea2 },
274 { 0x70020112, 0x00000008 }
277 { 0xfffbfffc, 0x00000008 },
278 { 0x0a5a0483, 0x00017c39 },
279 { 0x70020112, 0x00000008 }
282 { 0x00000000, 0x00000000 },
283 { 0x40c92555, 0x000000e5 },
284 { 0xa39b58e3, 0x0000117c }
287 { 0x00000000, 0x00000000 },
288 { 0x33c41652, 0x000000e5 },
289 { 0x26d6c52a, 0x00000f6a }
292 { 0x00000000, 0x00000000 },
293 { 0x6db1651d, 0x0000019d },
294 { 0x6c6e4b03, 0x00002492 }
297 { 0x00000000, 0x00000000 },
298 { 0x40c92555, 0x000000e5 },
299 { 0xde51fad0, 0x0000117c }
302 { 0x00000000, 0x00000000 },
303 { 0x85e47664, 0x000000e5 },
304 { 0xa6c62831, 0x00001caa }
307 { 0x00000000, 0x00000000 },
308 { 0x2d891cfd, 0x0000019d },
309 { 0xa0604633, 0x00001de8 }
312 { 0x00000000, 0x00000000 },
313 { 0x40aa774c, 0x000001cb },
314 { 0x9b5caa96, 0x00001f9a }
317 { 0x00000000, 0x00000000 },
318 { 0x0d3de9cb, 0x00000141 },
319 { 0xd4127766, 0x00002280 }
325 FT_Bool has_cvt, has_fpgm, has_prep;
367 if ( sfnt_id[j][k].CheckSum == checksum )
368 num_matched_ids[
j]++;
378 num_matched_ids[
j] ++;
380 num_matched_ids[
j] ++;
382 num_matched_ids[
j] ++;
440 if ( glyph_index == 0 )
451 buf[0] ==
'.' && !
ft_strncmp( buf,
".notdef", 8 ) )
498 library = ttface->driver->root.library;
503 FT_ERROR((
"tt_face_init: cannot access `sfnt' module\n" ));
504 error = TT_Err_Missing_Module;
513 error = sfnt->
init_face( stream, face, face_index, num_params, params );
528 #ifdef TT_USE_BYTECODE_INTERPRETER
533 if ( face_index < 0 )
537 error = sfnt->
load_face( stream, face, face_index, num_params, params );
551 #ifdef FT_CONFIG_OPTION_INCREMENTAL
553 if ( !ttface->internal->incremental_interface )
563 if ( !ttface->internal->incremental_interface &&
564 ttface->num_fixed_sizes &&
569 " Only the `.notdef' glyph has an outline.\n"
571 " Resetting scalable flag to FALSE.\n" ));
588 if ( ttface->num_fixed_sizes &&
593 " Only the `.notdef' glyph has an outline.\n"
595 " Resetting scalable flag to FALSE.\n" ));
604 #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
605 !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
616 for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )
618 unpatented_hinting =
TRUE;
620 if ( !unpatented_hinting )
621 ttface->internal->ignore_unpatented_hinter =
TRUE;
634 error = TT_Err_Unknown_File_Format;
662 memory = ttface->memory;
663 stream = ttface->stream;
688 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
701 #ifdef TT_USE_BYTECODE_INTERPRETER
730 exec = size->context;
735 return TT_Err_Could_Not_Find_Context;
746 exec->instruction_trap =
FALSE;
747 exec->F_dot_P = 0x10000L;
749 exec->pedantic_hinting = pedantic;
761 tt_metrics->
ppem = 0;
762 tt_metrics->
scale = 0;
763 tt_metrics->
ratio = 0x10000L;
782 FT_TRACE4((
"Executing `fpgm' table.\n" ));
814 tt_size_run_prep(
TT_Size size,
824 exec = size->context;
829 return TT_Err_Could_Not_Find_Context;
836 exec->instruction_trap =
FALSE;
838 exec->pedantic_hinting = pedantic;
851 if ( !error && !size->debug )
853 FT_TRACE4((
"Executing `prep' table.\n" ));
872 #ifdef TT_USE_BYTECODE_INTERPRETER
875 tt_size_done_bytecode(
FT_Size ftsize )
885 size->context =
NULL;
894 size->storage_size = 0;
897 tt_glyphzone_done( &size->twilight );
899 FT_FREE( size->function_defs );
900 FT_FREE( size->instruction_defs );
902 size->num_function_defs = 0;
903 size->max_function_defs = 0;
904 size->num_instruction_defs = 0;
905 size->max_instruction_defs = 0;
910 size->bytecode_ready = 0;
918 tt_size_init_bytecode(
FT_Size ftsize,
931 size->bytecode_ready = 1;
934 size->max_function_defs = maxp->maxFunctionDefs;
935 size->max_instruction_defs = maxp->maxInstructionDefs;
937 size->num_function_defs = 0;
938 size->num_instruction_defs = 0;
944 size->storage_size = maxp->maxStorage;
960 if (
FT_NEW_ARRAY( size->function_defs, size->max_function_defs ) ||
961 FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||
967 n_twilight = maxp->maxTwilightPoints;
972 error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );
976 size->twilight.n_points = n_twilight;
992 error = tt_size_run_fpgm( size, pedantic );
996 tt_size_done_bytecode( ftsize );
1003 tt_size_ready_bytecode(
TT_Size size,
1009 if ( !size->bytecode_ready )
1011 error = tt_size_init_bytecode( (
FT_Size)size, pedantic );
1017 if ( !size->cvt_ready )
1025 for ( i = 0; i < size->cvt_size; i++ )
1026 size->cvt[i] =
FT_MulFix( face->
cvt[i], size->ttmetrics.scale );
1029 for ( i = 0; i < (
FT_UInt)size->twilight.n_points; i++ )
1031 size->twilight.org[
i].x = 0;
1032 size->twilight.org[
i].y = 0;
1033 size->twilight.cur[
i].x = 0;
1034 size->twilight.cur[
i].y = 0;
1038 for ( i = 0; i < (
FT_UInt)size->storage_size; i++ )
1039 size->storage[
i] = 0;
1043 error = tt_size_run_prep( size, pedantic );
1045 size->cvt_ready = 1;
1075 #ifdef TT_USE_BYTECODE_INTERPRETER
1076 size->bytecode_ready = 0;
1077 size->cvt_ready = 0;
1104 #ifdef TT_USE_BYTECODE_INTERPRETER
1105 if ( size->bytecode_ready )
1106 tt_size_done_bytecode( ttsize );
1133 size->ttmetrics.valid =
FALSE;
1137 metrics = &size->metrics;
1140 *metrics = size->root.metrics;
1143 return TT_Err_Invalid_PPem;
1149 if ( face->
header.Flags & 8 )
1170 size->ttmetrics.scale = metrics->
x_scale;
1171 size->ttmetrics.ppem = metrics->
x_ppem;
1172 size->ttmetrics.x_ratio = 0x10000L;
1179 size->ttmetrics.scale = metrics->
y_scale;
1180 size->ttmetrics.ppem = metrics->
y_ppem;
1184 size->ttmetrics.y_ratio = 0x10000L;
1187 #ifdef TT_USE_BYTECODE_INTERPRETER
1188 size->cvt_ready = 0;
1192 size->ttmetrics.valid =
TRUE;
1216 #ifdef TT_USE_BYTECODE_INTERPRETER
1222 return TT_Err_Could_Not_Find_Context;
1248 #ifdef TT_USE_BYTECODE_INTERPRETER
1253 if ( driver->context )
1256 driver->context =
NULL;
const TT_GraphicsState tt_default_graphics_state
static FT_ULong tt_get_sfnt_checksum(TT_Face face, FT_UShort i)
#define TRICK_SFNT_IDS_NUM_FACES
#define TRICK_SFNT_ID_cvt
TT_Init_Face_Func init_face
FT_DivFix(FT_Long a, FT_Long b)
SFNT_Interface * SFNT_Service
static FT_Bool tt_check_single_notdef(FT_Face ttface)
tt_size_done(FT_Size ttsize)
FT_Generic_Finalizer finalizer
#define FT_MEM_ZERO(dest, count)
TT_Load_Context(TT_ExecContext exec, TT_Face face, TT_Size size)
#define FT_FACE_FLAG_SCALABLE
tt_face_load_loca(TT_Face face, FT_Stream stream)
GLuint GLsizei GLsizei GLfloat * metrics
tt_slot_init(FT_GlyphSlot slot)
TT_Init_Glyph_Loading(TT_Face face)
EGLImageKHR EGLint * name
tt_size_init(FT_Size ttsize)
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
TT_Interpreter interpreter
TT_Loader_GotoTableFunc goto_table
FT_ULong font_program_size
TT_New_Context(TT_Driver driver)
#define FT_FACE_DRIVER(x)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
TT_Goto_CodeRange(TT_ExecContext exec, FT_Int range, FT_Long IP)
tt_face_load_cvt(TT_Face face, FT_Stream stream)
FT_GlyphLoader_CreateExtra(FT_GlyphLoader loader)
tt_face_init(FT_Stream stream, FT_Face ttface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
#define FT_DEBUG_HOOK_TRUETYPE
TT_Done_Face_Func done_face
tt_face_free_hdmx(TT_Face face)
#define FT_ERROR(varformat)
TT_Clear_CodeRange(TT_ExecContext exec, FT_Int range)
#define FT_TRACE4(varformat)
tt_size_reset(TT_Size size)
tt_face_load_hdmx(TT_Face face, FT_Stream stream)
struct TT_FaceRec_ * TT_Face
tt_done_blend(FT_Memory memory, GX_Blend blend)
TT_MaxProfile max_profile
static FT_UInt32 tt_synth_sfnt_checksum(FT_Stream stream, FT_ULong length)
static FT_Bool tt_check_trickyness_sfnt_ids(TT_Face face)
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
#define FT_DEBUG_HOOK_UNPATENTED_HINTING
tt_driver_done(FT_Module ttdriver)
#define FT_TRACE2(varformat)
#define TRICK_SFNT_IDS_PER_FACE
struct tt_sfnt_id_rec_ tt_sfnt_id_rec
#define FT_PARAM_TAG_UNPATENTED_HINTING
TT_Size_Metrics ttmetrics
TT_Save_Context(TT_ExecContext exec, TT_Size ins)
FT_DebugHook_Func debug_hooks[4]
TT_Load_Face_Func load_face
#define TRICK_NAMES_COUNT
static FT_Bool tt_check_trickyness(FT_Face face)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
tt_face_done(FT_Face ttface)
FT_Byte * glyph_locations
#define FT_FACE_FLAG_HINTER
#define FT_NEW_ARRAY(ptr, count)
#define FT_STREAM_SEEK(position)
FT_MulFix(FT_Long a, FT_Long b)
#define FT_FRAME_RELEASE(bytes)
FT_Error(* TT_Interpreter)(void *exec_context)
GLenum GLuint GLsizei const GLchar * buf
static FT_Bool tt_check_trickyness_family(FT_String *name)
tt_face_load_prep(TT_Face face, FT_Stream stream)
tt_driver_init(FT_Module ttdriver)
#define FT_TRACE5(varformat)
#define FT_FACE_FLAG_TRICKY
TT_Done_Context(TT_ExecContext exec)
#define FT_FRAME_ENTER(size)
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
tt_face_load_fpgm(TT_Face face, FT_Stream stream)
#define TRICK_NAMES_MAX_CHARACTERS
FT_ULong cvt_program_size
#define TRICK_SFNT_ID_prep
#define FT_MEM_SET(dest, byte, count)
#define FT_IS_SCALABLE(face)
FT_Short max_advance_width
FT_Get_Glyph_Name(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
TT_Set_CodeRange(TT_ExecContext exec, FT_Int range, void *base, FT_Long length)
struct TT_SizeRec_ * TT_Size
tt_face_get_location(TT_Face face, FT_UInt gindex, FT_UInt *asize)
tt_face_done_loca(TT_Face face)
#define TRICK_SFNT_ID_fpgm
TT_RunIns(TT_ExecContext exec)