summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/cff
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/cff')
-rw-r--r--src/3rdparty/freetype/src/cff/Jamfile2
-rw-r--r--src/3rdparty/freetype/src/cff/cff.c1
-rw-r--r--src/3rdparty/freetype/src/cff/cffcmap.c17
-rw-r--r--src/3rdparty/freetype/src/cff/cffcmap.h6
-rw-r--r--src/3rdparty/freetype/src/cff/cffdrivr.c121
-rw-r--r--src/3rdparty/freetype/src/cff/cffdrivr.h3
-rw-r--r--src/3rdparty/freetype/src/cff/cffgload.c261
-rw-r--r--src/3rdparty/freetype/src/cff/cffgload.h16
-rw-r--r--src/3rdparty/freetype/src/cff/cffload.c70
-rw-r--r--src/3rdparty/freetype/src/cff/cffload.h3
-rw-r--r--src/3rdparty/freetype/src/cff/cffobjs.c61
-rw-r--r--src/3rdparty/freetype/src/cff/cffparse.c161
-rw-r--r--src/3rdparty/freetype/src/cff/cffparse.h35
-rw-r--r--src/3rdparty/freetype/src/cff/cffpic.c99
-rw-r--r--src/3rdparty/freetype/src/cff/cffpic.h80
-rw-r--r--src/3rdparty/freetype/src/cff/cfftypes.h2
16 files changed, 688 insertions, 250 deletions
diff --git a/src/3rdparty/freetype/src/cff/Jamfile b/src/3rdparty/freetype/src/cff/Jamfile
index 6d0bb1b867..6705d3cfdb 100644
--- a/src/3rdparty/freetype/src/cff/Jamfile
+++ b/src/3rdparty/freetype/src/cff/Jamfile
@@ -16,7 +16,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) cff ;
if $(FT2_MULTI)
{
- _sources = cffdrivr cffgload cffload cffobjs cffparse cffcmap ;
+ _sources = cffdrivr cffgload cffload cffobjs cffparse cffcmap cffpic ;
}
else
{
diff --git a/src/3rdparty/freetype/src/cff/cff.c b/src/3rdparty/freetype/src/cff/cff.c
index e6d8954c9a..fccfd442f5 100644
--- a/src/3rdparty/freetype/src/cff/cff.c
+++ b/src/3rdparty/freetype/src/cff/cff.c
@@ -19,6 +19,7 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <ft2build.h>
+#include "cffpic.c"
#include "cffdrivr.c"
#include "cffparse.c"
#include "cffload.c"
diff --git a/src/3rdparty/freetype/src/cff/cffcmap.c b/src/3rdparty/freetype/src/cff/cffcmap.c
index 578d048bed..46d603e3a8 100644
--- a/src/3rdparty/freetype/src/cff/cffcmap.c
+++ b/src/3rdparty/freetype/src/cff/cffcmap.c
@@ -65,7 +65,7 @@
}
- FT_CALLBACK_DEF( FT_UInt )
+ FT_CALLBACK_DEF( FT_UInt32 )
cff_cmap_encoding_char_next( CFF_CMapStd cmap,
FT_UInt32 *pchar_code )
{
@@ -99,9 +99,7 @@
}
- FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
- cff_cmap_encoding_class_rec =
- {
+ FT_DEFINE_CMAP_CLASS(cff_cmap_encoding_class_rec,
sizeof ( CFF_CMapStdRec ),
(FT_CMap_InitFunc) cff_cmap_encoding_init,
@@ -110,7 +108,7 @@
(FT_CMap_CharNextFunc) cff_cmap_encoding_char_next,
NULL, NULL, NULL, NULL, NULL
- };
+ )
/*************************************************************************/
@@ -194,7 +192,7 @@
}
- FT_CALLBACK_DEF( FT_UInt )
+ FT_CALLBACK_DEF( FT_UInt32 )
cff_cmap_unicode_char_next( PS_Unicodes unicodes,
FT_UInt32 *pchar_code )
{
@@ -207,9 +205,7 @@
}
- FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
- cff_cmap_unicode_class_rec =
- {
+ FT_DEFINE_CMAP_CLASS(cff_cmap_unicode_class_rec,
sizeof ( PS_UnicodesRec ),
(FT_CMap_InitFunc) cff_cmap_unicode_init,
@@ -218,7 +214,6 @@
(FT_CMap_CharNextFunc) cff_cmap_unicode_char_next,
NULL, NULL, NULL, NULL, NULL
- };
-
+ )
/* END */
diff --git a/src/3rdparty/freetype/src/cff/cffcmap.h b/src/3rdparty/freetype/src/cff/cffcmap.h
index 3809b85611..3f7f67bbe0 100644
--- a/src/3rdparty/freetype/src/cff/cffcmap.h
+++ b/src/3rdparty/freetype/src/cff/cffcmap.h
@@ -43,8 +43,7 @@ FT_BEGIN_HEADER
} CFF_CMapStdRec;
- FT_CALLBACK_TABLE const FT_CMap_ClassRec
- cff_cmap_encoding_class_rec;
+ FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec)
/*************************************************************************/
@@ -57,8 +56,7 @@ FT_BEGIN_HEADER
/* unicode (synthetic) cmaps */
- FT_CALLBACK_TABLE const FT_CMap_ClassRec
- cff_cmap_unicode_class_rec;
+ FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec)
FT_END_HEADER
diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.c b/src/3rdparty/freetype/src/cff/cffdrivr.c
index 3dd86f2aa8..dad0b65d8b 100644
--- a/src/3rdparty/freetype/src/cff/cffdrivr.c
+++ b/src/3rdparty/freetype/src/cff/cffdrivr.c
@@ -21,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_CID_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
#include FT_SERVICE_POSTSCRIPT_INFO_H
@@ -32,8 +31,10 @@
#include "cffgload.h"
#include "cffload.h"
#include "cffcmap.h"
+#include "cffparse.h"
#include "cfferrs.h"
+#include "cffpic.h"
#include FT_SERVICE_XFREE86_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
@@ -199,7 +200,7 @@
FT_GlyphSlot slot = face->glyph;
- flags |= FT_LOAD_ADVANCE_ONLY;
+ flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
for ( nn = 0; nn < count; nn++ )
{
@@ -238,10 +239,10 @@
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
if ( !psnames )
{
- FT_ERROR(( "cff_get_glyph_name:" ));
- FT_ERROR(( " cannot get glyph name from CFF & CEF fonts\n" ));
- FT_ERROR(( " " ));
- FT_ERROR(( " without the `PSNames' module\n" ));
+ FT_ERROR(( "cff_get_glyph_name:"
+ " cannot get glyph name from CFF & CEF fonts\n"
+ " "
+ " without the `PSNames' module\n" ));
error = CFF_Err_Unknown_File_Format;
goto Exit;
}
@@ -309,11 +310,10 @@
}
- static const FT_Service_GlyphDictRec cff_service_glyph_dict =
- {
+ FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict,
(FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
- (FT_GlyphDict_NameIndexFunc)cff_get_name_index,
- };
+ (FT_GlyphDict_NameIndexFunc)cff_get_name_index
+ )
/*
@@ -378,13 +378,12 @@
}
- static const FT_Service_PsInfoRec cff_service_ps_info =
- {
+ FT_DEFINE_SERVICE_PSINFOREC(cff_service_ps_info,
(PS_GetFontInfoFunc) cff_ps_get_font_info,
(PS_GetFontExtraFunc) NULL,
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
(PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */
- };
+ )
/*
@@ -402,10 +401,9 @@
}
- static const FT_Service_PsFontNameRec cff_service_ps_name =
- {
+ FT_DEFINE_SERVICE_PSFONTNAMEREC(cff_service_ps_name,
(FT_PsName_GetFunc)cff_get_ps_name
- };
+ )
/*
@@ -424,16 +422,16 @@
{
FT_CMap cmap = FT_CMAP( charmap );
FT_Error error = CFF_Err_Ok;
+ FT_Face face = FT_CMAP_FACE( cmap );
+ FT_Library library = FT_FACE_LIBRARY( face );
cmap_info->language = 0;
cmap_info->format = 0;
- if ( cmap->clazz != &cff_cmap_encoding_class_rec &&
- cmap->clazz != &cff_cmap_unicode_class_rec )
+ if ( cmap->clazz != &FT_CFF_CMAP_ENCODING_CLASS_REC_GET &&
+ cmap->clazz != &FT_CFF_CMAP_UNICODE_CLASS_REC_GET )
{
- FT_Face face = FT_CMAP_FACE( cmap );
- FT_Library library = FT_FACE_LIBRARY( face );
FT_Module sfnt = FT_Get_Module( library, "sfnt" );
FT_Service_TTCMaps service =
(FT_Service_TTCMaps)ft_module_get_service( sfnt,
@@ -448,10 +446,9 @@
}
- static const FT_Service_TTCMapsRec cff_service_get_cmap_info =
- {
+ FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info,
(TT_CMap_Info_GetFunc)cff_get_cmap_info
- };
+ )
/*
@@ -498,8 +495,19 @@
*ordering = cff->ordering;
}
+ /*
+ * XXX: According to Adobe TechNote #5176, the supplement in CFF
+ * can be a real number. We truncate it to fit public API
+ * since freetype-2.3.6.
+ */
if ( supplement )
- *supplement = dict->cid_supplement;
+ {
+ if ( dict->cid_supplement < FT_INT_MIN ||
+ dict->cid_supplement > FT_INT_MAX )
+ FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
+ dict->cid_supplement ));
+ *supplement = (FT_Int)dict->cid_supplement;
+ }
}
Fail:
@@ -570,12 +578,11 @@
}
- static const FT_Service_CIDRec cff_service_cid_info =
- {
+ FT_DEFINE_SERVICE_CIDREC(cff_service_cid_info,
(FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
(FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,
(FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index
- };
+ )
/*************************************************************************/
@@ -589,20 +596,24 @@
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
-
- static const FT_ServiceDescRec cff_services[] =
- {
- { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF },
- { FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info },
- { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name },
#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
- { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict },
+ FT_DEFINE_SERVICEDESCREC6(cff_services,
+ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF,
+ FT_SERVICE_ID_POSTSCRIPT_INFO, &FT_CFF_SERVICE_PS_INFO_GET,
+ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET,
+ FT_SERVICE_ID_GLYPH_DICT, &FT_CFF_SERVICE_GLYPH_DICT_GET,
+ FT_SERVICE_ID_TT_CMAP, &FT_CFF_SERVICE_GET_CMAP_INFO_GET,
+ FT_SERVICE_ID_CID, &FT_CFF_SERVICE_CID_INFO_GET
+ )
+#else
+ FT_DEFINE_SERVICEDESCREC5(cff_services,
+ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF,
+ FT_SERVICE_ID_POSTSCRIPT_INFO, &FT_CFF_SERVICE_PS_INFO_GET,
+ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET,
+ FT_SERVICE_ID_TT_CMAP, &FT_CFF_SERVICE_GET_CMAP_INFO_GET,
+ FT_SERVICE_ID_CID, &FT_CFF_SERVICE_CID_INFO_GET
+ )
#endif
- { FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info },
- { FT_SERVICE_ID_CID, &cff_service_cid_info },
- { NULL, NULL }
- };
-
FT_CALLBACK_DEF( FT_Module_Interface )
cff_get_interface( FT_Module driver, /* CFF_Driver */
@@ -612,10 +623,13 @@
FT_Module_Interface result;
- result = ft_service_list_lookup( cff_services, module_interface );
+ result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface );
if ( result != NULL )
return result;
+ if ( !driver )
+ return NULL;
+
/* we pass our request to the `sfnt' module */
sfnt = FT_Get_Module( driver->library, "sfnt" );
@@ -625,11 +639,13 @@
/* The FT_DriverInterface structure is defined in ftdriver.h. */
- FT_CALLBACK_TABLE_DEF
- const FT_Driver_ClassRec cff_driver_class =
- {
- /* begin with the FT_Module_Class fields */
- {
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+#define CFF_SIZE_SELECT cff_size_select
+#else
+#define CFF_SIZE_SELECT 0
+#endif
+
+ FT_DEFINE_DRIVER(cff_driver_class,
FT_MODULE_FONT_DRIVER |
FT_MODULE_DRIVER_SCALABLE |
FT_MODULE_DRIVER_HAS_HINTER,
@@ -644,7 +660,6 @@
cff_driver_init,
cff_driver_done,
cff_get_interface,
- },
/* now the specific driver fields */
sizeof( TT_FaceRec ),
@@ -658,10 +673,8 @@
cff_slot_init,
cff_slot_done,
-#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,
@@ -671,12 +684,8 @@
cff_size_request,
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
- cff_size_select
-#else
- 0 /* FT_Size_SelectFunc */
-#endif
- };
+ CFF_SIZE_SELECT
+ )
/* END */
diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.h b/src/3rdparty/freetype/src/cff/cffdrivr.h
index 553848c0a9..50e8138701 100644
--- a/src/3rdparty/freetype/src/cff/cffdrivr.h
+++ b/src/3rdparty/freetype/src/cff/cffdrivr.h
@@ -27,8 +27,7 @@
FT_BEGIN_HEADER
- FT_CALLBACK_TABLE
- const FT_Driver_ClassRec cff_driver_class;
+ FT_DECLARE_DRIVER( cff_driver_class )
FT_END_HEADER
diff --git a/src/3rdparty/freetype/src/cff/cffgload.c b/src/3rdparty/freetype/src/cff/cffgload.c
index 2718a277b4..9330c05882 100644
--- a/src/3rdparty/freetype/src/cff/cffgload.c
+++ b/src/3rdparty/freetype/src/cff/cffgload.c
@@ -4,7 +4,8 @@
/* */
/* OpenType Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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, */
@@ -18,11 +19,9 @@
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_SFNT_H
#include FT_OUTLINE_H
-#include FT_TRUETYPE_TAGS_H
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
#include "cffobjs.h"
@@ -115,6 +114,9 @@
cff_op_closepath,
cff_op_callothersubr,
cff_op_pop,
+ cff_op_seac,
+ cff_op_sbw,
+ cff_op_setcurrentpoint,
/* do not remove */
cff_op_max
@@ -203,7 +205,10 @@
2, /* hsbw */
0,
0,
- 0
+ 0,
+ 5, /* seac */
+ 4, /* sbw */
+ 2 /* setcurrentpoint */
};
@@ -321,17 +326,23 @@
/* subroutines. */
/* */
/* <Input> */
- /* num_subrs :: The number of glyph subroutines. */
+ /* in_charstring_type :: The `CharstringType' value of the top DICT */
+ /* dictionary. */
+ /* */
+ /* num_subrs :: The number of glyph subroutines. */
/* */
/* <Return> */
/* The bias value. */
static FT_Int
- cff_compute_bias( FT_UInt num_subrs )
+ cff_compute_bias( FT_Int in_charstring_type,
+ FT_UInt num_subrs )
{
FT_Int result;
- if ( num_subrs < 1240 )
+ if ( in_charstring_type == 1 )
+ result = 0;
+ else if ( num_subrs < 1240 )
result = 107;
else if ( num_subrs < 33900U )
result = 1131;
@@ -382,9 +393,12 @@
cff_builder_init( &decoder->builder, face, size, slot, hinting );
/* initialize Type2 decoder */
+ decoder->cff = cff;
decoder->num_globals = cff->num_global_subrs;
decoder->globals = cff->global_subrs;
- decoder->globals_bias = cff_compute_bias( decoder->num_globals );
+ decoder->globals_bias = cff_compute_bias(
+ cff->top_font.font_dict.charstring_type,
+ decoder->num_globals );
decoder->hint_mode = hint_mode;
}
@@ -436,7 +450,9 @@
decoder->num_locals = sub->num_local_subrs;
decoder->locals = sub->local_subrs;
- decoder->locals_bias = cff_compute_bias( decoder->num_locals );
+ decoder->locals_bias = cff_compute_bias(
+ decoder->cff->top_font.font_dict.charstring_type,
+ decoder->num_locals );
decoder->glyph_width = sub->private_dict.default_width;
decoder->nominal_width = sub->private_dict.nominal_width;
@@ -474,8 +490,6 @@
point->x = x >> 16;
point->y = y >> 16;
*control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
-
- builder->last = *point;
}
outline->n_points++;
@@ -554,27 +568,24 @@
cff_builder_close_contour( CFF_Builder* builder )
{
FT_Outline* outline = builder->current;
+ FT_Int first;
if ( !outline )
return;
- /* XXXX: We must not include the last point in the path if it */
- /* is located on the first point. */
+ first = outline->n_contours <= 1
+ ? 0 : outline->contours[outline->n_contours - 2] + 1;
+
+ /* We must not include the last point in the path if it */
+ /* is located on the first point. */
if ( outline->n_points > 1 )
{
- FT_Int first = 0;
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
- if ( outline->n_contours > 1 )
- {
- first = outline->contours[outline->n_contours - 2] + 1;
- p1 = outline->points + first;
- }
-
/* `delete' last point only if it coincides with the first */
/* point and if it is not a control point (which can happen). */
if ( p1->x == p2->x && p1->y == p2->y )
@@ -583,8 +594,18 @@
}
if ( outline->n_contours > 0 )
- outline->contours[outline->n_contours - 1] =
- (short)( outline->n_points - 1 );
+ {
+ /* Don't add contours only consisting of one point, i.e., */
+ /* check whether begin point and last point are the same. */
+ if ( first == outline->n_points - 1 )
+ {
+ outline->n_contours--;
+ outline->n_points--;
+ }
+ else
+ outline->contours[outline->n_contours - 1] =
+ (short)( outline->n_points - 1 );
+ }
}
@@ -674,7 +695,7 @@
data.length = length;
face->root.internal->incremental_interface->funcs->free_glyph_data(
- face->root.internal->incremental_interface->object,&data );
+ face->root.internal->incremental_interface->object, &data );
}
else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -690,6 +711,7 @@
static FT_Error
cff_operator_seac( CFF_Decoder* decoder,
+ FT_Pos asb,
FT_Pos adx,
FT_Pos ady,
FT_Int bchar,
@@ -702,8 +724,18 @@
FT_Vector left_bearing, advance;
FT_Byte* charstring;
FT_ULong charstring_len;
+ FT_Pos glyph_width;
+ if ( decoder->seac )
+ {
+ FT_ERROR(( "cff_operator_seac: invalid nested seac\n" ));
+ return CFF_Err_Syntax_Error;
+ }
+
+ adx += decoder->builder.left_bearing.x;
+ ady += decoder->builder.left_bearing.y;
+
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts don't necessarily have valid charsets. */
/* They use the character code, not the glyph index, in this case. */
@@ -724,8 +756,8 @@
if ( bchar_index < 0 || achar_index < 0 )
{
- FT_ERROR(( "cff_operator_seac:" ));
- FT_ERROR(( " invalid seac character code arguments\n" ));
+ FT_ERROR(( "cff_operator_seac:"
+ " invalid seac character code arguments\n" ));
return CFF_Err_Syntax_Error;
}
@@ -774,8 +806,11 @@
&charstring, &charstring_len );
if ( !error )
{
+ /* the seac operator must not be nested */
+ decoder->seac = TRUE;
error = cff_decoder_parse_charstrings( decoder, charstring,
charstring_len );
+ decoder->seac = FALSE;
if ( error )
goto Exit;
@@ -783,16 +818,17 @@
cff_free_glyph_data( face, &charstring, charstring_len );
}
- /* Save the left bearing and width of the base character */
- /* as they will be erased by the next load. */
+ /* Save the left bearing, advance and glyph width of the base */
+ /* character as they will be erased by the next load. */
left_bearing = builder->left_bearing;
advance = builder->advance;
+ glyph_width = decoder->glyph_width;
builder->left_bearing.x = 0;
builder->left_bearing.y = 0;
- builder->pos_x = adx;
+ builder->pos_x = adx - asb;
builder->pos_y = ady;
/* Now load `achar' on top of the base outline. */
@@ -800,8 +836,11 @@
&charstring, &charstring_len );
if ( !error )
{
+ /* the seac operator must not be nested */
+ decoder->seac = TRUE;
error = cff_decoder_parse_charstrings( decoder, charstring,
charstring_len );
+ decoder->seac = FALSE;
if ( error )
goto Exit;
@@ -809,10 +848,11 @@
cff_free_glyph_data( face, &charstring, charstring_len );
}
- /* Restore the left side bearing and advance width */
- /* of the base character. */
+ /* Restore the left side bearing, advance and glyph width */
+ /* of the base character. */
builder->left_bearing = left_bearing;
builder->advance = advance;
+ decoder->glyph_width = glyph_width;
builder->pos_x = 0;
builder->pos_y = 0;
@@ -854,6 +894,8 @@
FT_Pos x, y;
FT_Fixed seed;
FT_Fixed* stack;
+ FT_Int charstring_type =
+ decoder->cff->top_font.font_dict.charstring_type;
T2_Hints_Funcs hinter;
@@ -863,9 +905,10 @@
decoder->read_width = 1;
/* compute random seed from stack address of parameter */
- seed = (FT_Fixed)(char*)&seed ^
- (FT_Fixed)(char*)&decoder ^
- (FT_Fixed)(char*)&charstring_base;
+ seed = (FT_Fixed)( ( (FT_PtrDist)(char*)&seed ^
+ (FT_PtrDist)(char*)&decoder ^
+ (FT_PtrDist)(char*)&charstring_base ) &
+ FT_ULONG_MAX ) ;
seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
if ( seed == 0 )
seed = 0x7384;
@@ -920,18 +963,18 @@
ip += 2;
}
else if ( v < 247 )
- val = (FT_Long)v - 139;
+ val = (FT_Int32)v - 139;
else if ( v < 251 )
{
if ( ip >= limit )
goto Syntax_Error;
- val = ( (FT_Long)v - 247 ) * 256 + *ip++ + 108;
+ val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108;
}
else if ( v < 255 )
{
if ( ip >= limit )
goto Syntax_Error;
- val = -( (FT_Long)v - 251 ) * 256 - *ip++ - 108;
+ val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108;
}
else
{
@@ -942,7 +985,8 @@
( (FT_Int32)ip[2] << 8 ) |
ip[3];
ip += 4;
- shift = 0;
+ if ( charstring_type == 2 )
+ shift = 0;
}
if ( decoder->top - stack >= CFF_MAX_OPERANDS )
goto Stack_Overflow;
@@ -1016,6 +1060,12 @@
case 0:
op = cff_op_dotsection;
break;
+ case 1: /* this is actually the Type1 vstem3 operator */
+ op = cff_op_vstem;
+ break;
+ case 2: /* this is actually the Type1 hstem3 operator */
+ op = cff_op_hstem;
+ break;
case 3:
op = cff_op_and;
break;
@@ -1025,6 +1075,12 @@
case 5:
op = cff_op_not;
break;
+ case 6:
+ op = cff_op_seac;
+ break;
+ case 7:
+ op = cff_op_sbw;
+ break;
case 8:
op = cff_op_store;
break;
@@ -1088,6 +1144,9 @@
case 30:
op = cff_op_roll;
break;
+ case 33:
+ op = cff_op_setcurrentpoint;
+ break;
case 34:
op = cff_op_hflex;
break;
@@ -1155,7 +1214,7 @@
op = cff_op_hvcurveto;
break;
default:
- ;
+ break;
}
if ( op == cff_op_unknown )
@@ -1870,6 +1929,21 @@
}
break;
+ case cff_op_seac:
+ FT_TRACE4(( " seac\n" ));
+
+ error = cff_operator_seac( decoder,
+ args[0], args[1], args[2],
+ (FT_Int)( args[3] >> 16 ),
+ (FT_Int)( args[4] >> 16 ) );
+
+ /* add current outline to the glyph slot */
+ FT_GlyphLoader_Add( builder->loader );
+
+ /* return now! */
+ FT_TRACE4(( "\n" ));
+ return error;
+
case cff_op_endchar:
FT_TRACE4(( " endchar\n" ));
@@ -1879,10 +1953,8 @@
/* Save glyph width so that the subglyphs don't overwrite it. */
FT_Pos glyph_width = decoder->glyph_width;
-
error = cff_operator_seac( decoder,
- args[-4],
- args[-3],
+ 0L, args[-4], args[-3],
(FT_Int)( args[-2] >> 16 ),
(FT_Int)( args[-1] >> 16 ) );
@@ -2090,7 +2162,7 @@
FT_TRACE4(( " dup\n" ));
args[1] = args[0];
- args++;
+ args += 2;
break;
case cff_op_put:
@@ -2101,7 +2173,7 @@
FT_TRACE4(( " put\n" ));
- if ( idx >= 0 && idx < decoder->len_buildchar )
+ if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
decoder->buildchar[idx] = val;
}
break;
@@ -2114,7 +2186,7 @@
FT_TRACE4(( " get\n" ));
- if ( idx >= 0 && idx < decoder->len_buildchar )
+ if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
val = decoder->buildchar[idx];
args[0] = val;
@@ -2154,10 +2226,42 @@
FT_TRACE4(( " hsbw (invalid op)\n" ));
- decoder->glyph_width = decoder->nominal_width +
- (args[1] >> 16);
- x = args[0];
- y = 0;
+ decoder->glyph_width = decoder->nominal_width + ( args[1] >> 16 );
+
+ decoder->builder.left_bearing.x = args[0];
+ decoder->builder.left_bearing.y = 0;
+
+ x = decoder->builder.pos_x + args[0];
+ y = decoder->builder.pos_y;
+ args = stack;
+ break;
+
+ case cff_op_sbw:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " sbw (invalid op)\n" ));
+
+ decoder->glyph_width = decoder->nominal_width + ( args[2] >> 16 );
+
+ decoder->builder.left_bearing.x = args[0];
+ decoder->builder.left_bearing.y = args[1];
+
+ x = decoder->builder.pos_x + args[0];
+ y = decoder->builder.pos_y + args[1];
+ args = stack;
+ break;
+
+ case cff_op_setcurrentpoint:
+ /* this is an invalid Type 2 operator; however, there */
+ /* exist fonts which are incorrectly converted from probably */
+ /* Type 1 to CFF, and some parsers seem to accept it */
+
+ FT_TRACE4(( " setcurrentpoint (invalid op)\n" ));
+
+ x = decoder->builder.pos_x + args[0];
+ y = decoder->builder.pos_y + args[1];
args = stack;
break;
@@ -2168,8 +2272,10 @@
FT_TRACE4(( " callothersubr (invalid op)\n" ));
- /* don't modify stack; handle the subr as `unknown' so that */
- /* following `pop' operands use the arguments on stack */
+ /* subsequent `pop' operands should add the arguments, */
+ /* this is the implementation described for `unknown' other */
+ /* subroutines in the Type1 spec. */
+ args -= 2 + ( args[-2] >> 16 );
break;
case cff_op_pop:
@@ -2241,8 +2347,8 @@
if ( idx >= decoder->num_locals )
{
- FT_ERROR(( "cff_decoder_parse_charstrings:" ));
- FT_ERROR(( " invalid local subr index\n" ));
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " invalid local subr index\n" ));
goto Syntax_Error;
}
@@ -2263,7 +2369,7 @@
if ( !zone->base || zone->limit == zone->base )
{
FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invoking empty subrs!\n" ));
+ " invoking empty subrs\n" ));
goto Syntax_Error;
}
@@ -2283,8 +2389,8 @@
if ( idx >= decoder->num_globals )
{
- FT_ERROR(( "cff_decoder_parse_charstrings:" ));
- FT_ERROR(( " invalid global subr index\n" ));
+ FT_ERROR(( "cff_decoder_parse_charstrings:"
+ " invalid global subr index\n" ));
goto Syntax_Error;
}
@@ -2305,7 +2411,7 @@
if ( !zone->base || zone->limit == zone->base )
{
FT_ERROR(( "cff_decoder_parse_charstrings:"
- " invoking empty subrs!\n" ));
+ " invoking empty subrs\n" ));
goto Syntax_Error;
}
@@ -2354,15 +2460,15 @@
return error;
Syntax_Error:
- FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error!\n" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" ));
return CFF_Err_Invalid_File_Format;
Stack_Underflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow!\n" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" ));
return CFF_Err_Too_Few_Arguments;
Stack_Overflow:
- FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!\n" ));
+ FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" ));
return CFF_Err_Stack_Overflow;
}
@@ -2565,8 +2671,8 @@
FT_Byte fd_index = cff_fd_select_get( &cff->fd_select,
glyph_index );
- FT_Int top_upm = cff->top_font.font_dict.units_per_em;
- FT_Int sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em;
+ FT_ULong top_upm = cff->top_font.font_dict.units_per_em;
+ FT_ULong sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em;
font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
@@ -2658,23 +2764,25 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
- if ( !error &&
- face->root.internal->incremental_interface &&
+ if ( !error &&
+ face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
FT_Incremental_MetricsRec metrics;
metrics.bearing_x = decoder.builder.left_bearing.x;
- metrics.bearing_y = decoder.builder.left_bearing.y;
+ metrics.bearing_y = 0;
metrics.advance = decoder.builder.advance.x;
+ metrics.advance_v = decoder.builder.advance.y;
+
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics );
+
decoder.builder.left_bearing.x = metrics.bearing_x;
- decoder.builder.left_bearing.y = metrics.bearing_y;
decoder.builder.advance.x = metrics.advance;
- decoder.builder.advance.y = 0;
+ decoder.builder.advance.y = metrics.advance_v;
}
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -2711,9 +2819,14 @@
glyph->root.linearHoriAdvance = decoder.glyph_width;
glyph->root.internal->glyph_transformed = 0;
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
has_vertical_info = FT_BOOL( face->vertical_info &&
face->vertical.number_Of_VMetrics > 0 &&
face->vertical.long_metrics );
+#else
+ has_vertical_info = FT_BOOL( face->vertical_info &&
+ face->vertical.number_Of_VMetrics > 0 );
+#endif
/* get the vertical metrics from the vtmx table if we have one */
if ( has_vertical_info )
@@ -2750,8 +2863,8 @@
glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
- /* apply the font matrix -- `xx' has already been normalized */
- if ( !( font_matrix.yy == 0x10000L &&
+ if ( !( font_matrix.xx == 0x10000L &&
+ font_matrix.yy == 0x10000L &&
font_matrix.xy == 0 &&
font_matrix.yx == 0 ) )
FT_Outline_Transform( &glyph->root.outline, &font_matrix );
@@ -2804,10 +2917,14 @@
metrics->horiBearingY = cbox.yMax;
if ( has_vertical_info )
- metrics->vertBearingX = -metrics->width / 2;
- else
- ft_synthesize_vertical_metrics( metrics,
- metrics->vertAdvance );
+ metrics->vertBearingX = metrics->horiBearingX -
+ metrics->horiAdvance / 2;
+ else
+ {
+ if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
+ ft_synthesize_vertical_metrics( metrics,
+ metrics->vertAdvance );
+ }
}
}
diff --git a/src/3rdparty/freetype/src/cff/cffgload.h b/src/3rdparty/freetype/src/cff/cffgload.h
index 667134e3b5..38937be5c1 100644
--- a/src/3rdparty/freetype/src/cff/cffgload.h
+++ b/src/3rdparty/freetype/src/cff/cffgload.h
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 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, */
@@ -28,8 +28,9 @@
FT_BEGIN_HEADER
-#define CFF_MAX_OPERANDS 48
-#define CFF_MAX_SUBRS_CALLS 32
+#define CFF_MAX_OPERANDS 48
+#define CFF_MAX_SUBRS_CALLS 32
+#define CFF_MAX_TRANS_ELEMENTS 32
/*************************************************************************/
@@ -53,8 +54,6 @@ FT_BEGIN_HEADER
/* */
/* current :: The current glyph outline. */
/* */
- /* last :: The last point position. */
- /* */
/* pos_x :: The horizontal translation (if composite glyph). */
/* */
/* pos_y :: The vertical translation (if composite glyph). */
@@ -88,8 +87,6 @@ FT_BEGIN_HEADER
FT_Outline* base;
FT_Outline* current;
- FT_Vector last;
-
FT_Pos pos_x;
FT_Pos pos_y;
@@ -141,8 +138,7 @@ FT_BEGIN_HEADER
FT_Bool read_width;
FT_Bool width_only;
FT_Int num_hints;
- FT_Fixed* buildchar;
- FT_Int len_buildchar;
+ FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
FT_UInt num_locals;
FT_UInt num_globals;
@@ -158,6 +154,8 @@ FT_BEGIN_HEADER
FT_Render_Mode hint_mode;
+ FT_Bool seac;
+
} CFF_Decoder;
diff --git a/src/3rdparty/freetype/src/cff/cffload.c b/src/3rdparty/freetype/src/cff/cffload.c
index 22163fb75c..64d1395723 100644
--- a/src/3rdparty/freetype/src/cff/cffload.c
+++ b/src/3rdparty/freetype/src/cff/cffload.c
@@ -736,6 +736,7 @@
{
FT_Error error = FT_Err_Ok;
FT_UInt i;
+ FT_Long j;
FT_UShort max_cid = 0;
@@ -750,8 +751,11 @@
if ( FT_NEW_ARRAY( charset->cids, max_cid ) )
goto Exit;
- for ( i = 0; i < num_glyphs; i++ )
- charset->cids[charset->sids[i]] = (FT_UShort)i;
+ /* When multiple GIDs map to the same CID, we choose the lowest */
+ /* GID. This is not described in any spec, but it matches the */
+ /* behaviour of recent Acroread versions. */
+ for ( j = num_glyphs - 1; j >= 0 ; j-- )
+ charset->cids[charset->sids[j]] = (FT_UShort)j;
charset->max_cid = max_cid;
charset->num_glyphs = num_glyphs;
@@ -842,7 +846,20 @@
goto Exit;
for ( j = 1; j < num_glyphs; j++ )
- charset->sids[j] = FT_GET_USHORT();
+ {
+ FT_UShort sid = FT_GET_USHORT();
+
+
+ /* this constant is given in the CFF specification */
+ if ( sid < 65000L )
+ charset->sids[j] = sid;
+ else
+ {
+ FT_TRACE0(( "cff_charset_load:"
+ " invalid SID value %d set to zero\n", sid ));
+ charset->sids[j] = 0;
+ }
+ }
FT_FRAME_EXIT();
}
@@ -875,6 +892,20 @@
goto Exit;
}
+ /* check whether the range contains at least one valid glyph; */
+ /* the constant is given in the CFF specification */
+ if ( glyph_sid >= 65000L ) {
+ FT_ERROR(( "cff_charset_load: invalid SID range\n" ));
+ error = CFF_Err_Invalid_File_Format;
+ goto Exit;
+ }
+
+ /* try to rescue some of the SIDs if `nleft' is too large */
+ if ( nleft > 65000L - 1L || glyph_sid >= 65000L - nleft ) {
+ FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" ));
+ nleft = ( FT_UInt )( 65000L - 1L - glyph_sid );
+ }
+
/* Fill in the range of sids -- `nleft + 1' glyphs. */
for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )
charset->sids[j] = glyph_sid;
@@ -883,7 +914,7 @@
break;
default:
- FT_ERROR(( "cff_charset_load: invalid table format!\n" ));
+ FT_ERROR(( "cff_charset_load: invalid table format\n" ));
error = CFF_Err_Invalid_File_Format;
goto Exit;
}
@@ -906,7 +937,7 @@
if ( num_glyphs > 229 )
{
FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe ISO-Latin)!\n" ));
+ "predefined charset (Adobe ISO-Latin)\n" ));
error = CFF_Err_Invalid_File_Format;
goto Exit;
}
@@ -924,7 +955,7 @@
if ( num_glyphs > 166 )
{
FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe Expert)!\n" ));
+ "predefined charset (Adobe Expert)\n" ));
error = CFF_Err_Invalid_File_Format;
goto Exit;
}
@@ -942,7 +973,7 @@
if ( num_glyphs > 87 )
{
FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe Expert Subset)!\n" ));
+ "predefined charset (Adobe Expert Subset)\n" ));
error = CFF_Err_Invalid_File_Format;
goto Exit;
}
@@ -1127,7 +1158,7 @@
break;
default:
- FT_ERROR(( "cff_encoding_load: invalid table format!\n" ));
+ FT_ERROR(( "cff_encoding_load: invalid table format\n" ));
error = CFF_Err_Invalid_File_Format;
goto Exit;
}
@@ -1222,7 +1253,7 @@
break;
default:
- FT_ERROR(( "cff_encoding_load: invalid table format!\n" ));
+ FT_ERROR(( "cff_encoding_load: invalid table format\n" ));
error = CFF_Err_Invalid_File_Format;
goto Exit;
}
@@ -1240,7 +1271,8 @@
CFF_Index idx,
FT_UInt font_index,
FT_Stream stream,
- FT_ULong base_offset )
+ FT_ULong base_offset,
+ FT_Library library )
{
FT_Error error;
CFF_ParserRec parser;
@@ -1250,7 +1282,7 @@
CFF_Private priv = &font->private_dict;
- cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict );
+ cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict, library );
/* set defaults */
FT_MEM_ZERO( top, sizeof ( *top ) );
@@ -1301,7 +1333,7 @@
priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
- cff_parser_init( &parser, CFF_CODE_PRIVATE, priv );
+ cff_parser_init( &parser, CFF_CODE_PRIVATE, priv, library );
if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) ||
FT_FRAME_ENTER( font->font_dict.private_size ) )
@@ -1354,7 +1386,8 @@
FT_LOCAL_DEF( FT_Error )
- cff_font_load( FT_Stream stream,
+ cff_font_load( FT_Library library,
+ FT_Stream stream,
FT_Int face_index,
CFF_Font font,
FT_Bool pure_cff )
@@ -1394,7 +1427,7 @@
font->header_size < 4 ||
font->absolute_offsize > 4 )
{
- FT_TRACE2(( "[not a CFF font header!]\n" ));
+ FT_TRACE2(( "[not a CFF font header]\n" ));
error = CFF_Err_Unknown_File_Format;
goto Exit;
}
@@ -1432,7 +1465,8 @@
&font->font_dict_index,
face_index,
stream,
- base_offset );
+ base_offset,
+ library );
if ( error )
goto Exit;
@@ -1462,7 +1496,7 @@
if ( fd_index.count > CFF_MAX_CID_FONTS )
{
- FT_ERROR(( "cff_font_load: FD array too large in CID font\n" ));
+ FT_TRACE0(( "cff_font_load: FD array too large in CID font\n" ));
goto Fail_CID;
}
@@ -1480,7 +1514,7 @@
{
sub = font->subfonts[idx];
error = cff_subfont_load( sub, &fd_index, idx,
- stream, base_offset );
+ stream, base_offset, library );
if ( error )
goto Fail_CID;
}
@@ -1503,7 +1537,7 @@
/* read the charstrings index now */
if ( dict->charstrings_offset == 0 )
{
- FT_ERROR(( "cff_font_load: no charstrings offset!\n" ));
+ FT_ERROR(( "cff_font_load: no charstrings offset\n" ));
error = CFF_Err_Unknown_File_Format;
goto Exit;
}
diff --git a/src/3rdparty/freetype/src/cff/cffload.h b/src/3rdparty/freetype/src/cff/cffload.h
index 02498bd5e0..2b313acf06 100644
--- a/src/3rdparty/freetype/src/cff/cffload.h
+++ b/src/3rdparty/freetype/src/cff/cffload.h
@@ -58,7 +58,8 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
- cff_font_load( FT_Stream stream,
+ cff_font_load( FT_Library library,
+ FT_Stream stream,
FT_Int face_index,
CFF_Font font,
FT_Bool pure_cff );
diff --git a/src/3rdparty/freetype/src/cff/cffobjs.c b/src/3rdparty/freetype/src/cff/cffobjs.c
index 3525ea3b7d..bd56c4ba11 100644
--- a/src/3rdparty/freetype/src/cff/cffobjs.c
+++ b/src/3rdparty/freetype/src/cff/cffobjs.c
@@ -4,7 +4,7 @@
/* */
/* OpenType objects manager (body). */
/* */
-/* 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, */
@@ -30,6 +30,7 @@
#include "cffload.h"
#include "cffcmap.h"
#include "cfferrs.h"
+#include "cffpic.h"
/*************************************************************************/
@@ -223,8 +224,8 @@
CFF_Font font = (CFF_Font)face->extra.data;
CFF_Internal internal = (CFF_Internal)size->internal;
- FT_Int top_upm = font->top_font.font_dict.units_per_em;
- FT_UInt i;
+ FT_ULong top_upm = font->top_font.font_dict.units_per_em;
+ FT_UInt i;
funcs->set_scale( internal->topfont,
@@ -234,7 +235,7 @@
for ( i = font->num_subfonts; i > 0; i-- )
{
CFF_SubFont sub = font->subfonts[i - 1];
- FT_Int sub_upm = sub->font_dict.units_per_em;
+ FT_ULong sub_upm = sub->font_dict.units_per_em;
FT_Pos x_scale, y_scale;
@@ -295,8 +296,8 @@
CFF_Font font = (CFF_Font)cffface->extra.data;
CFF_Internal internal = (CFF_Internal)size->internal;
- FT_Int top_upm = font->top_font.font_dict.units_per_em;
- FT_UInt i;
+ FT_ULong top_upm = font->top_font.font_dict.units_per_em;
+ FT_UInt i;
funcs->set_scale( internal->topfont,
@@ -306,7 +307,7 @@
for ( i = font->num_subfonts; i > 0; i-- )
{
CFF_SubFont sub = font->subfonts[i - 1];
- FT_Int sub_upm = sub->font_dict.units_per_em;
+ FT_ULong sub_upm = sub->font_dict.units_per_em;
FT_Pos x_scale, y_scale;
@@ -408,6 +409,7 @@
PSHinter_Service pshinter;
FT_Bool pure_cff = 1;
FT_Bool sfnt_format = 0;
+ FT_Library library = cffface->driver->root.library;
#if 0
@@ -419,14 +421,14 @@
goto Bad_Format;
#else
sfnt = (SFNT_Service)FT_Get_Module_Interface(
- cffface->driver->root.library, "sfnt" );
+ library, "sfnt" );
if ( !sfnt )
goto Bad_Format;
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
pshinter = (PSHinter_Service)FT_Get_Module_Interface(
- cffface->driver->root.library, "pshinter" );
+ library, "pshinter" );
#endif
/* create input stream from resource */
@@ -507,7 +509,7 @@
goto Exit;
face->extra.data = cff;
- error = cff_font_load( stream, face_index, cff, pure_cff );
+ error = cff_font_load( library, stream, face_index, cff, pure_cff );
if ( error )
goto Exit;
@@ -528,10 +530,10 @@
/* which aren't CID-keyed */
if ( dict->cid_registry == 0xFFFFU && !psnames )
{
- FT_ERROR(( "cff_face_init:" ));
- FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
- FT_ERROR(( " " ));
- FT_ERROR(( " without the `PSNames' module\n" ));
+ FT_ERROR(( "cff_face_init:"
+ " cannot open CFF & CEF fonts\n"
+ " "
+ " without the `PSNames' module\n" ));
goto Bad_Format;
}
@@ -582,7 +584,7 @@
if ( sub->units_per_em )
{
- FT_Int scaling;
+ FT_Long scaling;
if ( top->units_per_em > 1 && sub->units_per_em > 1 )
@@ -655,10 +657,11 @@
cffface->num_glyphs = cff->charstrings_index.count;
/* set global bbox, as well as EM size */
- cffface->bbox.xMin = dict->font_bbox.xMin >> 16;
- cffface->bbox.yMin = dict->font_bbox.yMin >> 16;
- cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16;
- cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16;
+ cffface->bbox.xMin = dict->font_bbox.xMin >> 16;
+ cffface->bbox.yMin = dict->font_bbox.yMin >> 16;
+ /* no `U' suffix here to 0xFFFF! */
+ cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFF ) >> 16;
+ cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFF ) >> 16;
cffface->units_per_EM = (FT_UShort)( dict->units_per_em );
@@ -764,22 +767,22 @@
/* */
/* Compute face flags. */
/* */
- flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
- FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
- FT_FACE_FLAG_HINTER; /* has native hinter */
+ flags = (FT_UInt32)( FT_FACE_FLAG_SCALABLE | /* scalable outlines */
+ FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
+ FT_FACE_FLAG_HINTER ); /* has native hinter */
if ( sfnt_format )
- flags |= FT_FACE_FLAG_SFNT;
+ flags |= (FT_UInt32)FT_FACE_FLAG_SFNT;
/* fixed width font? */
if ( dict->is_fixed_pitch )
- flags |= FT_FACE_FLAG_FIXED_WIDTH;
+ flags |= (FT_UInt32)FT_FACE_FLAG_FIXED_WIDTH;
/* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
#if 0
/* kerning available? */
if ( face->kern_pairs )
- flags |= FT_FACE_FLAG_KERNING;
+ flags |= (FT_UInt32)FT_FACE_FLAG_KERNING;
#endif
cffface->face_flags = flags;
@@ -868,7 +871,7 @@
nn = (FT_UInt)cffface->num_charmaps;
- FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL );
+ FT_CMap_New( &FT_CFF_CMAP_UNICODE_CLASS_REC_GET, NULL, &cmaprec, NULL );
/* if no Unicode charmap was previously selected, select this one */
if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps )
@@ -887,19 +890,19 @@
{
cmaprec.encoding_id = TT_ADOBE_ID_STANDARD;
cmaprec.encoding = FT_ENCODING_ADOBE_STANDARD;
- clazz = &cff_cmap_encoding_class_rec;
+ clazz = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET;
}
else if ( encoding->offset == 1 )
{
cmaprec.encoding_id = TT_ADOBE_ID_EXPERT;
cmaprec.encoding = FT_ENCODING_ADOBE_EXPERT;
- clazz = &cff_cmap_encoding_class_rec;
+ clazz = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET;
}
else
{
cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM;
cmaprec.encoding = FT_ENCODING_ADOBE_CUSTOM;
- clazz = &cff_cmap_encoding_class_rec;
+ clazz = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET;
}
FT_CMap_New( clazz, NULL, &cmaprec, NULL );
diff --git a/src/3rdparty/freetype/src/cff/cffparse.c b/src/3rdparty/freetype/src/cff/cffparse.c
index 290595f9e8..01266a193d 100644
--- a/src/3rdparty/freetype/src/cff/cffparse.c
+++ b/src/3rdparty/freetype/src/cff/cffparse.c
@@ -22,6 +22,7 @@
#include FT_INTERNAL_DEBUG_H
#include "cfferrs.h"
+#include "cffpic.h"
/*************************************************************************/
@@ -34,47 +35,20 @@
#define FT_COMPONENT trace_cffparse
- enum
- {
- cff_kind_none = 0,
- cff_kind_num,
- cff_kind_fixed,
- cff_kind_fixed_thousand,
- cff_kind_string,
- cff_kind_bool,
- cff_kind_delta,
- cff_kind_callback,
-
- cff_kind_max /* do not remove */
- };
-
-
- /* now generate handlers for the most simple fields */
- typedef FT_Error (*CFF_Field_Reader)( CFF_Parser parser );
-
- typedef struct CFF_Field_Handler_
- {
- int kind;
- int code;
- FT_UInt offset;
- FT_Byte size;
- CFF_Field_Reader reader;
- FT_UInt array_max;
- FT_UInt count_offset;
-
- } CFF_Field_Handler;
FT_LOCAL_DEF( void )
cff_parser_init( CFF_Parser parser,
FT_UInt code,
- void* object )
+ void* object,
+ FT_Library library)
{
FT_MEM_ZERO( parser, sizeof ( *parser ) );
parser->top = parser->stack;
parser->object_code = code;
parser->object = object;
+ parser->library = library;
}
@@ -156,8 +130,8 @@
static FT_Fixed
cff_parse_real( FT_Byte* start,
FT_Byte* limit,
- FT_Int power_ten,
- FT_Int* scaling )
+ FT_Long power_ten,
+ FT_Long* scaling )
{
FT_Byte* p = start;
FT_UInt nib;
@@ -165,7 +139,7 @@
FT_Long result, number, rest, exponent;
FT_Int sign = 0, exponent_sign = 0;
- FT_Int exponent_add, integer_length, fraction_length;
+ FT_Long exponent_add, integer_length, fraction_length;
if ( scaling )
@@ -181,6 +155,8 @@
integer_length = 0;
fraction_length = 0;
+ FT_UNUSED( rest );
+
/* First of all, read the integer part. */
phase = 4;
@@ -310,7 +286,7 @@
{
if ( exponent > 0 )
{
- FT_Int new_fraction_length, shift;
+ FT_Long new_fraction_length, shift;
/* Make `scaling' as small as possible. */
@@ -410,7 +386,7 @@
/* but return `10^scaling' times the number read in */
static FT_Fixed
cff_parse_fixed_scaled( FT_Byte** d,
- FT_Int scaling )
+ FT_Long scaling )
{
return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
: ( cff_parse_integer( d[0], d[1] ) *
@@ -423,7 +399,7 @@
/* the scaling factor (as a power of 10) */
static FT_Fixed
cff_parse_fixed_dynamic( FT_Byte** d,
- FT_Int* scaling )
+ FT_Long* scaling )
{
FT_ASSERT( scaling );
@@ -476,7 +452,7 @@
if ( parser->top >= parser->stack + 6 )
{
- FT_Int scaling;
+ FT_Long scaling;
error = CFF_Err_Ok;
@@ -578,7 +554,12 @@
{
dict->cid_registry = (FT_UInt)cff_parse_num ( data++ );
dict->cid_ordering = (FT_UInt)cff_parse_num ( data++ );
- dict->cid_supplement = (FT_ULong)cff_parse_num( data );
+ if ( **data == 30 )
+ FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
+ dict->cid_supplement = cff_parse_num( data );
+ if ( dict->cid_supplement < 0 )
+ FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
+ dict->cid_supplement ));
error = CFF_Err_Ok;
}
@@ -599,6 +580,11 @@
#define CFF_FIELD_DELTA( code, name, max ) \
CFF_FIELD( code, name, cff_kind_delta )
+#define CFFCODE_TOPDICT 0x1000
+#define CFFCODE_PRIVATE 0x2000
+
+#ifndef FT_CONFIG_OPTION_PIC
+
#define CFF_FIELD_CALLBACK( code, name ) \
{ \
cff_kind_callback, \
@@ -630,9 +616,6 @@
FT_FIELD_OFFSET( num_ ## name ) \
},
-#define CFFCODE_TOPDICT 0x1000
-#define CFFCODE_PRIVATE 0x2000
-
static const CFF_Field_Handler cff_field_handlers[] =
{
@@ -642,13 +625,99 @@
};
+#else /* FT_CONFIG_OPTION_PIC */
+
+ void FT_Destroy_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler* clazz)
+ {
+ FT_Memory memory = library->memory;
+ if ( clazz )
+ FT_FREE( clazz );
+ }
+
+ FT_Error FT_Create_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler** output_class)
+ {
+ CFF_Field_Handler* clazz;
+ FT_Error error;
+ FT_Memory memory = library->memory;
+ int i=0;
+
+#undef CFF_FIELD
+#undef CFF_FIELD_DELTA
+#undef CFF_FIELD_CALLBACK
+#define CFF_FIELD_CALLBACK( code, name ) i++;
+#define CFF_FIELD( code, name, kind ) i++;
+#define CFF_FIELD_DELTA( code, name, max ) i++;
+
+#include "cfftoken.h"
+ i++;/*{ 0, 0, 0, 0, 0, 0, 0 }*/
+
+ if ( FT_ALLOC( clazz, sizeof(CFF_Field_Handler)*i ) )
+ return error;
+
+ i=0;
+#undef CFF_FIELD
+#undef CFF_FIELD_DELTA
+#undef CFF_FIELD_CALLBACK
+
+#define CFF_FIELD_CALLBACK( code_, name_ ) \
+ clazz[i].kind = cff_kind_callback; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = 0; \
+ clazz[i].size = 0; \
+ clazz[i].reader = cff_parse_ ## name_; \
+ clazz[i].array_max = 0; \
+ clazz[i].count_offset = 0; \
+ i++;
+
+#undef CFF_FIELD
+#define CFF_FIELD( code_, name_, kind_ ) \
+ clazz[i].kind = kind_; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
+ clazz[i].size = FT_FIELD_SIZE( name_ ); \
+ clazz[i].reader = 0; \
+ clazz[i].array_max = 0; \
+ clazz[i].count_offset = 0; \
+ i++; \
+
+#undef CFF_FIELD_DELTA
+#define CFF_FIELD_DELTA( code_, name_, max_ ) \
+ clazz[i].kind = cff_kind_delta; \
+ clazz[i].code = code_ | CFFCODE; \
+ clazz[i].offset = FT_FIELD_OFFSET( name_ ); \
+ clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \
+ clazz[i].reader = 0; \
+ clazz[i].array_max = max_; \
+ clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \
+ i++;
+
+#include "cfftoken.h"
+
+ clazz[i].kind = 0;
+ clazz[i].code = 0;
+ clazz[i].offset = 0;
+ clazz[i].size = 0;
+ clazz[i].reader = 0;
+ clazz[i].array_max = 0;
+ clazz[i].count_offset = 0;
+
+ *output_class = clazz;
+ return FT_Err_Ok;
+ }
+
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
FT_LOCAL_DEF( FT_Error )
cff_parser_run( CFF_Parser parser,
FT_Byte* start,
FT_Byte* limit )
{
- FT_Byte* p = start;
- FT_Error error = CFF_Err_Ok;
+ FT_Byte* p = start;
+ FT_Error error = CFF_Err_Ok;
+ FT_Library library = parser->library;
+ FT_UNUSED(library);
parser->top = parser->stack;
@@ -676,8 +745,10 @@
p++;
for (;;)
{
+ /* An unterminated floating point number at the */
+ /* end of a dictionary is invalid but harmless. */
if ( p >= limit )
- goto Syntax_Error;
+ goto Exit;
v = p[0] >> 4;
if ( v == 15 )
break;
@@ -718,7 +789,7 @@
}
code = code | parser->object_code;
- for ( field = cff_field_handlers; field->kind; field++ )
+ for ( field = FT_CFF_FIELD_HANDLERS_GET; field->kind; field++ )
{
if ( field->code == (FT_Int)code )
{
diff --git a/src/3rdparty/freetype/src/cff/cffparse.h b/src/3rdparty/freetype/src/cff/cffparse.h
index 8f3fa58859..7e2c00a044 100644
--- a/src/3rdparty/freetype/src/cff/cffparse.h
+++ b/src/3rdparty/freetype/src/cff/cffparse.h
@@ -36,6 +36,7 @@ FT_BEGIN_HEADER
typedef struct CFF_ParserRec_
{
+ FT_Library library;
FT_Byte* start;
FT_Byte* limit;
FT_Byte* cursor;
@@ -52,7 +53,8 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
cff_parser_init( CFF_Parser parser,
FT_UInt code,
- void* object );
+ void* object,
+ FT_Library library);
FT_LOCAL( FT_Error )
cff_parser_run( CFF_Parser parser,
@@ -60,6 +62,37 @@ FT_BEGIN_HEADER
FT_Byte* limit );
+ enum
+ {
+ cff_kind_none = 0,
+ cff_kind_num,
+ cff_kind_fixed,
+ cff_kind_fixed_thousand,
+ cff_kind_string,
+ cff_kind_bool,
+ cff_kind_delta,
+ cff_kind_callback,
+
+ cff_kind_max /* do not remove */
+ };
+
+
+ /* now generate handlers for the most simple fields */
+ typedef FT_Error (*CFF_Field_Reader)( CFF_Parser parser );
+
+ typedef struct CFF_Field_Handler_
+ {
+ int kind;
+ int code;
+ FT_UInt offset;
+ FT_Byte size;
+ CFF_Field_Reader reader;
+ FT_UInt array_max;
+ FT_UInt count_offset;
+
+ } CFF_Field_Handler;
+
+
FT_END_HEADER
diff --git a/src/3rdparty/freetype/src/cff/cffpic.c b/src/3rdparty/freetype/src/cff/cffpic.c
new file mode 100644
index 0000000000..568956d6a9
--- /dev/null
+++ b/src/3rdparty/freetype/src/cff/cffpic.c
@@ -0,0 +1,99 @@
+/***************************************************************************/
+/* */
+/* cffpic.c */
+/* */
+/* The FreeType position independent code services for cff 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 "cffpic.h"
+
+#ifdef FT_CONFIG_OPTION_PIC
+
+ /* forward declaration of PIC init functions from cffdrivr.c */
+ FT_Error FT_Create_Class_cff_services( FT_Library, FT_ServiceDescRec**);
+ void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*);
+ void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*);
+ void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*);
+ void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*);
+ void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*);
+ void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*);
+
+ /* forward declaration of PIC init functions from cffparse.c */
+ FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**);
+ void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*);
+
+ /* forward declaration of PIC init functions from cffcmap.c */
+ void FT_Init_Class_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*);
+ void FT_Init_Class_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*);
+
+ void
+ cff_driver_class_pic_free( FT_Library library )
+ {
+ FT_PIC_Container* pic_container = &library->pic_container;
+ FT_Memory memory = library->memory;
+ if ( pic_container->cff )
+ {
+ CffModulePIC* container = (CffModulePIC*)pic_container->cff;
+ if(container->cff_services)
+ FT_Destroy_Class_cff_services(library, container->cff_services);
+ container->cff_services = NULL;
+ if(container->cff_field_handlers)
+ FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers);
+ container->cff_field_handlers = NULL;
+ FT_FREE( container );
+ pic_container->cff = NULL;
+ }
+ }
+
+ FT_Error
+ cff_driver_class_pic_init( FT_Library library )
+ {
+ FT_PIC_Container* pic_container = &library->pic_container;
+ FT_Error error = FT_Err_Ok;
+ CffModulePIC* 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->cff = container;
+
+ /* initialize pointer table - this is how the module usually expects this data */
+ error = FT_Create_Class_cff_services(library, &container->cff_services);
+ if(error)
+ goto Exit;
+ error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers);
+ if(error)
+ goto Exit;
+ FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info);
+ FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict);
+ FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name);
+ FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info);
+ FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info);
+ FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec);
+ FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec);
+Exit:
+ if(error)
+ cff_driver_class_pic_free(library);
+ return error;
+ }
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+
+/* END */
diff --git a/src/3rdparty/freetype/src/cff/cffpic.h b/src/3rdparty/freetype/src/cff/cffpic.h
new file mode 100644
index 0000000000..e29d068134
--- /dev/null
+++ b/src/3rdparty/freetype/src/cff/cffpic.h
@@ -0,0 +1,80 @@
+/***************************************************************************/
+/* */
+/* cffpic.h */
+/* */
+/* The FreeType position independent code services for cff 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 __CFFPIC_H__
+#define __CFFPIC_H__
+
+
+FT_BEGIN_HEADER
+
+#include FT_INTERNAL_PIC_H
+
+#ifndef FT_CONFIG_OPTION_PIC
+#define FT_CFF_SERVICE_PS_INFO_GET cff_service_ps_info
+#define FT_CFF_SERVICE_GLYPH_DICT_GET cff_service_glyph_dict
+#define FT_CFF_SERVICE_PS_NAME_GET cff_service_ps_name
+#define FT_CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info
+#define FT_CFF_SERVICE_CID_INFO_GET cff_service_cid_info
+#define FT_CFF_SERVICES_GET cff_services
+#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
+#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
+#define FT_CFF_FIELD_HANDLERS_GET cff_field_handlers
+
+#else /* FT_CONFIG_OPTION_PIC */
+
+#include FT_SERVICE_GLYPH_DICT_H
+#include "cffparse.h"
+#include FT_SERVICE_POSTSCRIPT_INFO_H
+#include FT_SERVICE_POSTSCRIPT_NAME_H
+#include FT_SERVICE_TT_CMAP_H
+#include FT_SERVICE_CID_H
+
+ typedef struct CffModulePIC_
+ {
+ FT_ServiceDescRec* cff_services;
+ CFF_Field_Handler* cff_field_handlers;
+ FT_Service_PsInfoRec cff_service_ps_info;
+ FT_Service_GlyphDictRec cff_service_glyph_dict;
+ FT_Service_PsFontNameRec cff_service_ps_name;
+ FT_Service_TTCMapsRec cff_service_get_cmap_info;
+ FT_Service_CIDRec cff_service_cid_info;
+ FT_CMap_ClassRec cff_cmap_encoding_class_rec;
+ FT_CMap_ClassRec cff_cmap_unicode_class_rec;
+ } CffModulePIC;
+
+#define GET_PIC(lib) ((CffModulePIC*)((lib)->pic_container.cff))
+#define FT_CFF_SERVICE_PS_INFO_GET (GET_PIC(library)->cff_service_ps_info)
+#define FT_CFF_SERVICE_GLYPH_DICT_GET (GET_PIC(library)->cff_service_glyph_dict)
+#define FT_CFF_SERVICE_PS_NAME_GET (GET_PIC(library)->cff_service_ps_name)
+#define FT_CFF_SERVICE_GET_CMAP_INFO_GET (GET_PIC(library)->cff_service_get_cmap_info)
+#define FT_CFF_SERVICE_CID_INFO_GET (GET_PIC(library)->cff_service_cid_info)
+#define FT_CFF_SERVICES_GET (GET_PIC(library)->cff_services)
+#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET (GET_PIC(library)->cff_cmap_encoding_class_rec)
+#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET (GET_PIC(library)->cff_cmap_unicode_class_rec)
+#define FT_CFF_FIELD_HANDLERS_GET (GET_PIC(library)->cff_field_handlers)
+
+#endif /* FT_CONFIG_OPTION_PIC */
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __CFFPIC_H__ */
+
+
+/* END */
diff --git a/src/3rdparty/freetype/src/cff/cfftypes.h b/src/3rdparty/freetype/src/cff/cfftypes.h
index 546ea3b99d..df92e9a1ac 100644
--- a/src/3rdparty/freetype/src/cff/cfftypes.h
+++ b/src/3rdparty/freetype/src/cff/cfftypes.h
@@ -130,7 +130,7 @@ FT_BEGIN_HEADER
/* these should only be used for the top-level font dictionary */
FT_UInt cid_registry;
FT_UInt cid_ordering;
- FT_ULong cid_supplement;
+ FT_Long cid_supplement;
FT_Long cid_font_version;
FT_Long cid_font_revision;