summaryrefslogtreecommitdiffstats
path: root/src/cff
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/cff
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/cff')
-rw-r--r--src/cff/cf2blues.c11
-rw-r--r--src/cff/cf2font.c21
-rw-r--r--src/cff/cf2ft.c39
-rw-r--r--src/cff/cf2hints.c6
-rw-r--r--src/cff/cffload.c15
-rw-r--r--src/cff/cffobjs.c2
-rw-r--r--src/cff/cffparse.c6
7 files changed, 62 insertions, 38 deletions
diff --git a/src/cff/cf2blues.c b/src/cff/cf2blues.c
index eec589e..250f89e 100644
--- a/src/cff/cf2blues.c
+++ b/src/cff/cf2blues.c
@@ -4,7 +4,7 @@
/* */
/* Adobe's code for handling Blue Zones (body). */
/* */
-/* Copyright 2009-2013 Adobe Systems Incorporated. */
+/* Copyright 2009-2014 Adobe Systems Incorporated. */
/* */
/* This software, and all works of authorship, whether in source or */
/* object code form as indicated by the copyright notice(s) included */
@@ -408,11 +408,10 @@
/* Note: constant changed from 0.5 to 0.6 to avoid a problem with */
/* 10ppem Arial */
- blues->boost = FT_MulFix(
- cf2_floatToFixed( .6 ),
- ( cf2_intToFixed( 1 ) -
- FT_DivFix( blues->scale,
- blues->blueScale ) ) );
+ blues->boost = cf2_floatToFixed( .6 ) -
+ FT_MulDiv( cf2_floatToFixed ( .6 ),
+ blues->scale,
+ blues->blueScale );
if ( blues->boost > 0x7FFF )
{
/* boost must remain less than 0.5, or baseline could go negative */
diff --git a/src/cff/cf2font.c b/src/cff/cf2font.c
index 718d1e2..6e99dc2 100644
--- a/src/cff/cf2font.c
+++ b/src/cff/cf2font.c
@@ -4,7 +4,7 @@
/* */
/* Adobe's code for font instances (body). */
/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* Copyright 2007-2014 Adobe Systems Incorporated. */
/* */
/* This software, and all works of authorship, whether in source or */
/* object code form as indicated by the copyright notice(s) included */
@@ -167,7 +167,7 @@
if ( !xdelta )
goto Try_x3;
- *darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) +
+ *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
FT_DivFix( cf2_intToFixed( y1 ), ppem );
}
@@ -184,7 +184,7 @@
if ( !xdelta )
goto Try_x4;
- *darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) +
+ *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
FT_DivFix( cf2_intToFixed( y2 ), ppem );
}
}
@@ -202,7 +202,7 @@
if ( !xdelta )
goto Use_y4;
- *darkenAmount = FT_MulFix( x, FT_DivFix( ydelta, xdelta ) ) +
+ *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
FT_DivFix( cf2_intToFixed( y3 ), ppem );
}
}
@@ -233,13 +233,14 @@
/* pointer to parsed font object */
CFF_Decoder* decoder = font->decoder;
- FT_Bool needExtraSetup;
+ FT_Bool needExtraSetup = FALSE;
/* character space units */
CF2_Fixed boldenX = font->syntheticEmboldeningAmountX;
CF2_Fixed boldenY = font->syntheticEmboldeningAmountY;
- CF2_Fixed ppem;
+ CFF_SubFont subFont;
+ CF2_Fixed ppem;
/* clear previous error */
@@ -247,8 +248,12 @@
/* if a CID fontDict has changed, we need to recompute some cached */
/* data */
- needExtraSetup =
- (FT_Bool)( font->lastSubfont != cf2_getSubfont( decoder ) );
+ subFont = cf2_getSubfont( decoder );
+ if ( font->lastSubfont != subFont )
+ {
+ font->lastSubfont = subFont;
+ needExtraSetup = TRUE;
+ }
/* if ppem has changed, we need to recompute some cached data */
/* note: because of CID font matrix concatenation, ppem and transform */
diff --git a/src/cff/cf2ft.c b/src/cff/cf2ft.c
index 4abbc9d..cb8d31c 100644
--- a/src/cff/cf2ft.c
+++ b/src/cff/cf2ft.c
@@ -4,7 +4,7 @@
/* */
/* FreeType Glue Component to Adobe's Interpreter (body). */
/* */
-/* Copyright 2013 Adobe Systems Incorporated. */
+/* Copyright 2013-2014 Adobe Systems Incorporated. */
/* */
/* This software, and all works of authorship, whether in source or */
/* object code form as indicated by the copyright notice(s) included */
@@ -61,7 +61,9 @@
FT_ASSERT( unitsPerEm > 0 );
- FT_ASSERT( transform->a > 0 && transform->d > 0 );
+ if ( transform->a <= 0 || transform->d <= 0 )
+ return FT_THROW( Invalid_Size_Handle );
+
FT_ASSERT( transform->b == 0 && transform->c == 0 );
FT_ASSERT( transform->tx == 0 && transform->ty == 0 );
@@ -236,10 +238,8 @@
if ( *hinted )
{
- *x_scale = FT_DivFix( decoder->builder.glyph->x_scale,
- cf2_intToFixed( 64 ) );
- *y_scale = FT_DivFix( decoder->builder.glyph->y_scale,
- cf2_intToFixed( 64 ) );
+ *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64;
+ *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64;
}
else
{
@@ -357,9 +357,12 @@
/* also get units per em to validate scale */
font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder );
- error2 = cf2_checkTransform( &transform, font->unitsPerEm );
- if ( error2 )
- return error2;
+ if ( scaled )
+ {
+ error2 = cf2_checkTransform( &transform, font->unitsPerEm );
+ if ( error2 )
+ return error2;
+ }
error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth );
if ( error2 )
@@ -389,8 +392,16 @@
FT_ASSERT( decoder &&
decoder->builder.face &&
decoder->builder.face->root.size );
- FT_ASSERT( decoder->builder.face->root.size->metrics.y_ppem );
+ /*
+ * Note that `y_ppem' can be zero if there wasn't a call to
+ * `FT_Set_Char_Size' or something similar. However, this isn't a
+ * problem since we come to this place in the code only if
+ * FT_LOAD_NO_SCALE is set (the other case gets caught by
+ * `cf2_checkTransform'). The ppem value is needed to compute the stem
+ * darkening, which is disabled for getting the unscaled outline.
+ *
+ */
return cf2_intToFixed(
decoder->builder.face->root.size->metrics.y_ppem );
}
@@ -508,7 +519,7 @@
CF2_UInt idx,
CF2_Buffer buf )
{
- FT_ASSERT( decoder && decoder->globals );
+ FT_ASSERT( decoder );
FT_ZERO( buf );
@@ -516,6 +527,8 @@
if ( idx >= decoder->num_globals )
return TRUE; /* error */
+ FT_ASSERT( decoder->globals );
+
buf->start =
buf->ptr = decoder->globals[idx];
buf->end = decoder->globals[idx + 1];
@@ -581,7 +594,7 @@
CF2_UInt idx,
CF2_Buffer buf )
{
- FT_ASSERT( decoder && decoder->locals );
+ FT_ASSERT( decoder );
FT_ZERO( buf );
@@ -589,6 +602,8 @@
if ( idx >= decoder->num_locals )
return TRUE; /* error */
+ FT_ASSERT( decoder->locals );
+
buf->start =
buf->ptr = decoder->locals[idx];
buf->end = decoder->locals[idx + 1];
diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c
index 5f44161..81049f4 100644
--- a/src/cff/cf2hints.c
+++ b/src/cff/cf2hints.c
@@ -4,7 +4,7 @@
/* */
/* Adobe's code for handling CFF hints (body). */
/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
+/* Copyright 2007-2014 Adobe Systems Incorporated. */
/* */
/* This software, and all works of authorship, whether in source or */
/* object code form as indicated by the copyright notice(s) included */
@@ -781,6 +781,8 @@
cf2_hintmask_setAll( hintMask,
cf2_arrstack_size( hStemHintArray ) +
cf2_arrstack_size( vStemHintArray ) );
+ if ( !cf2_hintmask_isValid( hintMask ) )
+ return; /* too many stem hints */
}
/* begin by clearing the map */
@@ -1558,7 +1560,7 @@
{
/* -y */
*x = -glyphpath->xOffset;
- *y = glyphpath->xOffset;
+ *y = glyphpath->yOffset;
}
else
{
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index ff271f3..d9bec59 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -4,7 +4,7 @@
/* */
/* OpenType and CFF data/program tables loader (body). */
/* */
-/* Copyright 1996-2013 by */
+/* Copyright 1996-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -689,6 +689,13 @@
if ( FT_READ_USHORT( num_ranges ) )
goto Exit;
+ if ( !num_ranges )
+ {
+ FT_TRACE0(( "CFF_Load_FD_Select: empty FDSelect array\n" ));
+ error = FT_THROW( Invalid_File_Format );
+ goto Exit;
+ }
+
fdselect->data_size = num_ranges * 3 + 2;
Load_Data:
@@ -719,7 +726,7 @@
break;
case 3:
- /* first, compare to cache */
+ /* first, compare to the cache */
if ( (FT_UInt)( glyph_index - fdselect->cache_first ) <
fdselect->cache_count )
{
@@ -727,7 +734,7 @@
break;
}
- /* then, lookup the ranges array */
+ /* then, look up the ranges array */
{
FT_Byte* p = fdselect->data;
FT_Byte* p_limit = p + fdselect->data_size;
@@ -750,7 +757,7 @@
/* update cache */
fdselect->cache_first = first;
- fdselect->cache_count = limit-first;
+ fdselect->cache_count = limit - first;
fdselect->cache_fd = fd2;
break;
}
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 29c3691..cac4ac2 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -866,7 +866,7 @@
flags |= FT_FACE_FLAG_KERNING;
#endif
- cffface->face_flags = flags;
+ cffface->face_flags |= flags;
/*******************************************************************/
/* */
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 9622212..91bd532 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (body) */
/* */
-/* Copyright 1996-2004, 2007-2013 by */
+/* Copyright 1996-2004, 2007-2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -66,7 +66,6 @@
goto Bad;
val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] );
- p += 2;
}
else if ( v == 29 )
{
@@ -77,7 +76,6 @@
( (FT_ULong)p[1] << 16 ) |
( (FT_ULong)p[2] << 8 ) |
(FT_ULong)p[3] );
- p += 4;
}
else if ( v < 247 )
{
@@ -89,7 +87,6 @@
goto Bad;
val = ( v - 247 ) * 256 + p[0] + 108;
- p++;
}
else
{
@@ -97,7 +94,6 @@
goto Bad;
val = -( v - 251 ) * 256 - p[0] - 108;
- p++;
}
Exit: