summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/truetype
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
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')
-rw-r--r--src/3rdparty/freetype/src/truetype/Jamfile2
-rw-r--r--src/3rdparty/freetype/src/truetype/truetype.c1
-rw-r--r--src/3rdparty/freetype/src/truetype/ttdriver.c91
-rw-r--r--src/3rdparty/freetype/src/truetype/ttdriver.h2
-rw-r--r--src/3rdparty/freetype/src/truetype/ttgload.c317
-rw-r--r--src/3rdparty/freetype/src/truetype/ttgxvar.c83
-rw-r--r--src/3rdparty/freetype/src/truetype/ttgxvar.h2
-rw-r--r--src/3rdparty/freetype/src/truetype/ttinterp.c52
-rw-r--r--src/3rdparty/freetype/src/truetype/ttobjs.c20
-rw-r--r--src/3rdparty/freetype/src/truetype/ttobjs.h38
-rw-r--r--src/3rdparty/freetype/src/truetype/ttpic.c79
-rw-r--r--src/3rdparty/freetype/src/truetype/ttpic.h59
-rw-r--r--src/3rdparty/freetype/src/truetype/ttpload.c40
13 files changed, 493 insertions, 293 deletions
diff --git a/src/3rdparty/freetype/src/truetype/Jamfile b/src/3rdparty/freetype/src/truetype/Jamfile
index a166909f4c..a8cccfe137 100644
--- a/src/3rdparty/freetype/src/truetype/Jamfile
+++ b/src/3rdparty/freetype/src/truetype/Jamfile
@@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) truetype ;
if $(FT2_MULTI)
{
- _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ;
+ _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ttpic ;
}
else
{
diff --git a/src/3rdparty/freetype/src/truetype/truetype.c b/src/3rdparty/freetype/src/truetype/truetype.c
index b36473a72d..4bd1209787 100644
--- a/src/3rdparty/freetype/src/truetype/truetype.c
+++ b/src/3rdparty/freetype/src/truetype/truetype.c
@@ -19,6 +19,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ft2build.h>
+#include "ttpic.c"
#include "ttdriver.c" /* driver interface */
#include "ttpload.c" /* tables loader */
#include "ttgload.c" /* glyph loader */
diff --git a/src/3rdparty/freetype/src/truetype/ttdriver.c b/src/3rdparty/freetype/src/truetype/ttdriver.c
index 42feb05ede..d723b57ae9 100644
--- a/src/3rdparty/freetype/src/truetype/ttdriver.c
+++ b/src/3rdparty/freetype/src/truetype/ttdriver.c
@@ -4,7 +4,8 @@
/* */
/* TrueType font driver implementation (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* 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, */
@@ -20,7 +21,6 @@
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H
-#include FT_TRUETYPE_IDS_H
#include FT_SERVICE_XFREE86_NAME_H
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -41,6 +41,7 @@
#include "tterrors.h"
+#include "ttpic.h"
/*************************************************************************/
/* */
@@ -298,7 +299,15 @@
if ( !size )
return TT_Err_Invalid_Size_Handle;
- if ( !face || glyph_index >= (FT_UInt)face->num_glyphs )
+ if ( !face )
+ return TT_Err_Invalid_Argument;
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ if ( glyph_index >= (FT_UInt)face->num_glyphs &&
+ !face->internal->incremental_interface )
+#else
+ if ( glyph_index >= (FT_UInt)face->num_glyphs )
+#endif
return TT_Err_Invalid_Argument;
if ( load_flags & FT_LOAD_NO_HINTING )
@@ -344,14 +353,13 @@
/*************************************************************************/
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- static const FT_Service_MultiMastersRec tt_service_gx_multi_masters =
- {
+ FT_DEFINE_SERVICE_MULTIMASTERSREC(tt_service_gx_multi_masters,
(FT_Get_MM_Func) NULL,
(FT_Set_MM_Design_Func) NULL,
(FT_Set_MM_Blend_Func) TT_Set_MM_Blend,
(FT_Get_MM_Var_Func) TT_Get_MM_Var,
(FT_Set_Var_Design_Func)TT_Set_Var_Design
- };
+ )
#endif
static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine =
@@ -371,22 +379,24 @@
#endif /* TT_USE_BYTECODE_INTERPRETER */
};
- static const FT_Service_TTGlyfRec tt_service_truetype_glyf =
- {
+ FT_DEFINE_SERVICE_TTGLYFREC(tt_service_truetype_glyf,
(TT_Glyf_GetLocationFunc)tt_face_get_location
- };
+ )
- static const FT_ServiceDescRec tt_services[] =
- {
- { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE },
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- { FT_SERVICE_ID_MULTI_MASTERS, &tt_service_gx_multi_masters },
+ FT_DEFINE_SERVICEDESCREC4(tt_services,
+ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE,
+ FT_SERVICE_ID_MULTI_MASTERS, &FT_TT_SERVICE_GX_MULTI_MASTERS_GET,
+ FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
+ FT_SERVICE_ID_TT_GLYF, &FT_TT_SERVICE_TRUETYPE_GLYF_GET
+ )
+#else
+ FT_DEFINE_SERVICEDESCREC3(tt_services,
+ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE,
+ FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine,
+ FT_SERVICE_ID_TT_GLYF, &FT_TT_SERVICE_TRUETYPE_GLYF_GET
+ )
#endif
- { FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine },
- { FT_SERVICE_ID_TT_GLYF, &tt_service_truetype_glyf },
- { NULL, NULL }
- };
-
FT_CALLBACK_DEF( FT_Module_Interface )
tt_get_interface( FT_Module driver, /* TT_Driver */
@@ -396,11 +406,13 @@
FT_Module sfntd;
SFNT_Service sfnt;
-
- result = ft_service_list_lookup( tt_services, tt_interface );
+ result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface );
if ( result != NULL )
return result;
+ if ( !driver )
+ return NULL;
+
/* only return the default interface from the SFNT module */
sfntd = FT_Get_Module( driver->library, "sfnt" );
if ( sfntd )
@@ -416,18 +428,25 @@
/* The FT_DriverInterface structure is defined in ftdriver.h. */
- FT_CALLBACK_TABLE_DEF
- const FT_Driver_ClassRec tt_driver_class =
- {
- {
- FT_MODULE_FONT_DRIVER |
- FT_MODULE_DRIVER_SCALABLE |
#ifdef TT_USE_BYTECODE_INTERPRETER
- FT_MODULE_DRIVER_HAS_HINTER,
+#define TT_HINTER_FLAG FT_MODULE_DRIVER_HAS_HINTER
+#else
+#define TT_HINTER_FLAG 0
+#endif
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+#define TT_SIZE_SELECT tt_size_select
#else
- 0,
+#define TT_SIZE_SELECT 0
#endif
+ FT_DEFINE_DRIVER(tt_driver_class,
+
+
+ FT_MODULE_FONT_DRIVER |
+ FT_MODULE_DRIVER_SCALABLE |
+ TT_HINTER_FLAG,
+
sizeof ( TT_DriverRec ),
"truetype", /* driver name */
@@ -439,7 +458,6 @@
tt_driver_init,
tt_driver_done,
tt_get_interface,
- },
sizeof ( TT_FaceRec ),
sizeof ( TT_SizeRec ),
@@ -452,10 +470,9 @@
tt_slot_init,
0, /* FT_Slot_DoneFunc */
-#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
- ft_stub_set_char_sizes,
- ft_stub_set_pixel_sizes,
-#endif
+ ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+ ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
+
Load_Glyph,
tt_get_kerning,
@@ -463,12 +480,8 @@
tt_get_advances,
tt_size_request,
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
- tt_size_select
-#else
- 0 /* FT_Size_SelectFunc */
-#endif
- };
+ TT_SIZE_SELECT
+ )
/* END */
diff --git a/src/3rdparty/freetype/src/truetype/ttdriver.h b/src/3rdparty/freetype/src/truetype/ttdriver.h
index f6f26e4b59..aae00f2617 100644
--- a/src/3rdparty/freetype/src/truetype/ttdriver.h
+++ b/src/3rdparty/freetype/src/truetype/ttdriver.h
@@ -27,7 +27,7 @@
FT_BEGIN_HEADER
- FT_EXPORT_VAR( const FT_Driver_ClassRec ) tt_driver_class;
+ FT_DECLARE_DRIVER( tt_driver_class )
FT_END_HEADER
diff --git a/src/3rdparty/freetype/src/truetype/ttgload.c b/src/3rdparty/freetype/src/truetype/ttgload.c
index 06e9ccd1d8..57ea0baa77 100644
--- a/src/3rdparty/freetype/src/truetype/ttgload.c
+++ b/src/3rdparty/freetype/src/truetype/ttgload.c
@@ -4,7 +4,8 @@
/* */
/* TrueType Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* 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, */
@@ -69,7 +70,7 @@
/* `check' is true, take care of monospaced fonts by returning the */
/* advance width maximum. */
/* */
- FT_LOCAL_DEF(void)
+ FT_LOCAL_DEF( void )
TT_Get_HMetrics( TT_Face face,
FT_UInt idx,
FT_Bool check,
@@ -80,6 +81,9 @@
if ( check && face->postscript.isFixedPitch )
*aw = face->horizontal.advance_Width_Max;
+
+ FT_TRACE5(( " advance width (font units): %d\n", *aw ));
+ FT_TRACE5(( " left side bearing (font units): %d\n", *lsb ));
}
@@ -96,7 +100,7 @@
/* The monospace `check' is probably not meaningful here, but we leave */
/* it in for a consistent interface. */
/* */
- FT_LOCAL_DEF(void)
+ FT_LOCAL_DEF( void )
TT_Get_VMetrics( TT_Face face,
FT_UInt idx,
FT_Bool check,
@@ -131,6 +135,91 @@
#endif
+ FT_TRACE5(( " advance height (font units): %d\n", *ah ));
+ FT_TRACE5(( " top side bearing (font units): %d\n", *tsb ));
+ }
+
+
+ static void
+ tt_get_metrics( 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;
+
+
+ TT_Get_HMetrics( face, glyph_index,
+ (FT_Bool)!( loader->load_flags &
+ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
+ &left_bearing,
+ &advance_width );
+ TT_Get_VMetrics( face, glyph_index,
+ (FT_Bool)!( loader->load_flags &
+ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
+ &top_bearing,
+ &advance_height );
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+
+ /* If this is an incrementally loaded font check whether there are */
+ /* overriding metrics for this glyph. */
+ if ( face->root.internal->incremental_interface &&
+ face->root.internal->incremental_interface->funcs->get_glyph_metrics )
+ {
+ FT_Incremental_MetricsRec metrics;
+ FT_Error error;
+
+
+ metrics.bearing_x = left_bearing;
+ metrics.bearing_y = 0;
+ metrics.advance = advance_width;
+ metrics.advance_v = 0;
+
+ error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
+ face->root.internal->incremental_interface->object,
+ glyph_index, FALSE, &metrics );
+ if ( error )
+ goto Exit;
+
+ left_bearing = (FT_Short)metrics.bearing_x;
+ advance_width = (FT_UShort)metrics.advance;
+
+#if 0
+
+ /* GWW: Do I do the same for vertical metrics? */
+ metrics.bearing_x = 0;
+ metrics.bearing_y = top_bearing;
+ metrics.advance = advance_height;
+
+ error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
+ face->root.internal->incremental_interface->object,
+ glyph_index, TRUE, &metrics );
+ if ( error )
+ goto Exit;
+
+ top_bearing = (FT_Short)metrics.bearing_y;
+ advance_height = (FT_UShort)metrics.advance;
+
+#endif /* 0 */
+
+ }
+
+ Exit:
+
+#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;
+ }
}
@@ -317,7 +406,7 @@
if ( n_ins > face->max_profile.maxSizeOfInstructions )
{
- FT_TRACE0(( "TT_Load_Simple_Glyph: Too many instructions (%d)\n",
+ FT_TRACE0(( "TT_Load_Simple_Glyph: too many instructions (%d)\n",
n_ins ));
error = TT_Err_Too_Many_Hints;
goto Fail;
@@ -325,7 +414,7 @@
if ( ( limit - p ) < n_ins )
{
- FT_TRACE0(( "TT_Load_Simple_Glyph: Instruction count mismatch!\n" ));
+ FT_TRACE0(( "TT_Load_Simple_Glyph: instruction count mismatch\n" ));
error = TT_Err_Too_Many_Hints;
goto Fail;
}
@@ -633,7 +722,13 @@
#ifdef TT_USE_BYTECODE_INTERPRETER
- n_ins = loader->glyph->control_len;
+ if ( loader->glyph->control_len > 0xFFFFL )
+ {
+ FT_TRACE1(( "TT_Hint_Glyph: too long instructions " ));
+ FT_TRACE1(( "(0x%lx byte) is truncated\n",
+ loader->glyph->control_len ));
+ }
+ n_ins = (FT_UInt)( loader->glyph->control_len );
#endif
origin = zone->cur[zone->n_points - 4].x;
@@ -680,6 +775,9 @@
FT_Bool debug;
FT_Error error;
+ FT_GlyphLoader gloader = loader->gloader;
+ FT_Outline current_outline = gloader->current.outline;
+
error = TT_Set_CodeRange( loader->exec, tt_coderange_glyph,
loader->exec->glyphIns, n_ins );
@@ -695,6 +793,10 @@
error = TT_Run_Context( loader->exec, debug );
if ( error && loader->exec->pedantic_hinting )
return error;
+
+ /* store drop-out mode in bits 5-7; set bit 2 also as a marker */
+ current_outline.tags[0] |=
+ ( loader->exec->GS.scan_type << 5 ) | FT_CURVE_TAG_HAS_SCANMODE;
}
#endif
@@ -929,15 +1031,15 @@
/* This algorithm is a guess and works much better than the above. */
/* */
FT_Fixed mac_xscale = FT_SqrtFixed(
- FT_MulFix( subglyph->transform.xx,
- subglyph->transform.xx ) +
- FT_MulFix( subglyph->transform.xy,
- subglyph->transform.xy ) );
+ (FT_Int32)FT_MulFix( subglyph->transform.xx,
+ subglyph->transform.xx ) +
+ (FT_Int32)FT_MulFix( subglyph->transform.xy,
+ subglyph->transform.xy ) );
FT_Fixed mac_yscale = FT_SqrtFixed(
- FT_MulFix( subglyph->transform.yy,
- subglyph->transform.yy ) +
- FT_MulFix( subglyph->transform.yx,
- subglyph->transform.yx ) );
+ (FT_Int32)FT_MulFix( subglyph->transform.yy,
+ subglyph->transform.yy ) +
+ (FT_Int32)FT_MulFix( subglyph->transform.yx,
+ subglyph->transform.yx ) );
x = FT_MulFix( x, mac_xscale );
@@ -1030,7 +1132,7 @@
/* check it */
if ( n_ins > ((TT_Face)loader->face)->max_profile.maxSizeOfInstructions )
{
- FT_TRACE0(( "TT_Process_Composite_Glyph: Too many instructions (%d)\n",
+ FT_TRACE0(( "TT_Process_Composite_Glyph: too many instructions (%d)\n",
n_ins ));
return TT_Err_Too_Many_Hints;
@@ -1053,8 +1155,7 @@
/* Some points are likely touched during execution of */
/* instructions on components. So let's untouch them. */
for ( i = start_point; i < loader->zone.n_points; i++ )
- loader->zone.tags[i] &= ~( FT_CURVE_TAG_TOUCH_X |
- FT_CURVE_TAG_TOUCH_Y );
+ loader->zone.tags[i] &= ~FT_CURVE_TAG_TOUCH_BOTH;
loader->zone.n_points += 4;
@@ -1090,9 +1191,10 @@
static FT_Error
load_truetype_glyph( TT_Loader loader,
FT_UInt glyph_index,
- FT_UInt recurse_count )
+ FT_UInt recurse_count,
+ FT_Bool header_only )
{
- FT_Error error;
+ FT_Error error = TT_Err_Ok;
FT_Fixed x_scale, y_scale;
FT_ULong offset;
TT_Face face = (TT_Face)loader->face;
@@ -1139,75 +1241,7 @@
y_scale = 0x10000L;
}
- /* get metrics, horizontal and vertical */
- {
- FT_Short left_bearing = 0, top_bearing = 0;
- FT_UShort advance_width = 0, advance_height = 0;
-
-
- TT_Get_HMetrics( face, glyph_index,
- (FT_Bool)!( loader->load_flags &
- FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
- &left_bearing,
- &advance_width );
- TT_Get_VMetrics( face, glyph_index,
- (FT_Bool)!( loader->load_flags &
- FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
- &top_bearing,
- &advance_height );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* If this is an incrementally loaded font see if there are */
- /* overriding metrics for this glyph. */
- if ( face->root.internal->incremental_interface &&
- face->root.internal->incremental_interface->funcs->get_glyph_metrics )
- {
- FT_Incremental_MetricsRec metrics;
-
-
- metrics.bearing_x = left_bearing;
- metrics.bearing_y = 0;
- metrics.advance = advance_width;
- error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
- face->root.internal->incremental_interface->object,
- glyph_index, FALSE, &metrics );
- if ( error )
- goto Exit;
- left_bearing = (FT_Short)metrics.bearing_x;
- advance_width = (FT_UShort)metrics.advance;
-
-#if 0
-
- /* GWW: Do I do the same for vertical metrics? */
- metrics.bearing_x = 0;
- metrics.bearing_y = top_bearing;
- metrics.advance = advance_height;
- error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
- face->root.internal->incremental_interface->object,
- glyph_index, TRUE, &metrics );
- if ( error )
- goto Exit;
- top_bearing = (FT_Short)metrics.bearing_y;
- advance_height = (FT_UShort)metrics.advance;
-
-#endif /* 0 */
-
- }
-
-#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;
- }
- }
+ tt_get_metrics( loader, glyph_index );
/* Set `offset' to the start of the glyph relative to the start of */
/* the `glyf' table, and `byte_len' to the length of the glyph in */
@@ -1245,9 +1279,15 @@
if ( loader->byte_len > 0 )
{
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ /* for the incremental interface, `glyf_offset' is always zero */
+ if ( !loader->glyf_offset &&
+ !face->root.internal->incremental_interface )
+#else
if ( !loader->glyf_offset )
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
- FT_TRACE2(( "no `glyf' table but non-zero `loca' entry!\n" ));
+ FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" ));
error = TT_Err_Invalid_Table;
goto Exit;
}
@@ -1260,9 +1300,9 @@
opened_frame = 1;
- /* read first glyph header */
+ /* read glyph header first */
error = face->read_glyph_header( loader );
- if ( error )
+ if ( error || header_only )
goto Exit;
}
@@ -1273,6 +1313,9 @@
loader->bbox.yMin = 0;
loader->bbox.yMax = 0;
+ if ( header_only )
+ goto Exit;
+
TT_LOADER_SET_PP( loader );
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -1388,8 +1431,11 @@
{
if ( subglyph->flags & ARGS_ARE_XY_VALUES )
{
- subglyph->arg1 += deltas[i].x;
- subglyph->arg2 += deltas[i].y;
+ /* XXX: overflow check for subglyph->{arg1,arg2}. */
+ /* deltas[i].{x,y} must be within signed 16-bit, */
+ /* but the restriction of summed delta is not clear */
+ subglyph->arg1 += (FT_Int16)deltas[i].x;
+ subglyph->arg2 += (FT_Int16)deltas[i].y;
}
}
@@ -1459,7 +1505,7 @@
num_base_points = gloader->base.outline.n_points;
error = load_truetype_glyph( loader, subglyph->index,
- recurse_count + 1 );
+ recurse_count + 1, FALSE );
if ( error )
goto Exit;
@@ -1579,17 +1625,35 @@
glyph->metrics.horiBearingY = bbox.yMax;
glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
- /* Now take care of vertical metrics. In the case where there is */
- /* no vertical information within the font (relatively common), make */
- /* up some metrics by `hand'... */
+ /* adjust advance width to the value contained in the hdmx table */
+ if ( !face->postscript.isFixedPitch &&
+ IS_HINTED( loader->load_flags ) )
+ {
+ FT_Byte* widthp;
+
+
+ widthp = tt_face_get_device_metrics( face,
+ size->root.metrics.x_ppem,
+ glyph_index );
+
+ if ( widthp )
+ glyph->metrics.horiAdvance = *widthp << 6;
+ }
+ /* set glyph dimensions */
+ glyph->metrics.width = bbox.xMax - bbox.xMin;
+ glyph->metrics.height = bbox.yMax - bbox.yMin;
+
+ /* Now take care of vertical metrics. In the case where there is */
+ /* no vertical information within the font (relatively common), */
+ /* create some metrics manually */
{
FT_Pos top; /* scaled vertical top side bearing */
FT_Pos advance; /* scaled vertical advance height */
/* Get the unscaled top bearing and advance height. */
- if ( face->vertical_info &&
+ if ( face->vertical_info &&
face->vertical.number_Of_VMetrics > 0 )
{
top = (FT_Short)FT_DivFix( loader->pp3.y - bbox.yMax,
@@ -1664,37 +1728,19 @@
/* scale the metrics */
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
{
- top = FT_MulFix( top, y_scale );
+ top = FT_MulFix( top, y_scale );
advance = FT_MulFix( advance, y_scale );
}
/* XXX: for now, we have no better algorithm for the lsb, but it */
/* should work fine. */
/* */
- glyph->metrics.vertBearingX = ( bbox.xMin - bbox.xMax ) / 2;
+ glyph->metrics.vertBearingX = glyph->metrics.horiBearingX -
+ glyph->metrics.horiAdvance / 2;
glyph->metrics.vertBearingY = top;
glyph->metrics.vertAdvance = advance;
}
- /* adjust advance width to the value contained in the hdmx table */
- if ( !face->postscript.isFixedPitch &&
- IS_HINTED( loader->load_flags ) )
- {
- FT_Byte* widthp;
-
-
- widthp = tt_face_get_device_metrics( face,
- size->root.metrics.x_ppem,
- glyph_index );
-
- if ( widthp )
- glyph->metrics.horiAdvance = *widthp << 6;
- }
-
- /* set glyph dimensions */
- glyph->metrics.width = bbox.xMax - bbox.xMin;
- glyph->metrics.height = bbox.yMax - bbox.yMin;
-
return 0;
}
@@ -1742,6 +1788,7 @@
glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6;
glyph->format = FT_GLYPH_FORMAT_BITMAP;
+
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{
glyph->bitmap_left = metrics.vertBearingX;
@@ -1764,7 +1811,8 @@
tt_loader_init( TT_Loader loader,
TT_Size size,
TT_GlyphSlot glyph,
- FT_Int32 load_flags )
+ FT_Int32 load_flags,
+ FT_Bool glyf_table_only )
{
TT_Face face;
FT_Stream stream;
@@ -1778,7 +1826,7 @@
#ifdef TT_USE_BYTECODE_INTERPRETER
/* load execution context */
- if ( IS_HINTED( load_flags ) )
+ if ( IS_HINTED( load_flags ) && !glyf_table_only )
{
TT_ExecContext exec;
FT_Bool grayscale;
@@ -1851,7 +1899,7 @@
loader->glyf_offset = 0;
else if ( error )
{
- FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" ));
+ FT_ERROR(( "tt_loader_init: could not access glyph table\n" ));
return error;
}
else
@@ -1859,6 +1907,7 @@
}
/* get face's glyph loader */
+ if ( !glyf_table_only )
{
FT_GlyphLoader gloader = glyph->internal->loader;
@@ -1930,7 +1979,25 @@
{
error = load_sbit_image( size, glyph, glyph_index, load_flags );
if ( !error )
+ {
+ FT_Face root = &face->root;
+
+
+ if ( FT_IS_SCALABLE( root ) )
+ {
+ /* for the bbox we need the header only */
+ (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );
+ (void)load_truetype_glyph( &loader, glyph_index, 0, TRUE );
+ glyph->linearHoriAdvance = loader.linear;
+ glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax -
+ loader.vadvance;
+ if ( face->postscript.isFixedPitch &&
+ ( load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 )
+ glyph->linearHoriAdvance = face->horizontal.advance_Width_Max;
+ }
+
return TT_Err_Ok;
+ }
}
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
@@ -1942,7 +2009,7 @@
if ( load_flags & FT_LOAD_SBITS_ONLY )
return TT_Err_Invalid_Argument;
- error = tt_loader_init( &loader, size, glyph, load_flags );
+ error = tt_loader_init( &loader, size, glyph, load_flags, FALSE );
if ( error )
return error;
@@ -1951,7 +2018,7 @@
glyph->outline.flags = 0;
/* main loading loop */
- error = load_truetype_glyph( &loader, glyph_index, 0 );
+ error = load_truetype_glyph( &loader, glyph_index, 0, FALSE );
if ( !error )
{
if ( glyph->format == FT_GLYPH_FORMAT_COMPOSITE )
@@ -1998,7 +2065,7 @@
break;
}
}
- else
+ else
glyph->outline.flags |= FT_OUTLINE_IGNORE_DROPOUTS;
}
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;
diff --git a/src/3rdparty/freetype/src/truetype/ttgxvar.h b/src/3rdparty/freetype/src/truetype/ttgxvar.h
index 706cb4d369..82dfc4431f 100644
--- a/src/3rdparty/freetype/src/truetype/ttgxvar.h
+++ b/src/3rdparty/freetype/src/truetype/ttgxvar.h
@@ -84,7 +84,7 @@ FT_BEGIN_HEADER
FT_Fixed* normalizedcoords;
FT_MM_Var* mmvar;
- FT_Int mmvar_len;
+ FT_Offset mmvar_len;
FT_Bool avar_checked;
GX_AVarSegment avar_segment;
diff --git a/src/3rdparty/freetype/src/truetype/ttinterp.c b/src/3rdparty/freetype/src/truetype/ttinterp.c
index 3be2502b1f..13aa9a27c4 100644
--- a/src/3rdparty/freetype/src/truetype/ttinterp.c
+++ b/src/3rdparty/freetype/src/truetype/ttinterp.c
@@ -791,9 +791,9 @@
/* allocate object */
if ( FT_NEW( exec ) )
- goto Exit;
+ goto Fail;
- /* initialize it */
+ /* initialize it; in case of error this deallocates `exec' too */
error = Init_Context( exec, memory );
if ( error )
goto Fail;
@@ -802,11 +802,10 @@
driver->context = exec;
}
- Exit:
return driver->context;
Fail:
- return 0;
+ return NULL;
}
@@ -2195,7 +2194,7 @@
FT_ASSERT( !CUR.face->unpatented_hinting );
#endif
- return TT_DotFix14( dx, dy,
+ return TT_DotFix14( (FT_UInt32)dx, (FT_UInt32)dy,
CUR.GS.projVector.x,
CUR.GS.projVector.y );
}
@@ -2221,7 +2220,7 @@
Dual_Project( EXEC_OP_ FT_Pos dx,
FT_Pos dy )
{
- return TT_DotFix14( dx, dy,
+ return TT_DotFix14( (FT_UInt32)dx, (FT_UInt32)dy,
CUR.GS.dualVector.x,
CUR.GS.dualVector.y );
}
@@ -4291,13 +4290,21 @@
CUR.numFDefs++;
}
+ /* Although FDEF takes unsigned 32-bit integer, */
+ /* func # must be within unsigned 16-bit integer */
+ if ( n > 0xFFFFU )
+ {
+ CUR.error = TT_Err_Too_Many_Function_Defs;
+ return;
+ }
+
rec->range = CUR.curRange;
- rec->opc = n;
+ rec->opc = (FT_UInt16)n;
rec->start = CUR.IP + 1;
rec->active = TRUE;
if ( n > CUR.maxFunc )
- CUR.maxFunc = n;
+ CUR.maxFunc = (FT_UInt16)n;
/* Now skip the whole function definition. */
/* We don't allow nested IDEFS & FDEFs. */
@@ -4554,13 +4561,20 @@
CUR.numIDefs++;
}
- def->opc = args[0];
+ /* opcode must be unsigned 8-bit integer */
+ if ( 0 > args[0] || args[0] > 0x00FF )
+ {
+ CUR.error = TT_Err_Too_Many_Instruction_Defs;
+ return;
+ }
+
+ def->opc = (FT_Byte)args[0];
def->start = CUR.IP+1;
def->range = CUR.curRange;
def->active = TRUE;
if ( (FT_ULong)args[0] > CUR.maxIns )
- CUR.maxIns = args[0];
+ CUR.maxIns = (FT_Byte)args[0];
/* Now skip the whole function definition. */
/* We don't allow nested IDEFs & FDEFs. */
@@ -5528,20 +5542,20 @@
{
if ( CUR.GS.both_x_axis )
{
- dx = TT_MulFix14( args[0], 0x4000 );
+ dx = TT_MulFix14( (FT_UInt32)args[0], 0x4000 );
dy = 0;
}
else
{
dx = 0;
- dy = TT_MulFix14( args[0], 0x4000 );
+ dy = TT_MulFix14( (FT_UInt32)args[0], 0x4000 );
}
}
else
#endif
{
- dx = TT_MulFix14( args[0], CUR.GS.freeVector.x );
- dy = TT_MulFix14( args[0], CUR.GS.freeVector.y );
+ dx = TT_MulFix14( (FT_UInt32)args[0], CUR.GS.freeVector.x );
+ dy = TT_MulFix14( (FT_UInt32)args[0], CUR.GS.freeVector.y );
}
while ( CUR.GS.loop > 0 )
@@ -5707,8 +5721,8 @@
if ( CUR.GS.gep0 == 0 ) /* If in twilight zone */
{
- CUR.zp0.org[point].x = TT_MulFix14( distance, CUR.GS.freeVector.x );
- CUR.zp0.org[point].y = TT_MulFix14( distance, CUR.GS.freeVector.y ),
+ CUR.zp0.org[point].x = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.x );
+ CUR.zp0.org[point].y = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.y ),
CUR.zp0.cur[point] = CUR.zp0.org[point];
}
@@ -5895,10 +5909,12 @@
if ( CUR.GS.gep1 == 0 )
{
CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x +
- TT_MulFix14( cvt_dist, CUR.GS.freeVector.x );
+ TT_MulFix14( (FT_UInt32)cvt_dist,
+ CUR.GS.freeVector.x );
CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y +
- TT_MulFix14( cvt_dist, CUR.GS.freeVector.y );
+ TT_MulFix14( (FT_UInt32)cvt_dist,
+ CUR.GS.freeVector.y );
CUR.zp1.cur[point] = CUR.zp0.cur[point];
}
diff --git a/src/3rdparty/freetype/src/truetype/ttobjs.c b/src/3rdparty/freetype/src/truetype/ttobjs.c
index 2649a670dd..11d662d2d4 100644
--- a/src/3rdparty/freetype/src/truetype/ttobjs.c
+++ b/src/3rdparty/freetype/src/truetype/ttobjs.c
@@ -18,9 +18,7 @@
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_IDS_H
#include FT_TRUETYPE_TAGS_H
#include FT_INTERNAL_SFNT_H
@@ -150,7 +148,9 @@
static FT_Bool
tt_check_trickyness( FT_String* name )
{
- static const char* const trick_names[] =
+#define TRICK_NAMES_MAX_CHARACTERS 16
+#define TRICK_NAMES_COUNT 7
+ static const char trick_names[TRICK_NAMES_COUNT][TRICK_NAMES_MAX_CHARACTERS+1] =
{
"DFKaiSho-SB", /* dfkaisb.ttf */
"DFKaiShu",
@@ -159,7 +159,6 @@
"MingLiU", /* mingliu.ttf & mingliu.ttc */
"PMingLiU", /* mingliu.ttc */
"MingLi43", /* mingli.ttf */
- NULL
};
int nn;
@@ -169,7 +168,7 @@
/* Note that we only check the face name at the moment; it might */
/* be worth to do more checks for a few special cases. */
- for ( nn = 0; trick_names[nn] != NULL; nn++ )
+ for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ )
if ( ft_strstr( name, trick_names[nn] ) )
return TRUE;
@@ -612,18 +611,15 @@
/* Set default metrics */
{
- FT_Size_Metrics* metrics = &size->metrics;
- TT_Size_Metrics* metrics2 = &size->ttmetrics;
+ TT_Size_Metrics* metrics = &size->ttmetrics;
- metrics->x_ppem = 0;
- metrics->y_ppem = 0;
- metrics2->rotated = FALSE;
- metrics2->stretched = FALSE;
+ metrics->rotated = FALSE;
+ metrics->stretched = FALSE;
/* set default compensation (all 0) */
for ( i = 0; i < 4; i++ )
- metrics2->compensations[i] = 0;
+ metrics->compensations[i] = 0;
}
/* allocate function defs, instruction defs, cvt, and storage area */
diff --git a/src/3rdparty/freetype/src/truetype/ttobjs.h b/src/3rdparty/freetype/src/truetype/ttobjs.h
index d4b82285e5..30c8669cb2 100644
--- a/src/3rdparty/freetype/src/truetype/ttobjs.h
+++ b/src/3rdparty/freetype/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
/* */
/* Objects manager (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -196,43 +196,11 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
- /* Subglyph loading record. Used to load composite components. */
- /* */
- typedef struct TT_SubglyphRec_
- {
- FT_Long index; /* subglyph index; initialized with -1 */
- FT_Bool is_scaled; /* is the subglyph scaled? */
- FT_Bool is_hinted; /* should it be hinted? */
- FT_Bool preserve_pps; /* preserve phantom points? */
-
- FT_Long file_offset;
-
- FT_BBox bbox;
- FT_Pos left_bearing;
- FT_Pos advance;
-
- TT_GlyphZoneRec zone;
-
- FT_Long arg1; /* first argument */
- FT_Long arg2; /* second argument */
-
- FT_UShort element_flag; /* current load element flag */
-
- TT_Transform transform; /* transformation matrix */
-
- FT_Vector pp1, pp2; /* phantom points (horizontal) */
- FT_Vector pp3, pp4; /* phantom points (vertical) */
-
- } TT_SubGlyphRec, *TT_SubGlyph_Stack;
-
-
- /*************************************************************************/
- /* */
/* A note regarding non-squared pixels: */
/* */
/* (This text will probably go into some docs at some time; for now, it */
- /* is kept here to explain some definitions in the TIns_Metrics */
- /* record). */
+ /* is kept here to explain some definitions in the TT_Size_Metrics */
+ /* record). */
/* */
/* The CVT is a one-dimensional array containing values that control */
/* certain important characteristics in a font, like the height of all */
diff --git a/src/3rdparty/freetype/src/truetype/ttpic.c b/src/3rdparty/freetype/src/truetype/ttpic.c
new file mode 100644
index 0000000000..27ec4a1d5e
--- /dev/null
+++ b/src/3rdparty/freetype/src/truetype/ttpic.c
@@ -0,0 +1,79 @@
+/***************************************************************************/
+/* */
+/* ttpic.c */
+/* */
+/* The FreeType position independent code services for truetype module. */
+/* */
+/* Copyright 2009 by */
+/* Oran Agra and Mickey Gabel. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_INTERNAL_OBJECTS_H
+#include "ttpic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+ /* forward declaration of PIC init functions from ttdriver.c */
+ FT_Error FT_Create_Class_tt_services( FT_Library, FT_ServiceDescRec**);
+ void FT_Destroy_Class_tt_services( FT_Library, FT_ServiceDescRec*);
+ void FT_Init_Class_tt_service_gx_multi_masters(FT_Service_MultiMastersRec*);
+ void FT_Init_Class_tt_service_truetype_glyf(FT_Service_TTGlyfRec*);
+
+ void
+ tt_driver_class_pic_free( FT_Library library )
+ {
+ FT_PIC_Container* pic_container = &library->pic_container;
+ FT_Memory memory = library->memory;
+ if ( pic_container->truetype )
+ {
+ TTModulePIC* container = (TTModulePIC*)pic_container->truetype;
+ if(container->tt_services)
+ FT_Destroy_Class_tt_services(library, container->tt_services);
+ container->tt_services = NULL;
+ FT_FREE( container );
+ pic_container->truetype = NULL;
+ }
+ }
+
+ FT_Error
+ 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;
+
+ /* allocate pointer, clear and set global container pointer */
+ if ( FT_ALLOC ( container, sizeof ( *container ) ) )
+ return error;
+ FT_MEM_SET( container, 0, sizeof(*container) );
+ pic_container->truetype = container;
+
+ /* initialize pointer table - this is how the module usually expects this data */
+ error = FT_Create_Class_tt_services(library, &container->tt_services);
+ if(error)
+ goto Exit;
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ FT_Init_Class_tt_service_gx_multi_masters(&container->tt_service_gx_multi_masters);
+#endif
+ FT_Init_Class_tt_service_truetype_glyf(&container->tt_service_truetype_glyf);
+Exit:
+ if(error)
+ tt_driver_class_pic_free(library);
+ return error;
+ }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/src/3rdparty/freetype/src/truetype/ttpic.h b/src/3rdparty/freetype/src/truetype/ttpic.h
new file mode 100644
index 0000000000..84de0fee9e
--- /dev/null
+++ b/src/3rdparty/freetype/src/truetype/ttpic.h
@@ -0,0 +1,59 @@
+/***************************************************************************/
+/* */
+/* ttpic.h */
+/* */
+/* The FreeType position independent code services for truetype module. */
+/* */
+/* Copyright 2009 by */
+/* Oran Agra and Mickey Gabel. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef __TTPIC_H__
+#define __TTPIC_H__
+
+
+FT_BEGIN_HEADER
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_TT_SERVICES_GET tt_services
+#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters
+#define FT_TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include FT_MULTIPLE_MASTERS_H
+#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include FT_SERVICE_TRUETYPE_GLYF_H
+
+ typedef struct TTModulePIC_
+ {
+ FT_ServiceDescRec* tt_services;
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ FT_Service_MultiMastersRec tt_service_gx_multi_masters;
+#endif
+ FT_Service_TTGlyfRec tt_service_truetype_glyf;
+ } TTModulePIC;
+
+#define GET_PIC(lib) ((TTModulePIC*)((lib)->pic_container.truetype))
+#define FT_TT_SERVICES_GET (GET_PIC(library)->tt_services)
+#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET (GET_PIC(library)->tt_service_gx_multi_masters)
+#define FT_TT_SERVICE_TRUETYPE_GLYF_GET (GET_PIC(library)->tt_service_truetype_glyf)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __TTPIC_H__ */
+
+
+/* END */
diff --git a/src/3rdparty/freetype/src/truetype/ttpload.c b/src/3rdparty/freetype/src/truetype/ttpload.c
index f5d985eb48..a311b03c00 100644
--- a/src/3rdparty/freetype/src/truetype/ttpload.c
+++ b/src/3rdparty/freetype/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
/* */
/* TrueType-specific tables loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -58,7 +58,6 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
-
FT_LOCAL_DEF( FT_Error )
tt_face_load_loca( TT_Face face,
FT_Stream stream )
@@ -92,11 +91,11 @@
if ( table_len >= 0x40000L )
{
- FT_TRACE2(( "table too large!\n" ));
+ FT_TRACE2(( "table too large\n" ));
error = TT_Err_Invalid_Table;
goto Exit;
}
- face->num_locations = (FT_UInt)( table_len >> shift );
+ face->num_locations = table_len >> shift;
}
else
{
@@ -104,20 +103,20 @@
if ( table_len >= 0x20000L )
{
- FT_TRACE2(( "table too large!\n" ));
+ FT_TRACE2(( "table too large\n" ));
error = TT_Err_Invalid_Table;
goto Exit;
}
- face->num_locations = (FT_UInt)( table_len >> shift );
+ face->num_locations = table_len >> shift;
}
- if ( face->num_locations != (FT_UInt)face->root.num_glyphs )
+ if ( face->num_locations != (FT_ULong)face->root.num_glyphs )
{
FT_TRACE2(( "glyph count mismatch! loca: %d, maxp: %d\n",
face->num_locations, face->root.num_glyphs ));
/* we only handle the case where `maxp' gives a larger value */
- if ( face->num_locations < (FT_UInt)face->root.num_glyphs )
+ if ( face->num_locations < (FT_ULong)face->root.num_glyphs )
{
FT_Long new_loca_len = (FT_Long)face->root.num_glyphs << shift;
@@ -140,7 +139,7 @@
if ( new_loca_len <= dist )
{
- face->num_locations = (FT_Long)face->root.num_glyphs;
+ face->num_locations = face->root.num_glyphs;
table_len = new_loca_len;
FT_TRACE2(( "adjusting num_locations to %d\n",
@@ -204,12 +203,11 @@
}
}
- /* It isn't mentioned explicitly that the `loca' table must be */
- /* ordered, but implicitly it refers to the length of an entry */
- /* as the difference between the current and the next position. */
- /* Anyway, there do exist (malformed) fonts which don't obey */
- /* this rule, so we are only able to provide an upper bound for */
- /* the size. */
+ /* The `loca' table must be ordered; it refers to the length of */
+ /* an entry as the difference between the current and the next */
+ /* position. However, there do exist (malformed) fonts which */
+ /* don't obey this rule, so we are only able to provide an */
+ /* upper bound for the size. */
/* */
/* We get (intentionally) a wrong, non-zero result in case the */
/* `glyf' table is missing. */
@@ -267,7 +265,7 @@
error = face->goto_table( face, TTAG_cvt, stream, &table_len );
if ( error )
{
- FT_TRACE2(( "is missing!\n" ));
+ FT_TRACE2(( "is missing\n" ));
face->cvt_size = 0;
face->cvt = NULL;
@@ -352,7 +350,7 @@
face->font_program_size = 0;
error = TT_Err_Ok;
- FT_TRACE2(( "is missing!\n" ));
+ FT_TRACE2(( "is missing\n" ));
}
else
{
@@ -413,7 +411,7 @@
face->cvt_program_size = 0;
error = TT_Err_Ok;
- FT_TRACE2(( "is missing!\n" ));
+ FT_TRACE2(( "is missing\n" ));
}
else
{
@@ -534,10 +532,10 @@
tt_face_free_hdmx( TT_Face face )
{
FT_Stream stream = face->root.stream;
- FT_Memory memory = stream ? stream->memory : NULL;
+ FT_Memory memory = stream->memory;
+
- if ( face->hdmx_record_sizes )
- FT_FREE( face->hdmx_record_sizes );
+ FT_FREE( face->hdmx_record_sizes );
FT_FRAME_RELEASE( face->hdmx_table );
}