summaryrefslogtreecommitdiffstats
path: root/src/truetype
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2010-09-16 11:32:17 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-16 11:32:17 -0700
commitcb487e4c5295d0d9bb96ddd3a27372ffad41ae5b (patch)
tree2b4c5412391bf31f6a54b237ea83bfde05ec3802 /src/truetype
parentf2873c598230898219f9481ffb43edc5e4d3f806 (diff)
parentaacb8e1368a883fcbc9fe64fd0e460cef9c9b20c (diff)
downloadandroid_external_freetype-cb487e4c5295d0d9bb96ddd3a27372ffad41ae5b.tar.gz
android_external_freetype-cb487e4c5295d0d9bb96ddd3a27372ffad41ae5b.tar.bz2
android_external_freetype-cb487e4c5295d0d9bb96ddd3a27372ffad41ae5b.zip
am aacb8e13: upgrade freetype to 2.4.2.
Merge commit 'aacb8e1368a883fcbc9fe64fd0e460cef9c9b20c' * commit 'aacb8e1368a883fcbc9fe64fd0e460cef9c9b20c': upgrade freetype to 2.4.2.
Diffstat (limited to 'src/truetype')
-rw-r--r--src/truetype/ttgload.c109
-rw-r--r--src/truetype/ttgxvar.c12
-rw-r--r--src/truetype/ttinterp.c436
-rw-r--r--src/truetype/ttinterp.h12
-rw-r--r--src/truetype/ttpic.c14
5 files changed, 473 insertions, 110 deletions
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 57ea0ba..1b496c0 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -161,8 +161,31 @@
&top_bearing,
&advance_height );
+ loader->left_bearing = left_bearing;
+ loader->advance = advance_width;
+ loader->top_bearing = top_bearing;
+ loader->vadvance = advance_height;
+
+ if ( !loader->linear_def )
+ {
+ loader->linear_def = 1;
+ loader->linear = advance_width;
+ }
+ }
+
+
#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ static void
+ tt_get_metrics_incr_overrides( TT_Loader loader,
+ FT_UInt glyph_index )
+ {
+ TT_Face face = (TT_Face)loader->face;
+
+ FT_Short left_bearing = 0, top_bearing = 0;
+ FT_UShort advance_width = 0, advance_height = 0;
+
+
/* If this is an incrementally loaded font check whether there are */
/* overriding metrics for this glyph. */
if ( face->root.internal->incremental_interface &&
@@ -172,9 +195,9 @@
FT_Error error;
- metrics.bearing_x = left_bearing;
+ metrics.bearing_x = loader->left_bearing;
metrics.bearing_y = 0;
- metrics.advance = advance_width;
+ metrics.advance = loader->advance;
metrics.advance_v = 0;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
@@ -190,8 +213,8 @@
/* GWW: Do I do the same for vertical metrics? */
metrics.bearing_x = 0;
- metrics.bearing_y = top_bearing;
- metrics.advance = advance_height;
+ metrics.bearing_y = loader->top_bearing;
+ metrics.advance = loader->vadvance;
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
@@ -204,24 +227,24 @@
#endif /* 0 */
+ loader->left_bearing = left_bearing;
+ loader->advance = advance_width;
+ loader->top_bearing = top_bearing;
+ loader->vadvance = advance_height;
+
+ if ( !loader->linear_def )
+ {
+ loader->linear_def = 1;
+ loader->linear = advance_width;
+ }
}
Exit:
+ return;
+ }
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- loader->left_bearing = left_bearing;
- loader->advance = advance_width;
- loader->top_bearing = top_bearing;
- loader->vadvance = advance_height;
-
- if ( !loader->linear_def )
- {
- loader->linear_def = 1;
- loader->linear = advance_width;
- }
- }
-
/*************************************************************************/
/* */
@@ -271,7 +294,7 @@
FT_UNUSED( glyph_index );
- FT_TRACE5(( "Glyph %ld\n", glyph_index ));
+ FT_TRACE4(( "Glyph %ld\n", glyph_index ));
/* the following line sets the `error' variable through macros! */
if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( byte_count ) )
@@ -367,7 +390,7 @@
if ( cont[0] <= prev_cont )
{
/* unordered contours: this is invalid */
- error = FT_Err_Invalid_Table;
+ error = TT_Err_Invalid_Table;
goto Fail;
}
prev_cont = cont[0];
@@ -1118,7 +1141,8 @@
{
FT_Stream stream = loader->stream;
- FT_UShort n_ins;
+ FT_UShort n_ins, max_ins;
+ FT_ULong tmp;
/* TT_Load_Composite_Glyph only gives us the offset of instructions */
@@ -1130,12 +1154,27 @@
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
/* check it */
- if ( n_ins > ((TT_Face)loader->face)->max_profile.maxSizeOfInstructions )
+ max_ins = ((TT_Face)loader->face)->max_profile.maxSizeOfInstructions;
+ if ( n_ins > max_ins )
{
- FT_TRACE0(( "TT_Process_Composite_Glyph: too many instructions (%d)\n",
- n_ins ));
+ /* acroread ignores this field, so we only do a rough safety check */
+ if ( (FT_Int)n_ins > loader->byte_len )
+ {
+ FT_TRACE1(( "TT_Process_Composite_Glyph: "
+ "too many instructions (%d) for glyph with length %d\n",
+ n_ins, loader->byte_len ));
+ return TT_Err_Too_Many_Hints;
+ }
- return TT_Err_Too_Many_Hints;
+ tmp = loader->exec->glyphSize;
+ error = Update_Max( loader->exec->memory,
+ &tmp,
+ sizeof ( FT_Byte ),
+ (void*)&loader->exec->glyphIns,
+ n_ins );
+ loader->exec->glyphSize = (FT_UShort)tmp;
+ if ( error )
+ return error;
}
else if ( n_ins == 0 )
return TT_Err_Ok;
@@ -1316,8 +1355,14 @@
if ( header_only )
goto Exit;
+ /* must initialize points before (possibly) overriding */
+ /* glyph metrics from the incremental interface */
TT_LOADER_SET_PP( loader );
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ tt_get_metrics_incr_overrides( loader, glyph_index );
+#endif
+
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
if ( ((TT_Face)(loader->face))->doblend )
@@ -1353,8 +1398,14 @@
goto Exit;
}
+ /* must initialize points before (possibly) overriding */
+ /* glyph metrics from the incremental interface */
TT_LOADER_SET_PP( loader );
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ tt_get_metrics_incr_overrides( loader, glyph_index );
+#endif
+
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
@@ -1481,6 +1532,7 @@
FT_UInt num_base_subgs = gloader->base.num_subglyphs;
FT_Stream old_stream = loader->stream;
+ FT_Int old_byte_len = loader->byte_len;
FT_GlyphLoader_Add( gloader );
@@ -1535,7 +1587,8 @@
num_base_points );
}
- loader->stream = old_stream;
+ loader->stream = old_stream;
+ loader->byte_len = old_byte_len;
/* process the glyph */
loader->ins_pos = ins_pos;
@@ -2031,9 +2084,11 @@
glyph->outline = loader.gloader->base.outline;
glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS;
- /* In case bit 1 of the `flags' field in the `head' table isn't */
- /* set, translate array so that (0,0) is the glyph's origin. */
- if ( ( face->header.Flags & 2 ) == 0 && loader.pp1.x )
+ /* Translate array so that (0,0) is the glyph's origin. Note */
+ /* that this behaviour is independent on the value of bit 1 of */
+ /* the `flags' field in the `head' table -- at least major */
+ /* applications like Acroread indicate that. */
+ if ( loader.pp1.x )
FT_Outline_Translate( &glyph->outline, -loader.pp1.x, 0 );
}
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index ef25aaf..653d9d5 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
/* */
/* TrueType GX Font Variation loader */
/* */
-/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */
+/* Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -210,12 +210,12 @@
ft_var_readpackeddeltas( FT_Stream stream,
FT_Offset delta_cnt )
{
- FT_Short *deltas;
+ FT_Short *deltas = NULL;
FT_UInt runcnt;
FT_Offset i;
FT_UInt j;
FT_Memory memory = stream->memory;
- FT_Error error = TT_Err_Ok;
+ FT_Error error = TT_Err_Ok;
FT_UNUSED( error );
@@ -682,7 +682,11 @@
if ( fvar_head.version != (FT_Long)0x00010000L ||
fvar_head.countSizePairs != 2 ||
fvar_head.axisSize != 20 ||
+ /* axisCount limit implied by 16-bit instanceSize */
+ fvar_head.axisCount > 0x3FFE ||
fvar_head.instanceSize != 4 + 4 * fvar_head.axisCount ||
+ /* instanceCount limit implied by limited range of name IDs */
+ fvar_head.instanceCount > 0x7EFF ||
fvar_head.offsetToData + fvar_head.axisCount * 20U +
fvar_head.instanceCount * fvar_head.instanceSize > table_len )
{
@@ -693,7 +697,7 @@
if ( FT_NEW( face->blend ) )
goto Exit;
- /* XXX: TODO - check for overflows */
+ /* cannot overflow 32-bit arithmetic because of limits above */
face->blend->mmvar_len =
sizeof ( FT_MM_Var ) +
fvar_head.axisCount * sizeof ( FT_Var_Axis ) +
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 13aa9a2..d22e94f 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -4,8 +4,9 @@
/* */
/* TrueType bytecode interpreter (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
+/* 2010 */
+/* by David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -223,9 +224,10 @@
/*************************************************************************/
/* */
- /* A simple bounds-checking macro. */
+ /* Two simple bounds-checking macros. */
/* */
-#define BOUNDS( x, n ) ( (FT_UInt)(x) >= (FT_UInt)(n) )
+#define BOUNDS( x, n ) ( (FT_UInt)(x) >= (FT_UInt)(n) )
+#define BOUNDSL( x, n ) ( (FT_ULong)(x) >= (FT_ULong)(n) )
#undef SUCCESS
#define SUCCESS 0
@@ -508,7 +510,7 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
- static FT_Error
+ FT_LOCAL_DEF( FT_Error )
Update_Max( FT_Memory memory,
FT_ULong* size,
FT_Long multiplier,
@@ -1111,6 +1113,287 @@
};
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+ static
+ const char* const opcode_name[256] =
+ {
+ "SVTCA y",
+ "SVTCA x",
+ "SPvTCA y",
+ "SPvTCA x",
+ "SFvTCA y",
+ "SFvTCA x",
+ "SPvTL ||",
+ "SPvTL +",
+ "SFvTL ||",
+ "SFvTL +",
+ "SPvFS",
+ "SFvFS",
+ "GPV",
+ "GFV",
+ "SFvTPv",
+ "ISECT",
+
+ "SRP0",
+ "SRP1",
+ "SRP2",
+ "SZP0",
+ "SZP1",
+ "SZP2",
+ "SZPS",
+ "SLOOP",
+ "RTG",
+ "RTHG",
+ "SMD",
+ "ELSE",
+ "JMPR",
+ "SCvTCi",
+ "SSwCi",
+ "SSW",
+
+ "DUP",
+ "POP",
+ "CLEAR",
+ "SWAP",
+ "DEPTH",
+ "CINDEX",
+ "MINDEX",
+ "AlignPTS",
+ "INS_$28",
+ "UTP",
+ "LOOPCALL",
+ "CALL",
+ "FDEF",
+ "ENDF",
+ "MDAP[0]",
+ "MDAP[1]",
+
+ "IUP[0]",
+ "IUP[1]",
+ "SHP[0]",
+ "SHP[1]",
+ "SHC[0]",
+ "SHC[1]",
+ "SHZ[0]",
+ "SHZ[1]",
+ "SHPIX",
+ "IP",
+ "MSIRP[0]",
+ "MSIRP[1]",
+ "AlignRP",
+ "RTDG",
+ "MIAP[0]",
+ "MIAP[1]",
+
+ "NPushB",
+ "NPushW",
+ "WS",
+ "RS",
+ "WCvtP",
+ "RCvt",
+ "GC[0]",
+ "GC[1]",
+ "SCFS",
+ "MD[0]",
+ "MD[1]",
+ "MPPEM",
+ "MPS",
+ "FlipON",
+ "FlipOFF",
+ "DEBUG",
+
+ "LT",
+ "LTEQ",
+ "GT",
+ "GTEQ",
+ "EQ",
+ "NEQ",
+ "ODD",
+ "EVEN",
+ "IF",
+ "EIF",
+ "AND",
+ "OR",
+ "NOT",
+ "DeltaP1",
+ "SDB",
+ "SDS",
+
+ "ADD",
+ "SUB",
+ "DIV",
+ "MUL",
+ "ABS",
+ "NEG",
+ "FLOOR",
+ "CEILING",
+ "ROUND[0]",
+ "ROUND[1]",
+ "ROUND[2]",
+ "ROUND[3]",
+ "NROUND[0]",
+ "NROUND[1]",
+ "NROUND[2]",
+ "NROUND[3]",
+
+ "WCvtF",
+ "DeltaP2",
+ "DeltaP3",
+ "DeltaCn[0]",
+ "DeltaCn[1]",
+ "DeltaCn[2]",
+ "SROUND",
+ "S45Round",
+ "JROT",
+ "JROF",
+ "ROFF",
+ "INS_$7B",
+ "RUTG",
+ "RDTG",
+ "SANGW",
+ "AA",
+
+ "FlipPT",
+ "FlipRgON",
+ "FlipRgOFF",
+ "INS_$83",
+ "INS_$84",
+ "ScanCTRL",
+ "SDVPTL[0]",
+ "SDVPTL[1]",
+ "GetINFO",
+ "IDEF",
+ "ROLL",
+ "MAX",
+ "MIN",
+ "ScanTYPE",
+ "InstCTRL",
+ "INS_$8F",
+
+ "INS_$90",
+ "INS_$91",
+ "INS_$92",
+ "INS_$93",
+ "INS_$94",
+ "INS_$95",
+ "INS_$96",
+ "INS_$97",
+ "INS_$98",
+ "INS_$99",
+ "INS_$9A",
+ "INS_$9B",
+ "INS_$9C",
+ "INS_$9D",
+ "INS_$9E",
+ "INS_$9F",
+
+ "INS_$A0",
+ "INS_$A1",
+ "INS_$A2",
+ "INS_$A3",
+ "INS_$A4",
+ "INS_$A5",
+ "INS_$A6",
+ "INS_$A7",
+ "INS_$A8",
+ "INS_$A9",
+ "INS_$AA",
+ "INS_$AB",
+ "INS_$AC",
+ "INS_$AD",
+ "INS_$AE",
+ "INS_$AF",
+
+ "PushB[0]",
+ "PushB[1]",
+ "PushB[2]",
+ "PushB[3]",
+ "PushB[4]",
+ "PushB[5]",
+ "PushB[6]",
+ "PushB[7]",
+ "PushW[0]",
+ "PushW[1]",
+ "PushW[2]",
+ "PushW[3]",
+ "PushW[4]",
+ "PushW[5]",
+ "PushW[6]",
+ "PushW[7]",
+
+ "MDRP[00]",
+ "MDRP[01]",
+ "MDRP[02]",
+ "MDRP[03]",
+ "MDRP[04]",
+ "MDRP[05]",
+ "MDRP[06]",
+ "MDRP[07]",
+ "MDRP[08]",
+ "MDRP[09]",
+ "MDRP[10]",
+ "MDRP[11]",
+ "MDRP[12]",
+ "MDRP[13]",
+ "MDRP[14]",
+ "MDRP[15]",
+
+ "MDRP[16]",
+ "MDRP[17]",
+ "MDRP[18]",
+ "MDRP[19]",
+ "MDRP[20]",
+ "MDRP[21]",
+ "MDRP[22]",
+ "MDRP[23]",
+ "MDRP[24]",
+ "MDRP[25]",
+ "MDRP[26]",
+ "MDRP[27]",
+ "MDRP[28]",
+ "MDRP[29]",
+ "MDRP[30]",
+ "MDRP[31]",
+
+ "MIRP[00]",
+ "MIRP[01]",
+ "MIRP[02]",
+ "MIRP[03]",
+ "MIRP[04]",
+ "MIRP[05]",
+ "MIRP[06]",
+ "MIRP[07]",
+ "MIRP[08]",
+ "MIRP[09]",
+ "MIRP[10]",
+ "MIRP[11]",
+ "MIRP[12]",
+ "MIRP[13]",
+ "MIRP[14]",
+ "MIRP[15]",
+
+ "MIRP[16]",
+ "MIRP[17]",
+ "MIRP[18]",
+ "MIRP[19]",
+ "MIRP[20]",
+ "MIRP[21]",
+ "MIRP[22]",
+ "MIRP[23]",
+ "MIRP[24]",
+ "MIRP[25]",
+ "MIRP[26]",
+ "MIRP[27]",
+ "MIRP[28]",
+ "MIRP[29]",
+ "MIRP[30]",
+ "MIRP[31]"
+ };
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
+
static
const FT_Char opcode_length[256] =
{
@@ -1727,7 +2010,8 @@
if ( distance && val < 0 )
val = 0;
}
- else {
+ else
+ {
val = distance - compensation;
if ( val > 0 )
val = 0;
@@ -2892,24 +3176,30 @@
}
-#define DO_JROT \
- if ( args[1] != 0 ) \
- { \
- CUR.IP += args[0]; \
- CUR.step_ins = FALSE; \
+#define DO_JROT \
+ if ( args[1] != 0 ) \
+ { \
+ CUR.IP += args[0]; \
+ if ( CUR.IP < 0 ) \
+ CUR.error = TT_Err_Bad_Argument; \
+ CUR.step_ins = FALSE; \
}
-#define DO_JMPR \
- CUR.IP += args[0]; \
+#define DO_JMPR \
+ CUR.IP += args[0]; \
+ if ( CUR.IP < 0 ) \
+ CUR.error = TT_Err_Bad_Argument; \
CUR.step_ins = FALSE;
-#define DO_JROF \
- if ( args[1] == 0 ) \
- { \
- CUR.IP += args[0]; \
- CUR.step_ins = FALSE; \
+#define DO_JROF \
+ if ( args[1] == 0 ) \
+ { \
+ CUR.IP += args[0]; \
+ if ( CUR.IP < 0 ) \
+ CUR.error = TT_Err_Bad_Argument; \
+ CUR.step_ins = FALSE; \
}
@@ -2992,39 +3282,39 @@
args[0] = FT_PIX_CEIL( args[0] );
-#define DO_RS \
- { \
- FT_ULong I = (FT_ULong)args[0]; \
- \
- \
- if ( BOUNDS( I, CUR.storeSize ) ) \
- { \
- if ( CUR.pedantic_hinting ) \
- { \
- ARRAY_BOUND_ERROR; \
- } \
- else \
- args[0] = 0; \
- } \
- else \
- args[0] = CUR.storage[I]; \
+#define DO_RS \
+ { \
+ FT_ULong I = (FT_ULong)args[0]; \
+ \
+ \
+ if ( BOUNDSL( I, CUR.storeSize ) ) \
+ { \
+ if ( CUR.pedantic_hinting ) \
+ { \
+ ARRAY_BOUND_ERROR; \
+ } \
+ else \
+ args[0] = 0; \
+ } \
+ else \
+ args[0] = CUR.storage[I]; \
}
-#define DO_WS \
- { \
- FT_ULong I = (FT_ULong)args[0]; \
- \
- \
- if ( BOUNDS( I, CUR.storeSize ) ) \
- { \
- if ( CUR.pedantic_hinting ) \
- { \
- ARRAY_BOUND_ERROR; \
- } \
- } \
- else \
- CUR.storage[I] = args[1]; \
+#define DO_WS \
+ { \
+ FT_ULong I = (FT_ULong)args[0]; \
+ \
+ \
+ if ( BOUNDSL( I, CUR.storeSize ) ) \
+ { \
+ if ( CUR.pedantic_hinting ) \
+ { \
+ ARRAY_BOUND_ERROR; \
+ } \
+ } \
+ else \
+ CUR.storage[I] = args[1]; \
}
@@ -3033,7 +3323,7 @@
FT_ULong I = (FT_ULong)args[0]; \
\
\
- if ( BOUNDS( I, CUR.cvtSize ) ) \
+ if ( BOUNDSL( I, CUR.cvtSize ) ) \
{ \
if ( CUR.pedantic_hinting ) \
{ \
@@ -3052,7 +3342,7 @@
FT_ULong I = (FT_ULong)args[0]; \
\
\
- if ( BOUNDS( I, CUR.cvtSize ) ) \
+ if ( BOUNDSL( I, CUR.cvtSize ) ) \
{ \
if ( CUR.pedantic_hinting ) \
{ \
@@ -3069,7 +3359,7 @@
FT_ULong I = (FT_ULong)args[0]; \
\
\
- if ( BOUNDS( I, CUR.cvtSize ) ) \
+ if ( BOUNDSL( I, CUR.cvtSize ) ) \
{ \
if ( CUR.pedantic_hinting ) \
{ \
@@ -4390,7 +4680,7 @@
/* first of all, check the index */
F = args[0];
- if ( BOUNDS( F, CUR.maxFunc + 1 ) )
+ if ( BOUNDSL( F, CUR.maxFunc + 1 ) )
goto Fail;
/* Except for some old Apple fonts, all functions in a TrueType */
@@ -4466,7 +4756,7 @@
/* first of all, check the index */
F = args[1];
- if ( BOUNDS( F, CUR.maxFunc + 1 ) )
+ if ( BOUNDSL( F, CUR.maxFunc + 1 ) )
goto Fail;
/* Except for some old Apple fonts, all functions in a TrueType */
@@ -4569,7 +4859,7 @@
}
def->opc = (FT_Byte)args[0];
- def->start = CUR.IP+1;
+ def->start = CUR.IP + 1;
def->range = CUR.curRange;
def->active = TRUE;
@@ -4741,7 +5031,7 @@
L = (FT_ULong)args[0];
- if ( BOUNDS( L, CUR.zp2.n_points ) )
+ if ( BOUNDSL( L, CUR.zp2.n_points ) )
{
if ( CUR.pedantic_hinting )
{
@@ -4825,8 +5115,8 @@
K = (FT_UShort)args[1];
L = (FT_UShort)args[0];
- if( BOUNDS( L, CUR.zp0.n_points ) ||
- BOUNDS( K, CUR.zp1.n_points ) )
+ if ( BOUNDS( L, CUR.zp0.n_points ) ||
+ BOUNDS( K, CUR.zp1.n_points ) )
{
if ( CUR.pedantic_hinting )
{
@@ -5480,12 +5770,12 @@
static void
Ins_SHZ( INS_ARG )
{
- TT_GlyphZoneRec zp;
- FT_UShort refp;
- FT_F26Dot6 dx,
- dy;
+ TT_GlyphZoneRec zp;
+ FT_UShort refp;
+ FT_F26Dot6 dx,
+ dy;
- FT_UShort last_point, i;
+ FT_UShort last_point, i;
if ( BOUNDS( args[0], 2 ) )
@@ -5687,8 +5977,8 @@
cvtEntry = (FT_ULong)args[1];
point = (FT_UShort)args[0];
- if ( BOUNDS( point, CUR.zp0.n_points ) ||
- BOUNDS( cvtEntry, CUR.cvtSize ) )
+ if ( BOUNDS( point, CUR.zp0.n_points ) ||
+ BOUNDSL( cvtEntry, CUR.cvtSize ) )
{
if ( CUR.pedantic_hinting )
CUR.error = TT_Err_Invalid_Reference;
@@ -5880,7 +6170,7 @@
/* XXX: UNDOCUMENTED! cvt[-1] = 0 always */
if ( BOUNDS( point, CUR.zp1.n_points ) ||
- BOUNDS( cvtEntry, CUR.cvtSize + 1 ) ||
+ BOUNDSL( cvtEntry, CUR.cvtSize + 1 ) ||
BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) )
{
if ( CUR.pedantic_hinting )
@@ -6131,8 +6421,8 @@
p1 = (FT_UShort)args[0];
p2 = (FT_UShort)args[1];
- if ( BOUNDS( args[0], CUR.zp1.n_points ) ||
- BOUNDS( args[1], CUR.zp0.n_points ) )
+ if ( BOUNDS( p1, CUR.zp1.n_points ) ||
+ BOUNDS( p2, CUR.zp0.n_points ) )
{
if ( CUR.pedantic_hinting )
CUR.error = TT_Err_Invalid_Reference;
@@ -6466,8 +6756,8 @@
end_point = CUR.pts.contours[contour] - CUR.pts.first_point;
first_point = point;
- if ( CUR.pts.n_points <= end_point )
- end_point = CUR.pts.n_points;
+ if ( BOUNDS ( end_point, CUR.pts.n_points ) )
+ end_point = CUR.pts.n_points - 1;
while ( point <= end_point && ( CUR.pts.tags[point] & mask ) == 0 )
point++;
@@ -6661,7 +6951,7 @@
A = (FT_ULong)CUR.stack[CUR.args + 1];
B = CUR.stack[CUR.args];
- if ( BOUNDS( A, CUR.cvtSize ) )
+ if ( BOUNDSL( A, CUR.cvtSize ) )
{
if ( CUR.pedantic_hinting )
{
@@ -6771,7 +7061,7 @@
call = CUR.callStack + CUR.callTop++;
call->Caller_Range = CUR.curRange;
- call->Caller_IP = CUR.IP+1;
+ call->Caller_IP = CUR.IP + 1;
call->Cur_Count = 1;
call->Cur_Restart = def->start;
@@ -7140,6 +7430,10 @@
{
CUR.opcode = CUR.code[CUR.IP];
+ FT_TRACE7(( " " ));
+ FT_TRACE7(( opcode_name[CUR.opcode] ));
+ FT_TRACE7(( "\n" ));
+
if ( ( CUR.length = opcode_length[CUR.opcode] ) < 0 )
{
if ( CUR.IP + 1 > CUR.codeSize )
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index 07a8972..c480dfa 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -150,7 +150,7 @@ FT_BEGIN_HEADER
FT_Bool step_ins; /* true if the interpreter must */
/* increment IP after ins. exec */
- FT_Long cvtSize;
+ FT_ULong cvtSize;
FT_Long* cvt;
FT_UInt glyphSize; /* glyph instructions buffer size */
@@ -239,6 +239,14 @@ FT_BEGIN_HEADER
FT_Int range );
+ FT_LOCAL( FT_Error )
+ Update_Max( FT_Memory memory,
+ FT_ULong* size,
+ FT_Long multiplier,
+ void* _pbuff,
+ FT_ULong new_max );
+
+
/*************************************************************************/
/* */
/* <Function> */
diff --git a/src/truetype/ttpic.c b/src/truetype/ttpic.c
index 27ec4a1..5d72574 100644
--- a/src/truetype/ttpic.c
+++ b/src/truetype/ttpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for truetype module. */
/* */
-/* Copyright 2009 by */
+/* Copyright 2009, 2010 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -45,13 +45,15 @@
}
}
+
FT_Error
- tt_driver_class_pic_init( FT_Library library )
+ tt_driver_class_pic_init( FT_Library library )
{
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- TTModulePIC* container;
- FT_Memory memory = library->memory;
+ FT_PIC_Container* pic_container = &library->pic_container;
+ FT_Error error = TT_Err_Ok;
+ TTModulePIC* container;
+ FT_Memory memory = library->memory;
+
/* allocate pointer, clear and set global container pointer */
if ( FT_ALLOC ( container, sizeof ( *container ) ) )