summaryrefslogtreecommitdiffstats
path: root/src/truetype
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@google.com>2014-08-08 17:55:11 -0400
committerBehdad Esfahbod <behdad@google.com>2014-08-08 17:59:36 -0400
commit9c745321260bb728ab1cd1c8fd5f075854b2ad49 (patch)
tree86c9ee0214cac2870a94905e4240732413ed768b /src/truetype
parentec0bab5697bb31ba980810145f62e3799946ec60 (diff)
downloadandroid_external_freetype-staging/cm-12.0-caf.tar.gz
android_external_freetype-staging/cm-12.0-caf.tar.bz2
android_external_freetype-staging/cm-12.0-caf.zip
Update freetype to e1394d56752cac3bd68ab2358a8e1384ce7b9aaastaging/cm-12.0-cafstaging/cm-12.0
Integrated patches from freetype2 git repository, up to hashval e1394d56752cac3bd68ab2358a8e1384ce7b9aaa, which is post-2.5.3. Most recent commit message from freetype git: Minor documentation improvement. Noteworthy patches included: Fix Savannah bug #41697, part 2. Fix Savannah bug #41697, part 1. Bug: 16575323 Change-Id: I4f8f9375afd2540618b3ebf6152d77b743975dce
Diffstat (limited to 'src/truetype')
-rw-r--r--src/truetype/ttgload.c21
-rw-r--r--src/truetype/ttinterp.c44
-rw-r--r--src/truetype/ttobjs.c37
-rw-r--r--src/truetype/ttobjs.h8
-rw-r--r--src/truetype/ttsubpix.c4
5 files changed, 62 insertions, 52 deletions
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index b10e390..ff2b339 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -4,7 +4,7 @@
/* */
/* TrueType Glyph Loader (body). */
/* */
-/* Copyright 1996-2013 */
+/* Copyright 1996-2014 */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -99,13 +99,13 @@
else if ( face->os2.version != 0xFFFFU )
{
- *tsb = face->os2.sTypoAscender - yMax;
+ *tsb = (FT_Short)( face->os2.sTypoAscender - yMax );
*ah = face->os2.sTypoAscender - face->os2.sTypoDescender;
}
else
{
- *tsb = face->horizontal.Ascender - yMax;
+ *tsb = (FT_Short)( face->horizontal.Ascender - yMax );
*ah = face->horizontal.Ascender - face->horizontal.Descender;
}
@@ -2120,7 +2120,7 @@
FT_Bool reexecute = FALSE;
- if ( !size->cvt_ready )
+ if ( size->bytecode_ready < 0 || size->cvt_ready < 0 )
{
FT_Error error = tt_size_ready_bytecode( size, pedantic );
@@ -2128,6 +2128,10 @@
if ( error )
return error;
}
+ else if ( size->bytecode_ready )
+ return size->bytecode_ready;
+ else if ( size->cvt_ready )
+ return size->cvt_ready;
/* query new execution context */
exec = size->debug ? size->context
@@ -2238,12 +2242,15 @@
if ( reexecute )
{
- FT_UInt i;
+ FT_UInt i;
+ FT_Error error;
for ( i = 0; i < size->cvt_size; i++ )
size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
- tt_size_run_prep( size, pedantic );
+ error = tt_size_run_prep( size, pedantic );
+ if ( error )
+ return error;
}
/* see whether the cvt program has disabled hinting */
@@ -2346,8 +2353,6 @@
TT_LoaderRec loader;
- error = FT_Err_Ok;
-
FT_TRACE1(( "TT_Load_Glyph: glyph index %d\n", glyph_index ));
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 3f110c2..9491533 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (body). */
/* */
-/* Copyright 1996-2013 */
+/* Copyright 1996-2014 */
/* by David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -796,16 +796,13 @@
FT_EXPORT_DEF( TT_ExecContext )
TT_New_Context( TT_Driver driver )
{
- TT_ExecContext exec;
- FT_Memory memory;
+ FT_Memory memory = driver->root.root.memory;
- memory = driver->root.root.memory;
- exec = driver->context;
-
if ( !driver->context )
{
- FT_Error error;
+ FT_Error error;
+ TT_ExecContext exec;
/* allocate object */
@@ -1470,7 +1467,7 @@
__asm__ __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
-#ifdef __clang__
+#if defined( __clang__ ) && defined( __thumb2__ )
"add.w %0, %0, #0x2000\n\t" /* %0 += 0x2000 */
#else
"add %0, %0, #0x2000\n\t" /* %0 += 0x2000 */
@@ -7169,7 +7166,7 @@
org_dist = CUR_fast_dualproj( &vec );
}
- cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base );
+ cur_dist = CUR_Func_project( &CUR.zp2.cur[point], cur_base );
if ( org_dist )
{
@@ -7180,14 +7177,20 @@
/* This is the same as what MS does for the invalid case: */
/* */
/* delta = (Original_Pt - Original_RP1) - */
- /* (Current_Pt - Current_RP1) */
+ /* (Current_Pt - Current_RP1) ; */
/* */
/* In FreeType speak: */
/* */
- /* new_dist = cur_dist - */
- /* org_dist - cur_dist; */
+ /* delta = org_dist - cur_dist . */
+ /* */
+ /* We move `point' by `new_dist - cur_dist' after leaving */
+ /* this block, thus we have */
+ /* */
+ /* new_dist - cur_dist = delta , */
+ /* new_dist - cur_dist = org_dist - cur_dist , */
+ /* new_dist = org_dist . */
- new_dist = -org_dist;
+ new_dist = org_dist;
}
}
else
@@ -7593,9 +7596,9 @@
else if ( CUR.ignore_x_mode )
{
if ( CUR.GS.freeVector.y != 0 )
- B1 = CUR.zp0.cur[A].y;
+ B1 = (FT_UShort)CUR.zp0.cur[A].y;
else
- B1 = CUR.zp0.cur[A].x;
+ B1 = (FT_UShort)CUR.zp0.cur[A].x;
#if 0
/* Standard Subpixel Hinting: Allow y move. */
@@ -7612,7 +7615,7 @@
!( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) )
{
/* save the y value of the point now; compare after move */
- B1 = CUR.zp0.cur[A].y;
+ B1 = (FT_UShort)CUR.zp0.cur[A].y;
if ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
B = FT_PIX_ROUND( B1 + B ) - B1;
@@ -7624,7 +7627,7 @@
CUR_Func_move( &CUR.zp0, A, B );
}
- B2 = CUR.zp0.cur[A].y;
+ B2 = (FT_UShort)CUR.zp0.cur[A].y;
/* Reverse this move if it results in a disallowed move */
if ( CUR.GS.freeVector.y != 0 &&
@@ -9032,10 +9035,13 @@
/* If any errors have occurred, function tables may be broken. */
/* Force a re-execution of `prep' and `fpgm' tables if no */
/* bytecode debugger is run. */
- if ( CUR.error && !CUR.instruction_trap )
+ if ( CUR.error
+ && !CUR.instruction_trap
+ && CUR.curRange == tt_coderange_glyph )
{
FT_TRACE1(( " The interpreter returned error 0x%x\n", CUR.error ));
- exc->size->cvt_ready = FALSE;
+ exc->size->bytecode_ready = -1;
+ exc->size->cvt_ready = -1;
}
return CUR.error;
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index 4adba58..05a121c 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -813,6 +813,8 @@
else
error = FT_Err_Ok;
+ size->bytecode_ready = error;
+
if ( !error )
TT_Save_Context( exec, size );
@@ -884,6 +886,8 @@
else
error = FT_Err_Ok;
+ size->cvt_ready = error;
+
/* UNDOCUMENTED! The MS rasterizer doesn't allow the following */
/* graphics state variables to be modified by the CVT program. */
@@ -912,10 +916,6 @@
return error;
}
-#endif /* TT_USE_BYTECODE_INTERPRETER */
-
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
static void
tt_size_done_bytecode( FT_Size ftsize )
@@ -953,8 +953,8 @@
size->max_func = 0;
size->max_ins = 0;
- size->bytecode_ready = 0;
- size->cvt_ready = 0;
+ size->bytecode_ready = -1;
+ size->cvt_ready = -1;
}
@@ -974,8 +974,8 @@
TT_MaxProfile* maxp = &face->max_profile;
- size->bytecode_ready = 1;
- size->cvt_ready = 0;
+ size->bytecode_ready = -1;
+ size->cvt_ready = -1;
size->max_function_defs = maxp->maxFunctionDefs;
size->max_instruction_defs = maxp->maxInstructionDefs;
@@ -1052,15 +1052,14 @@
FT_Error error = FT_Err_Ok;
- if ( !size->bytecode_ready )
- {
+ if ( size->bytecode_ready < 0 )
error = tt_size_init_bytecode( (FT_Size)size, pedantic );
- if ( error )
- goto Exit;
- }
+
+ if ( error || size->bytecode_ready )
+ goto Exit;
/* rescale CVT when needed */
- if ( !size->cvt_ready )
+ if ( size->cvt_ready < 0 )
{
FT_UInt i;
TT_Face face = (TT_Face)size->root.face;
@@ -1087,8 +1086,6 @@
size->GS = tt_default_graphics_state;
error = tt_size_run_prep( size, pedantic );
- if ( !error )
- size->cvt_ready = 1;
}
Exit:
@@ -1119,8 +1116,8 @@
FT_Error error = FT_Err_Ok;
#ifdef TT_USE_BYTECODE_INTERPRETER
- size->bytecode_ready = 0;
- size->cvt_ready = 0;
+ size->bytecode_ready = -1;
+ size->cvt_ready = -1;
#endif
size->ttmetrics.valid = FALSE;
@@ -1148,7 +1145,7 @@
#ifdef TT_USE_BYTECODE_INTERPRETER
- if ( size->bytecode_ready )
+ if ( size->bytecode_ready >= 0 )
tt_size_done_bytecode( ttsize );
#endif
@@ -1229,7 +1226,7 @@
}
#ifdef TT_USE_BYTECODE_INTERPRETER
- size->cvt_ready = 0;
+ size->cvt_ready = -1;
#endif /* TT_USE_BYTECODE_INTERPRETER */
if ( !error )
diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
index a11dd37..47d50d9 100644
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
/* */
/* Objects manager (specification). */
/* */
-/* Copyright 1996-2009, 2011-2013 by */
+/* Copyright 1996-2009, 2011-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -333,8 +333,10 @@ FT_BEGIN_HEADER
FT_Bool debug;
TT_ExecContext context;
- FT_Bool bytecode_ready;
- FT_Bool cvt_ready;
+ /* if negative, `fpgm' (resp. `prep'), wasn't executed yet; */
+ /* otherwise it is the returned error code */
+ FT_Error bytecode_ready;
+ FT_Error cvt_ready;
#endif /* TT_USE_BYTECODE_INTERPRETER */
diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c
index 28470ad..9871994 100644
--- a/src/truetype/ttsubpix.c
+++ b/src/truetype/ttsubpix.c
@@ -956,7 +956,7 @@
if ( loader->exec->rasterizer_version != TT_INTERPRETER_VERSION_35 )
{
loader->exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
- loader->exec->size->cvt_ready = FALSE;
+ loader->exec->size->cvt_ready = -1;
tt_size_ready_bytecode(
loader->exec->size,
@@ -971,7 +971,7 @@
SPH_OPTION_SET_RASTERIZER_VERSION )
{
loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
- loader->exec->size->cvt_ready = FALSE;
+ loader->exec->size->cvt_ready = -1;
tt_size_ready_bytecode(
loader->exec->size,