summaryrefslogtreecommitdiffstats
path: root/src/truetype/ttobjs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/truetype/ttobjs.c')
-rw-r--r--src/truetype/ttobjs.c201
1 files changed, 89 insertions, 112 deletions
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 05a121c..202aa04 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
/* */
/* Objects manager (body). */
/* */
-/* Copyright 1996-2013 */
+/* Copyright 1996-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -256,89 +256,89 @@
#define TRICK_SFNT_ID_prep 2
{ /* MingLiU 1995 */
- { 0x05bcf058, 0x000002e4 }, /* cvt */
- { 0x28233bf1, 0x000087c4 }, /* fpgm */
- { 0xa344a1ea, 0x000001e1 } /* prep */
+ { 0x05BCF058UL, 0x000002E4UL }, /* cvt */
+ { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
+ { 0xA344A1EAUL, 0x000001E1UL } /* prep */
},
{ /* MingLiU 1996- */
- { 0x05bcf058, 0x000002e4 }, /* cvt */
- { 0x28233bf1, 0x000087c4 }, /* fpgm */
- { 0xa344a1eb, 0x000001e1 } /* prep */
+ { 0x05BCF058UL, 0x000002E4UL }, /* cvt */
+ { 0x28233BF1UL, 0x000087C4UL }, /* fpgm */
+ { 0xA344A1EBUL, 0x000001E1UL } /* prep */
},
{ /* DFKaiShu */
- { 0x11e5ead4, 0x00000350 }, /* cvt */
- { 0x5a30ca3b, 0x00009063 }, /* fpgm */
- { 0x13a42602, 0x0000007e } /* prep */
+ { 0x11E5EAD4UL, 0x00000350UL }, /* cvt */
+ { 0x5A30CA3BUL, 0x00009063UL }, /* fpgm */
+ { 0x13A42602UL, 0x0000007EUL } /* prep */
},
{ /* HuaTianKaiTi */
- { 0xfffbfffc, 0x00000008 }, /* cvt */
- { 0x9c9e48b8, 0x0000bea2 }, /* fpgm */
- { 0x70020112, 0x00000008 } /* prep */
+ { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
+ { 0x9C9E48B8UL, 0x0000BEA2UL }, /* fpgm */
+ { 0x70020112UL, 0x00000008UL } /* prep */
},
{ /* HuaTianSongTi */
- { 0xfffbfffc, 0x00000008 }, /* cvt */
- { 0x0a5a0483, 0x00017c39 }, /* fpgm */
- { 0x70020112, 0x00000008 } /* prep */
+ { 0xFFFBFFFCUL, 0x00000008UL }, /* cvt */
+ { 0x0A5A0483UL, 0x00017C39UL }, /* fpgm */
+ { 0x70020112UL, 0x00000008UL } /* prep */
},
{ /* NEC fadpop7.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x40c92555, 0x000000e5 }, /* fpgm */
- { 0xa39b58e3, 0x0000117c } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x40C92555UL, 0x000000E5UL }, /* fpgm */
+ { 0xA39B58E3UL, 0x0000117CUL } /* prep */
},
{ /* NEC fadrei5.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x33c41652, 0x000000e5 }, /* fpgm */
- { 0x26d6c52a, 0x00000f6a } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x33C41652UL, 0x000000E5UL }, /* fpgm */
+ { 0x26D6C52AUL, 0x00000F6AUL } /* prep */
},
{ /* NEC fangot7.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x6db1651d, 0x0000019d }, /* fpgm */
- { 0x6c6e4b03, 0x00002492 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x6DB1651DUL, 0x0000019DUL }, /* fpgm */
+ { 0x6C6E4B03UL, 0x00002492UL } /* prep */
},
{ /* NEC fangyo5.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x40c92555, 0x000000e5 }, /* fpgm */
- { 0xde51fad0, 0x0000117c } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x40C92555UL, 0x000000E5UL }, /* fpgm */
+ { 0xDE51FAD0UL, 0x0000117CUL } /* prep */
},
{ /* NEC fankyo5.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x85e47664, 0x000000e5 }, /* fpgm */
- { 0xa6c62831, 0x00001caa } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x85E47664UL, 0x000000E5UL }, /* fpgm */
+ { 0xA6C62831UL, 0x00001CAAUL } /* prep */
},
{ /* NEC fanrgo5.ttf */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x2d891cfd, 0x0000019d }, /* fpgm */
- { 0xa0604633, 0x00001de8 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x2D891CFDUL, 0x0000019DUL }, /* fpgm */
+ { 0xA0604633UL, 0x00001DE8UL } /* prep */
},
{ /* NEC fangot5.ttc */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x40aa774c, 0x000001cb }, /* fpgm */
- { 0x9b5caa96, 0x00001f9a } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x40AA774CUL, 0x000001CBUL }, /* fpgm */
+ { 0x9B5CAA96UL, 0x00001F9AUL } /* prep */
},
{ /* NEC fanmin3.ttc */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x0d3de9cb, 0x00000141 }, /* fpgm */
- { 0xd4127766, 0x00002280 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x0D3DE9CBUL, 0x00000141UL }, /* fpgm */
+ { 0xD4127766UL, 0x00002280UL } /* prep */
},
{ /* NEC FA-Gothic, 1996 */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x4a692698, 0x000001f0 }, /* fpgm */
- { 0x340d4346, 0x00001fca } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x4A692698UL, 0x000001F0UL }, /* fpgm */
+ { 0x340D4346UL, 0x00001FCAUL } /* prep */
},
{ /* NEC FA-Minchou, 1996 */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0xcd34c604, 0x00000166 }, /* fpgm */
- { 0x6cf31046, 0x000022b0 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0xCD34C604UL, 0x00000166UL }, /* fpgm */
+ { 0x6CF31046UL, 0x000022B0UL } /* prep */
},
{ /* NEC FA-RoundGothicB, 1996 */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0x5da75315, 0x0000019d }, /* fpgm */
- { 0x40745a5f, 0x000022e0 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0x5DA75315UL, 0x0000019DUL }, /* fpgm */
+ { 0x40745A5FUL, 0x000022E0UL } /* prep */
},
{ /* NEC FA-RoundGothicM, 1996 */
- { 0x00000000, 0x00000000 }, /* cvt */
- { 0xf055fc48, 0x000001c2 }, /* fpgm */
- { 0x3900ded3, 0x00001e18 } /* prep */
+ { 0x00000000UL, 0x00000000UL }, /* cvt */
+ { 0xF055FC48UL, 0x000001C2UL }, /* fpgm */
+ { 0x3900DED3UL, 0x00001E18UL } /* prep */
}
};
@@ -751,16 +751,11 @@
FT_Error error;
- /* debugging instances have their own context */
- if ( size->debug )
- exec = size->context;
- else
- exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
-
- if ( !exec )
- return FT_THROW( Could_Not_Find_Context );
+ exec = size->context;
- TT_Load_Context( exec, face, size );
+ error = TT_Load_Context( exec, face, size );
+ if ( error )
+ return error;
exec->callTop = 0;
exec->top = 0;
@@ -793,7 +788,7 @@
TT_Set_CodeRange( exec,
tt_coderange_font,
face->font_program,
- face->font_program_size );
+ (FT_Long)face->font_program_size );
/* disable CVT and glyph programs coderange */
TT_Clear_CodeRange( exec, tt_coderange_cvt );
@@ -801,14 +796,10 @@
if ( face->font_program_size > 0 )
{
- error = TT_Goto_CodeRange( exec, tt_coderange_font, 0 );
+ TT_Goto_CodeRange( exec, tt_coderange_font, 0 );
- if ( !error )
- {
- FT_TRACE4(( "Executing `fpgm' table.\n" ));
-
- error = face->interpreter( exec );
- }
+ FT_TRACE4(( "Executing `fpgm' table.\n" ));
+ error = face->interpreter( exec );
}
else
error = FT_Err_Ok;
@@ -847,16 +838,11 @@
FT_Error error;
- /* debugging instances have their own context */
- if ( size->debug )
- exec = size->context;
- else
- exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
-
- if ( !exec )
- return FT_THROW( Could_Not_Find_Context );
+ exec = size->context;
- TT_Load_Context( exec, face, size );
+ error = TT_Load_Context( exec, face, size );
+ if ( error )
+ return error;
exec->callTop = 0;
exec->top = 0;
@@ -868,20 +854,17 @@
TT_Set_CodeRange( exec,
tt_coderange_cvt,
face->cvt_program,
- face->cvt_program_size );
+ (FT_Long)face->cvt_program_size );
TT_Clear_CodeRange( exec, tt_coderange_glyph );
if ( face->cvt_program_size > 0 )
{
- error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
+ TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
- if ( !error && !size->debug )
- {
- FT_TRACE4(( "Executing `prep' table.\n" ));
+ FT_TRACE4(( "Executing `prep' table.\n" ));
- error = face->interpreter( exec );
- }
+ error = face->interpreter( exec );
}
else
error = FT_Err_Ok;
@@ -924,12 +907,10 @@
TT_Face face = (TT_Face)ftsize->face;
FT_Memory memory = face->root.memory;
-
- if ( size->debug )
+ if ( size->context )
{
- /* the debug context must be deleted by the debugger itself */
+ TT_Done_Context( size->context );
size->context = NULL;
- size->debug = FALSE;
}
FT_FREE( size->cvt );
@@ -968,15 +949,26 @@
TT_Size size = (TT_Size)ftsize;
TT_Face face = (TT_Face)ftsize->face;
FT_Memory memory = face->root.memory;
- FT_Int i;
FT_UShort n_twilight;
TT_MaxProfile* maxp = &face->max_profile;
+ /* clean up bytecode related data */
+ FT_FREE( size->function_defs );
+ FT_FREE( size->instruction_defs );
+ FT_FREE( size->cvt );
+ FT_FREE( size->storage );
+
+ if ( size->context )
+ TT_Done_Context( size->context );
+ tt_glyphzone_done( &size->twilight );
+
size->bytecode_ready = -1;
size->cvt_ready = -1;
+ size->context = TT_New_Context( (TT_Driver)face->root.driver );
+
size->max_function_defs = maxp->maxFunctionDefs;
size->max_instruction_defs = maxp->maxInstructionDefs;
@@ -997,9 +989,11 @@
metrics->rotated = FALSE;
metrics->stretched = FALSE;
- /* set default compensation (all 0) */
- for ( i = 0; i < 4; i++ )
- metrics->compensations[i] = 0;
+ /* set default engine compensation */
+ metrics->compensations[0] = 0; /* gray */
+ metrics->compensations[1] = 0; /* black */
+ metrics->compensations[2] = 0; /* white */
+ metrics->compensations[3] = 0; /* reserved */
}
/* allocate function defs, instruction defs, cvt, and storage area */
@@ -1115,6 +1109,7 @@
TT_Size size = (TT_Size)ttsize;
FT_Error error = FT_Err_Ok;
+
#ifdef TT_USE_BYTECODE_INTERPRETER
size->bytecode_ready = -1;
size->cvt_ready = -1;
@@ -1145,8 +1140,7 @@
#ifdef TT_USE_BYTECODE_INTERPRETER
- if ( size->bytecode_ready >= 0 )
- tt_size_done_bytecode( ttsize );
+ tt_size_done_bytecode( ttsize );
#endif
size->ttmetrics.valid = FALSE;
@@ -1258,10 +1252,6 @@
TT_Driver driver = (TT_Driver)ttdriver;
-
- if ( !TT_New_Context( driver ) )
- return FT_THROW( Could_Not_Find_Context );
-
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
driver->interpreter_version = TT_INTERPRETER_VERSION_38;
#else
@@ -1292,20 +1282,7 @@
FT_LOCAL_DEF( void )
tt_driver_done( FT_Module ttdriver ) /* TT_Driver */
{
-#ifdef TT_USE_BYTECODE_INTERPRETER
- TT_Driver driver = (TT_Driver)ttdriver;
-
-
- /* destroy the execution context */
- if ( driver->context )
- {
- TT_Done_Context( driver->context );
- driver->context = NULL;
- }
-#else
FT_UNUSED( ttdriver );
-#endif
-
}