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 132 tt_glyphzone_done( zone );
152 #define TRICK_NAMES_MAX_CHARACTERS 16 153 #define TRICK_NAMES_COUNT 8 172 if (
ft_strstr( name, trick_names[nn] ) )
198 for ( ; length > 3; length -= 4 )
201 for ( i = 3; length > 0; length --, i-- )
235 typedef struct tt_sfnt_id_rec_
244 tt_check_trickyness_sfnt_ids(
TT_Face face )
246 #define TRICK_SFNT_IDS_PER_FACE 3 247 #define TRICK_SFNT_IDS_NUM_FACES 17 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 }
322 { 0x00000000, 0x00000000 },
323 { 0x4a692698, 0x000001f0 },
324 { 0x340d4346, 0x00001fca }
327 { 0x00000000, 0x00000000 },
328 { 0xcd34c604, 0x00000166 },
329 { 0x6cf31046, 0x000022b0 }
332 { 0x00000000, 0x00000000 },
333 { 0x5da75315, 0x0000019d },
334 { 0x40745a5f, 0x000022e0 }
337 { 0x00000000, 0x00000000 },
338 { 0xf055fc48, 0x000001c2 },
339 { 0x3900ded3, 0x00001e18 }
345 FT_Bool has_cvt, has_fpgm, has_prep;
385 checksum = tt_get_sfnt_checksum( face, i );
387 if ( sfnt_id[j][k].CheckSum == checksum )
388 num_matched_ids[j]++;
398 num_matched_ids[j] ++;
400 num_matched_ids[j] ++;
402 num_matched_ids[j] ++;
412 tt_check_trickyness(
FT_Face face )
425 if ( tt_check_trickyness_sfnt_ids( (
TT_Face)face ) )
434 tt_check_single_notdef(
FT_Face ttface )
460 if ( glyph_index == 0 )
471 buf[0] ==
'.' && !
ft_strncmp( buf,
".notdef", 8 ) )
523 FT_ERROR((
"tt_face_init: cannot access `sfnt' module\n" ));
548 #ifdef TT_USE_BYTECODE_INTERPRETER 553 if ( face_index < 0 )
561 if ( tt_check_trickyness( ttface ) )
571 #ifdef FT_CONFIG_OPTION_INCREMENTAL 573 if ( !ttface->
internal->incremental_interface )
583 if ( !ttface->
internal->incremental_interface &&
586 tt_check_single_notdef( ttface ) )
589 " Only the `.notdef' glyph has an outline.\n" 591 " Resetting scalable flag to FALSE.\n" ));
610 tt_check_single_notdef( ttface ) )
613 " Only the `.notdef' glyph has an outline.\n" 615 " Resetting scalable flag to FALSE.\n" ));
624 #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \ 625 !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER ) 636 for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )
638 unpatented_hinting =
TRUE;
640 if ( !unpatented_hinting )
708 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT 721 #ifdef TT_USE_BYTECODE_INTERPRETER 750 exec = size->context;
755 return FT_THROW( Could_Not_Find_Context );
757 TT_Load_Context( exec, face, size );
766 exec->instruction_trap =
FALSE;
767 exec->F_dot_P = 0x4000L;
769 exec->pedantic_hinting = pedantic;
781 tt_metrics->
ppem = 0;
782 tt_metrics->
scale = 0;
783 tt_metrics->
ratio = 0x10000L;
787 TT_Set_CodeRange( exec,
802 FT_TRACE4((
"Executing `fpgm' table.\n" ));
811 TT_Save_Context( exec, size );
834 tt_size_run_prep(
TT_Size size,
844 exec = size->context;
849 return FT_THROW( Could_Not_Find_Context );
851 TT_Load_Context( exec, face, size );
856 exec->instruction_trap =
FALSE;
858 exec->pedantic_hinting = pedantic;
860 TT_Set_CodeRange( exec,
871 if ( !
error && !size->debug )
873 FT_TRACE4((
"Executing `prep' table.\n" ));
884 exec->GS.dualVector.x = 0x4000;
885 exec->GS.dualVector.y = 0;
886 exec->GS.projVector.x = 0x4000;
887 exec->GS.projVector.y = 0x0;
888 exec->GS.freeVector.x = 0x4000;
889 exec->GS.freeVector.y = 0x0;
904 TT_Save_Context( exec, size );
912 #ifdef TT_USE_BYTECODE_INTERPRETER 915 tt_size_done_bytecode(
FT_Size ftsize )
925 size->context =
NULL;
934 size->storage_size = 0;
937 tt_glyphzone_done( &size->twilight );
939 FT_FREE( size->function_defs );
940 FT_FREE( size->instruction_defs );
942 size->num_function_defs = 0;
943 size->max_function_defs = 0;
944 size->num_instruction_defs = 0;
945 size->max_instruction_defs = 0;
950 size->bytecode_ready = 0;
958 tt_size_init_bytecode(
FT_Size ftsize,
971 size->bytecode_ready = 1;
974 size->max_function_defs = maxp->maxFunctionDefs;
975 size->max_instruction_defs = maxp->maxInstructionDefs;
977 size->num_function_defs = 0;
978 size->num_instruction_defs = 0;
984 size->storage_size = maxp->maxStorage;
1000 if (
FT_NEW_ARRAY( size->function_defs, size->max_function_defs ) ||
1001 FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||
1007 n_twilight = maxp->maxTwilightPoints;
1012 error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );
1016 size->twilight.n_points = n_twilight;
1032 error = tt_size_run_fpgm( size, pedantic );
1036 tt_size_done_bytecode( ftsize );
1043 tt_size_ready_bytecode(
TT_Size size,
1049 if ( !size->bytecode_ready )
1051 error = tt_size_init_bytecode( (
FT_Size)size, pedantic );
1057 if ( !size->cvt_ready )
1065 for ( i = 0; i < size->cvt_size; i++ )
1069 for ( i = 0; i < (
FT_UInt)size->twilight.n_points; i++ )
1071 size->twilight.org[
i].x = 0;
1072 size->twilight.org[
i].y = 0;
1073 size->twilight.cur[
i].x = 0;
1074 size->twilight.cur[
i].y = 0;
1078 for ( i = 0; i < (
FT_UInt)size->storage_size; i++ )
1079 size->storage[
i] = 0;
1083 error = tt_size_run_prep( size, pedantic );
1085 size->cvt_ready = 1;
1115 #ifdef TT_USE_BYTECODE_INTERPRETER 1116 size->bytecode_ready = 0;
1117 size->cvt_ready = 0;
1144 #ifdef TT_USE_BYTECODE_INTERPRETER 1145 if ( size->bytecode_ready )
1146 tt_size_done_bytecode( ttsize );
1189 if ( face->
header.Flags & 8 )
1225 #ifdef TT_USE_BYTECODE_INTERPRETER 1226 size->cvt_ready = 0;
1254 #ifdef TT_USE_BYTECODE_INTERPRETER 1260 return FT_THROW( Could_Not_Find_Context );
1286 #ifdef TT_USE_BYTECODE_INTERPRETER 1293 TT_Done_Context(
driver->context );
GLenum GLuint GLenum GLsizei length
const TT_GraphicsState tt_default_graphics_state
#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)
for(n=1;n< outline->n_points;n++)
SFNT_Interface * SFNT_Service
tt_size_done(FT_Size ttsize)
FT_Generic_Finalizer finalizer
#define FT_MEM_ZERO(dest, count)
#define FT_FACE_FLAG_SCALABLE
return FT_THROW(Missing_Property)
tt_face_load_loca(TT_Face face, FT_Stream stream)
tt_slot_init(FT_GlyphSlot slot)
TT_Init_Glyph_Loading(TT_Face face)
FT_Bool ignore_unpatented_hinter
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
FT_Face_Internal internal
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
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLint GLenum face
TT_Done_Face_Func done_face
tt_face_free_hdmx(TT_Face face)
#define FT_ERROR(varformat)
#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
#define FT_DEBUG_HOOK_UNPATENTED_HINTING
tt_driver_done(FT_Module ttdriver)
FT_Error(* TT_Interpreter)(void *exec_context)
#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
FT_DebugHook_Func debug_hooks[4]
TT_Load_Face_Func load_face
#define TRICK_NAMES_COUNT
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)
GLuint const GLchar * name
FT_MulFix(FT_Long a, FT_Long b)
#define FT_FRAME_RELEASE(bytes)
if(!abbox) return FT_THROW(Invalid_Argument)
GLenum const GLfloat * params
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
GLuint GLuint GLsizei count
#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
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
#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)
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)