summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/truetype/ttgxvar.c
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2013-03-26 08:57:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-01 12:03:55 +0200
commit6845a4fb0147117e8517d66f18792ca7acdbe06e (patch)
tree68e35417b79989a7af8a4ea8c0d282b84dbe0a6e /src/3rdparty/freetype/src/truetype/ttgxvar.c
parent0fcadcca3d0842354de07ffaa8c622e607aab22c (diff)
Update bundled FreeType sources to 2.3.12
Most important changes: * SFNT cmap 13 table format support; * fixed glitches when rasterizing stretched TTF (xsize!=ysize); * various fixes in Type1, CFF, and PCF drivers Change-Id: Ib9e2210ffbd0daa2fdbf518ea87f4be502de6b48 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/freetype/src/truetype/ttgxvar.c')
-rw-r--r--src/3rdparty/freetype/src/truetype/ttgxvar.c83
1 files changed, 43 insertions, 40 deletions
diff --git a/src/3rdparty/freetype/src/truetype/ttgxvar.c b/src/3rdparty/freetype/src/truetype/ttgxvar.c
index 515e734b8a..ef25aafb5b 100644
--- a/src/3rdparty/freetype/src/truetype/ttgxvar.c
+++ b/src/3rdparty/freetype/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
/* */
/* TrueType GX Font Variation loader */
/* */
-/* Copyright 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,30 +16,31 @@
/***************************************************************************/
-/***************************************************************************/
-/* */
-/* Apple documents the `fvar', `gvar', `cvar', and `avar' tables at */
-/* */
-/* http://developer.apple.com/fonts/TTRefMan/RM06/Chap6[fgca]var.html */
-/* */
-/* The documentation for `fvar' is inconsistent. At one point it says */
-/* that `countSizePairs' should be 3, at another point 2. It should be 2. */
-/* */
-/* The documentation for `gvar' is not intelligible; `cvar' refers you to */
-/* `gvar' and is thus also incomprehensible. */
-/* */
-/* The documentation for `avar' appears correct, but Apple has no fonts */
-/* with an `avar' table, so it is hard to test. */
-/* */
-/* Many thanks to John Jenkins (at Apple) in figuring this out. */
-/* */
-/* */
-/* Apple's `kern' table has some references to tuple indices, but as there */
-/* is no indication where these indices are defined, nor how to */
-/* interpolate the kerning values (different tuples have different */
-/* classes) this issue is ignored. */
-/* */
-/***************************************************************************/
+ /*************************************************************************/
+ /* */
+ /* Apple documents the `fvar', `gvar', `cvar', and `avar' tables at */
+ /* */
+ /* http://developer.apple.com/fonts/TTRefMan/RM06/Chap6[fgca]var.html */
+ /* */
+ /* The documentation for `fvar' is inconsistent. At one point it says */
+ /* that `countSizePairs' should be 3, at another point 2. It should */
+ /* be 2. */
+ /* */
+ /* The documentation for `gvar' is not intelligible; `cvar' refers you */
+ /* to `gvar' and is thus also incomprehensible. */
+ /* */
+ /* The documentation for `avar' appears correct, but Apple has no fonts */
+ /* with an `avar' table, so it is hard to test. */
+ /* */
+ /* Many thanks to John Jenkins (at Apple) in figuring this out. */
+ /* */
+ /* */
+ /* Apple's `kern' table has some references to tuple indices, but as */
+ /* there is no indication where these indices are defined, nor how to */
+ /* interpolate the kerning values (different tuples have different */
+ /* classes) this issue is ignored. */
+ /* */
+ /*************************************************************************/
#include <ft2build.h>
@@ -47,11 +48,9 @@
#include FT_CONFIG_CONFIG_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_IDS_H
#include FT_TRUETYPE_TAGS_H
#include FT_MULTIPLE_MASTERS_H
-#include "ttdriver.h"
#include "ttpload.h"
#include "ttgxvar.h"
@@ -95,11 +94,8 @@
#define ALL_POINTS (FT_UShort*)( -1 )
- enum
- {
- GX_PT_POINTS_ARE_WORDS = 0x80,
- GX_PT_POINT_RUN_COUNT_MASK = 0x7F
- };
+#define GX_PT_POINTS_ARE_WORDS 0x80
+#define GX_PT_POINT_RUN_COUNT_MASK 0x7F
/*************************************************************************/
@@ -158,6 +154,9 @@
runcnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK;
first = points[i++] = FT_GET_USHORT();
+ if ( runcnt < 1 )
+ goto Exit;
+
/* first point not included in runcount */
for ( j = 0; j < runcnt; ++j )
points[i++] = (FT_UShort)( first += FT_GET_USHORT() );
@@ -166,11 +165,15 @@
{
first = points[i++] = FT_GET_BYTE();
+ if ( runcnt < 1 )
+ goto Exit;
+
for ( j = 0; j < runcnt; ++j )
points[i++] = (FT_UShort)( first += FT_GET_BYTE() );
}
}
+ Exit:
return points;
}
@@ -205,12 +208,12 @@
/* */
static FT_Short*
ft_var_readpackeddeltas( FT_Stream stream,
- FT_Int delta_cnt )
+ FT_Offset delta_cnt )
{
FT_Short *deltas;
- FT_Int runcnt;
- FT_Int i;
- FT_Int j;
+ FT_UInt runcnt;
+ FT_Offset i;
+ FT_UInt j;
FT_Memory memory = stream->memory;
FT_Error error = TT_Err_Ok;
@@ -1132,7 +1135,7 @@
if ( blend == NULL )
{
- FT_TRACE2(( "no blend specified!\n" ));
+ FT_TRACE2(( "tt_face_vary_cvt: no blend specified\n" ));
error = TT_Err_Ok;
goto Exit;
@@ -1140,7 +1143,7 @@
if ( face->cvt == NULL )
{
- FT_TRACE2(( "no `cvt ' table!\n" ));
+ FT_TRACE2(( "tt_face_vary_cvt: no `cvt ' table\n" ));
error = TT_Err_Ok;
goto Exit;
@@ -1149,7 +1152,7 @@
error = face->goto_table( face, TTAG_cvar, stream, &table_len );
if ( error )
{
- FT_TRACE2(( "is missing!\n" ));
+ FT_TRACE2(( "is missing\n" ));
error = TT_Err_Ok;
goto Exit;
@@ -1164,7 +1167,7 @@
table_start = FT_Stream_FTell( stream );
if ( FT_GET_LONG() != 0x00010000L )
{
- FT_TRACE2(( "bad table version!\n" ));
+ FT_TRACE2(( "bad table version\n" ));
error = TT_Err_Ok;
goto FExit;