summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype2/freetype-src/src
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-12-03 04:03:12 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2021-12-03 04:03:12 +0000
commit4ee9d04bd5d518e5f1f86875f4f8184fc0552f44 (patch)
tree4f27c2cc7196ba469bf631ffe0460cb3d6bcbc9d /Build/source/libs/freetype2/freetype-src/src
parent39bd39ea6f91fb51d118264f372905de9accc347 (diff)
freetype 2.11.1
git-svn-id: svn://tug.org/texlive/trunk@61211 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src')
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c18
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h5
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afws-decl.h (renamed from Build/source/libs/freetype2/freetype-src/src/autofit/afwrtsys.h)22
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/afws-iter.h31
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk15
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c14
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c92
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c18
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftmac.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c98
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftstream.c83
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/base/ftver.rc4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c138
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c9
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c22
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffload.c46
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c21
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c31
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidload.c92
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidload.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c11
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c9
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c18
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h35
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c21
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c12
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c46
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c12
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c28
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h20
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c4
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c22
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psft.c6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c37
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c3
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c17
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c98
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h30
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c17
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h7
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c29
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c22
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c30
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c30
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c10
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c17
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c21
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h3
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c31
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c235
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h5
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c68
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c14
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c252
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/tools/apinames.c22
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c12
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c24
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c234
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h6
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c82
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h77
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c86
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c58
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c2
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1load.c94
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c9
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c16
100 files changed, 1619 insertions, 1226 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c
index aedb74ddd40..b805b3b0e52 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afglobal.c
@@ -19,6 +19,7 @@
#include "afglobal.h"
#include "afranges.h"
#include "afshaper.h"
+#include "afws-decl.h"
#include <freetype/internal/ftdebug.h>
@@ -32,11 +33,6 @@
#define FT_COMPONENT afglobal
- /* get writing system specific header files */
-#undef WRITING_SYSTEM
-#define WRITING_SYSTEM( ws, WS ) /* empty */
-#include "afwrtsys.h"
-
#include "aferrors.h"
@@ -74,7 +70,7 @@
af_writing_system_classes[] =
{
-#include "afwrtsys.h"
+#include "afws-iter.h"
NULL /* do not remove */
};
@@ -481,7 +477,7 @@
/* IMPORTANT: Clear the error code, see
* https://gitlab.freedesktop.org/freetype/freetype/-/issues/1063
*/
- error = 0;
+ error = FT_Err_Ok;
goto Again;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c b/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c
index 4bf6d66ddbf..5506afda225 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afhints.c
@@ -862,7 +862,7 @@
{
FT_Error error = FT_Err_Ok;
AF_Point points;
- FT_UInt old_max, new_max;
+ FT_Int old_max, new_max;
FT_Fixed x_scale = hints->x_scale;
FT_Fixed y_scale = hints->y_scale;
FT_Pos x_delta = hints->x_delta;
@@ -879,8 +879,8 @@
hints->axis[1].num_edges = 0;
/* first of all, reallocate the contours array if necessary */
- new_max = (FT_UInt)outline->n_contours;
- old_max = (FT_UInt)hints->max_contours;
+ new_max = outline->n_contours;
+ old_max = hints->max_contours;
if ( new_max <= AF_CONTOURS_EMBEDDED )
{
@@ -895,12 +895,12 @@
if ( hints->contours == hints->embedded.contours )
hints->contours = NULL;
- new_max = ( new_max + 3 ) & ~3U; /* round up to a multiple of 4 */
+ new_max = ( new_max + 3 ) & ~3; /* round up to a multiple of 4 */
if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) )
goto Exit;
- hints->max_contours = (FT_Int)new_max;
+ hints->max_contours = new_max;
}
/*
@@ -908,8 +908,8 @@
* note that we reserve two additional point positions, used to
* hint metrics appropriately
*/
- new_max = (FT_UInt)( outline->n_points + 2 );
- old_max = (FT_UInt)hints->max_points;
+ new_max = outline->n_points + 2;
+ old_max = hints->max_points;
if ( new_max <= AF_POINTS_EMBEDDED )
{
@@ -924,12 +924,12 @@
if ( hints->points == hints->embedded.points )
hints->points = NULL;
- new_max = ( new_max + 2 + 7 ) & ~7U; /* round up to a multiple of 8 */
+ new_max = ( new_max + 2 + 7 ) & ~7; /* round up to a multiple of 8 */
if ( FT_RENEW_ARRAY( hints->points, old_max, new_max ) )
goto Exit;
- hints->max_points = (FT_Int)new_max;
+ hints->max_points = new_max;
}
hints->num_points = outline->n_points;
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c
index b8af228a4f6..5e81d771a43 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/aflatin.c
@@ -2109,7 +2109,7 @@
{
if ( seg2->link != seg1 )
{
- seg1->link = 0;
+ seg1->link = NULL;
seg1->serif = seg2->link;
}
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h b/Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h
index e76b103ed01..1d792b9476f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/aftypes.h
@@ -198,7 +198,6 @@ extern void* _af_debug_hints;
* outline according to the results of the glyph analyzer.
*/
-#define AFWRTSYS_H_ /* don't load header files */
#undef WRITING_SYSTEM
#define WRITING_SYSTEM( ws, WS ) \
AF_WRITING_SYSTEM_ ## WS,
@@ -207,14 +206,12 @@ extern void* _af_debug_hints;
typedef enum AF_WritingSystem_
{
-#include "afwrtsys.h"
+#include "afws-iter.h"
AF_WRITING_SYSTEM_MAX /* do not remove */
} AF_WritingSystem;
-#undef AFWRTSYS_H_
-
typedef struct AF_WritingSystemClassRec_
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afwrtsys.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afws-decl.h
index 39aa1211263..c10dd57e7be 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/afwrtsys.h
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afws-decl.h
@@ -1,8 +1,8 @@
/****************************************************************************
*
- * afwrtsys.h
+ * afws-decl.h
*
- * Auto-fitter writing systems (specification only).
+ * Auto-fitter writing system declarations (specification only).
*
* Copyright (C) 2013-2021 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -16,8 +16,8 @@
*/
-#ifndef AFWRTSYS_H_
-#define AFWRTSYS_H_
+#ifndef AFWS_DECL_H_
+#define AFWS_DECL_H_
/* Since preprocessor directives can't create other preprocessor */
/* directives, we have to include the header files manually. */
@@ -27,19 +27,7 @@
#include "afcjk.h"
#include "afindic.h"
-#endif /* AFWRTSYS_H_ */
+#endif /* AFWS_DECL_H_ */
- /* The following part can be included multiple times. */
- /* Define `WRITING_SYSTEM' as needed. */
-
-
- /* Add new writing systems here. The arguments are the writing system */
- /* name in lowercase and uppercase, respectively. */
-
- WRITING_SYSTEM( dummy, DUMMY )
- WRITING_SYSTEM( latin, LATIN )
- WRITING_SYSTEM( cjk, CJK )
- WRITING_SYSTEM( indic, INDIC )
-
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/afws-iter.h b/Build/source/libs/freetype2/freetype-src/src/autofit/afws-iter.h
new file mode 100644
index 00000000000..55714203e30
--- /dev/null
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/afws-iter.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+ *
+ * afws-iter.h
+ *
+ * Auto-fitter writing systems iterator (specification only).
+ *
+ * Copyright (C) 2013-2021 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg.
+ *
+ * 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.
+ *
+ */
+
+ /* This header may be included multiple times. */
+ /* Define `WRITING_SYSTEM' as needed. */
+
+
+ /* Add new writing systems here. The arguments are the writing system */
+ /* name in lowercase and uppercase, respectively. */
+
+ WRITING_SYSTEM( dummy, DUMMY )
+ WRITING_SYSTEM( latin, LATIN )
+ WRITING_SYSTEM( cjk, CJK )
+ WRITING_SYSTEM( indic, INDIC )
+
+
+/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk b/Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk
index 19b3bcadb30..499c0e08366 100644
--- a/Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk
+++ b/Build/source/libs/freetype2/freetype-src/src/autofit/rules.mk
@@ -42,13 +42,14 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afblue.c \
# AUTOF driver headers
#
-AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \
- $(AUTOF_DIR)/afcover.h \
- $(AUTOF_DIR)/aferrors.h \
- $(AUTOF_DIR)/afscript.h \
- $(AUTOF_DIR)/afstyles.h \
- $(AUTOF_DIR)/aftypes.h \
- $(AUTOF_DIR)/afwrtsys.h
+AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \
+ $(AUTOF_DIR)/afcover.h \
+ $(AUTOF_DIR)/aferrors.h \
+ $(AUTOF_DIR)/afscript.h \
+ $(AUTOF_DIR)/afstyles.h \
+ $(AUTOF_DIR)/aftypes.h \
+ $(AUTOF_DIR)/afws-decl.h \
+ $(AUTOF_DIR)/afws-iter.h
# AUTOF driver object(s)
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c b/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c
index e504db17210..2146d3e3649 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftbitmap.c
@@ -112,10 +112,10 @@
target_size = (FT_ULong)target_pitch * target->rows;
if ( target_size != size )
- (void)FT_QREALLOC( target->buffer, target_size, size );
+ FT_MEM_QREALLOC( target->buffer, target_size, size );
}
else
- (void)FT_QALLOC( target->buffer, size );
+ FT_MEM_QALLOC( target->buffer, size );
if ( !error )
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c b/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c
index e60303afc8d..9df8e4010d1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftcalc.c
@@ -45,7 +45,7 @@
/* we need to emulate a 64-bit data type if a real one isn't available */
-#ifndef FT_LONG64
+#ifndef FT_INT64
typedef struct FT_Int64_
{
@@ -54,7 +54,7 @@
} FT_Int64;
-#endif /* !FT_LONG64 */
+#endif /* !FT_INT64 */
/**************************************************************************
@@ -79,7 +79,7 @@
FT_END_STMNT
/* The following three functions are available regardless of whether */
- /* FT_LONG64 is defined. */
+ /* FT_INT64 is defined. */
/* documentation is in freetype.h */
@@ -164,7 +164,7 @@
}
-#ifdef FT_LONG64
+#ifdef FT_INT64
/* documentation is in freetype.h */
@@ -272,7 +272,7 @@
}
-#else /* !FT_LONG64 */
+#else /* !FT_INT64 */
static void
@@ -651,7 +651,7 @@
}
-#endif /* !FT_LONG64 */
+#endif /* !FT_INT64 */
/* documentation is in ftglyph.h */
@@ -985,7 +985,7 @@
/* we silently ignore overflow errors since such large values */
/* lead to even more (harmless) rendering errors later on */
-#ifdef FT_LONG64
+#ifdef FT_INT64
FT_Int64 delta = SUB_INT64( MUL_INT64( in_x, out_y ),
MUL_INT64( in_y, out_x ) );
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c b/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c
index 8425ca70280..4f5c1e76971 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftdbgmem.c
@@ -302,46 +302,6 @@
}
- static FT_MemTable
- ft_mem_table_new( FT_Memory memory )
- {
- FT_MemTable table;
-
-
- table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) );
- if ( !table )
- goto Exit;
-
- FT_ZERO( table );
-
- table->size = FT_MEM_SIZE_MIN;
- table->nodes = 0;
-
- table->memory = memory;
-
- table->memory_user = memory->user;
-
- table->alloc = memory->alloc;
- table->realloc = memory->realloc;
- table->free = memory->free;
-
- table->buckets = (FT_MemNode *)
- memory->alloc(
- memory,
- table->size * (FT_Long)sizeof ( FT_MemNode ) );
- if ( table->buckets )
- FT_ARRAY_ZERO( table->buckets, table->size );
- else
- {
- memory->free( memory, table );
- table = NULL;
- }
-
- Exit:
- return table;
- }
-
-
static void
ft_mem_table_destroy( FT_MemTable table )
{
@@ -350,8 +310,6 @@
FT_Long leaks = 0;
- FT_DumpMemory( table->memory );
-
/* remove all blocks from the table, revealing leaked ones */
for ( i = 0; i < table->size; i++ )
{
@@ -413,8 +371,6 @@
printf( "FreeType: maximum memory footprint = %ld\n",
table->alloc_max );
- ft_mem_table_free( table, table );
-
if ( leak_count > 0 )
ft_mem_debug_panic(
"FreeType: %ld bytes of memory leaked in %ld blocks\n",
@@ -821,17 +777,30 @@
}
- extern FT_Int
+ extern void
ft_mem_debug_init( FT_Memory memory )
{
FT_MemTable table;
- FT_Int result = 0;
- if ( ft_getenv( "FT2_DEBUG_MEMORY" ) )
+ if ( !ft_getenv( "FT2_DEBUG_MEMORY" ) )
+ return;
+
+ table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) );
+
+ if ( table )
{
- table = ft_mem_table_new( memory );
- if ( table )
+ FT_ZERO( table );
+
+ table->memory = memory;
+ table->memory_user = memory->user;
+ table->alloc = memory->alloc;
+ table->realloc = memory->realloc;
+ table->free = memory->free;
+
+ ft_mem_table_resize( table );
+
+ if ( table->size )
{
const char* p;
@@ -876,28 +845,31 @@
if ( keep_alive > 0 )
table->keep_alive = 1;
}
-
- result = 1;
}
+ else
+ memory->free( memory, table );
}
- return result;
}
extern void
ft_mem_debug_done( FT_Memory memory )
{
- FT_MemTable table = (FT_MemTable)memory->user;
+ if ( memory->free == ft_mem_debug_free )
+ {
+ FT_MemTable table = (FT_MemTable)memory->user;
- if ( table )
- {
+ FT_DumpMemory( memory );
+
+ ft_mem_table_destroy( table );
+
memory->free = table->free;
memory->realloc = table->realloc;
memory->alloc = table->alloc;
+ memory->user = table->memory_user;
- ft_mem_table_destroy( table );
- memory->user = NULL;
+ memory->free( memory, table );
}
}
@@ -922,11 +894,9 @@
extern void
FT_DumpMemory( FT_Memory memory )
{
- FT_MemTable table = (FT_MemTable)memory->user;
-
-
- if ( table )
+ if ( memory->free == ft_mem_debug_free )
{
+ FT_MemTable table = (FT_MemTable)memory->user;
FT_MemSource* bucket = table->sources;
FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS;
FT_MemSource* sources;
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c b/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c
index bf4018652c8..34857913065 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftdebug.c
@@ -88,7 +88,7 @@
dlg_handler ft_default_log_handler = NULL;
FT_Custom_Log_Handler custom_output_handler = NULL;
-#endif /* FT_DEBUG_LOGGING*/
+#endif /* FT_DEBUG_LOGGING */
#ifdef FT_DEBUG_LEVEL_ERROR
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c b/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c
index 9e3c3cd35cf..e2c6f73f80f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftglyph.c
@@ -453,9 +453,9 @@
/* documentation is in ftglyph.h */
FT_EXPORT_DEF( FT_Error )
- FT_Glyph_Transform( FT_Glyph glyph,
- FT_Matrix* matrix,
- FT_Vector* delta )
+ FT_Glyph_Transform( FT_Glyph glyph,
+ const FT_Matrix* matrix,
+ const FT_Vector* delta )
{
FT_Error error = FT_Err_Ok;
@@ -533,10 +533,10 @@
/* documentation is in ftglyph.h */
FT_EXPORT_DEF( FT_Error )
- FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
- FT_Render_Mode render_mode,
- FT_Vector* origin,
- FT_Bool destroy )
+ FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
+ FT_Render_Mode render_mode,
+ const FT_Vector* origin,
+ FT_Bool destroy )
{
FT_GlyphSlotRec dummy;
FT_GlyphSlot_InternalRec dummy_internal;
@@ -585,7 +585,7 @@
#if 1
/* if `origin' is set, translate the glyph image */
if ( origin )
- FT_Glyph_Transform( glyph, 0, origin );
+ FT_Glyph_Transform( glyph, NULL, origin );
#else
FT_UNUSED( origin );
#endif
@@ -603,7 +603,7 @@
v.x = -origin->x;
v.y = -origin->y;
- FT_Glyph_Transform( glyph, 0, &v );
+ FT_Glyph_Transform( glyph, NULL, &v );
}
#endif
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c b/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c
index f41c5eeab1c..36a860979e1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftmac.c
@@ -560,7 +560,7 @@
if ( lwfn_file_name[0] )
{
err = lookup_lwfn_by_fond( pathname, lwfn_file_name,
- buff, sizeof ( buff ) );
+ buff, sizeof ( buff ) );
if ( !err )
have_lwfn = 1;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c b/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c
index 0ded2440fca..883f1a8970c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftobjs.c
@@ -221,6 +221,7 @@
FT_Stream_OpenMemory( stream,
(const FT_Byte*)args->memory_base,
(FT_ULong)args->memory_size );
+ stream->memory = memory;
}
#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT
@@ -231,6 +232,7 @@
if ( FT_NEW( stream ) )
goto Exit;
+ stream->memory = memory;
error = FT_Stream_Open( stream, args->pathname );
if ( error )
FT_FREE( stream );
@@ -241,8 +243,9 @@
/* in this case, we do not need to allocate a new stream object */
/* since the caller is responsible for closing it himself */
- stream = args->stream;
- error = FT_Err_Ok;
+ stream = args->stream;
+ stream->memory = memory;
+ error = FT_Err_Ok;
}
#endif
@@ -255,10 +258,7 @@
}
if ( !error )
- {
- stream->memory = memory;
*astream = stream;
- }
Exit:
return error;
@@ -535,7 +535,7 @@
else
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
- (void)FT_ALLOC( slot->bitmap.buffer, size );
+ FT_MEM_ALLOC( slot->bitmap.buffer, size );
return error;
}
@@ -2610,7 +2610,7 @@
FT_TRACE4(( "FT_Open_Face: New face object, adding to list\n" ));
/* add the face object to its driver's list */
- if ( FT_NEW( node ) )
+ if ( FT_QNEW( node ) )
goto Fail;
node->data = face;
@@ -2895,7 +2895,7 @@
memory = face->memory;
/* Allocate new size object and perform basic initialisation */
- if ( FT_ALLOC( size, clazz->size_object_size ) || FT_NEW( node ) )
+ if ( FT_ALLOC( size, clazz->size_object_size ) || FT_QNEW( node ) )
goto Exit;
size->face = face;
@@ -3132,10 +3132,12 @@
}
- FT_BASE_DEF( void )
+ FT_BASE_DEF( FT_Error )
FT_Request_Metrics( FT_Face face,
FT_Size_Request req )
{
+ FT_Error error = FT_Err_Ok;
+
FT_Size_Metrics* metrics;
@@ -3226,8 +3228,18 @@
scaled_h = FT_MulFix( face->units_per_EM, metrics->y_scale );
}
- metrics->x_ppem = (FT_UShort)( ( scaled_w + 32 ) >> 6 );
- metrics->y_ppem = (FT_UShort)( ( scaled_h + 32 ) >> 6 );
+ scaled_w = ( scaled_w + 32 ) >> 6;
+ scaled_h = ( scaled_h + 32 ) >> 6;
+ if ( scaled_w > (FT_Long)FT_USHORT_MAX ||
+ scaled_h > (FT_Long)FT_USHORT_MAX )
+ {
+ FT_ERROR(( "FT_Request_Metrics: Resulting ppem size too large\n" ));
+ error = FT_ERR( Invalid_Pixel_Size );
+ goto Exit;
+ }
+
+ metrics->x_ppem = (FT_UShort)scaled_w;
+ metrics->y_ppem = (FT_UShort)scaled_h;
ft_recompute_scaled_metrics( face, metrics );
}
@@ -3237,6 +3249,9 @@
metrics->x_scale = 1L << 16;
metrics->y_scale = 1L << 16;
}
+
+ Exit:
+ return error;
}
@@ -3300,7 +3315,7 @@
FT_Request_Size( FT_Face face,
FT_Size_Request req )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error;
FT_Driver_Class clazz;
FT_ULong strike_index;
@@ -3336,13 +3351,15 @@
*/
error = FT_Match_Size( face, req, 0, &strike_index );
if ( error )
- return error;
+ goto Exit;
return FT_Select_Size( face, (FT_Int)strike_index );
}
else
{
- FT_Request_Metrics( face, req );
+ error = FT_Request_Metrics( face, req );
+ if ( error )
+ goto Exit;
FT_TRACE5(( "FT_Request_Size:\n" ));
}
@@ -3365,6 +3382,7 @@
}
#endif
+ Exit:
return error;
}
@@ -3689,9 +3707,9 @@
FT_CharMap last_charmap = face->charmaps[face->num_charmaps - 1];
- if ( FT_RENEW_ARRAY( face->charmaps,
- face->num_charmaps,
- face->num_charmaps - 1 ) )
+ if ( FT_QRENEW_ARRAY( face->charmaps,
+ face->num_charmaps,
+ face->num_charmaps - 1 ) )
return;
/* remove it from our list of charmaps */
@@ -3723,7 +3741,7 @@
FT_CharMap charmap,
FT_CMap *acmap )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error;
FT_Face face;
FT_Memory memory;
FT_CMap cmap = NULL;
@@ -3748,9 +3766,9 @@
}
/* add it to our list of charmaps */
- if ( FT_RENEW_ARRAY( face->charmaps,
- face->num_charmaps,
- face->num_charmaps + 1 ) )
+ if ( FT_QRENEW_ARRAY( face->charmaps,
+ face->num_charmaps,
+ face->num_charmaps + 1 ) )
goto Fail;
face->charmaps[face->num_charmaps++] = (FT_CharMap)cmap;
@@ -4444,7 +4462,7 @@
FT_ListNode node = NULL;
- if ( FT_NEW( node ) )
+ if ( FT_QNEW( node ) )
goto Exit;
{
@@ -4685,7 +4703,7 @@
else
renderer = FT_Lookup_Renderer( library, slot->format, &node );
- error = FT_ERR( Unimplemented_Feature );
+ error = FT_ERR( Cannot_Render_Glyph );
while ( renderer )
{
error = renderer->render( renderer, slot, render_mode, NULL );
@@ -4701,6 +4719,11 @@
/* format. */
renderer = FT_Lookup_Renderer( library, slot->format, &node );
}
+
+ /* it is not an error if we cannot render a bitmap glyph */
+ if ( FT_ERR_EQ( error, Cannot_Render_Glyph ) &&
+ slot->format == FT_GLYPH_FORMAT_BITMAP )
+ error = FT_Err_Ok;
}
}
@@ -5639,6 +5662,35 @@
}
+ /* documentation is in ftcolor.h */
+
+ FT_EXPORT_DEF( FT_Bool )
+ FT_Get_Color_Glyph_ClipBox( FT_Face face,
+ FT_UInt base_glyph,
+ FT_ClipBox* clip_box )
+ {
+ TT_Face ttface;
+ SFNT_Service sfnt;
+
+
+ if ( !face || !clip_box )
+ return 0;
+
+ if ( !FT_IS_SFNT( face ) )
+ return 0;
+
+ ttface = (TT_Face)face;
+ sfnt = (SFNT_Service)ttface->sfnt;
+
+ if ( sfnt->get_color_glyph_clipbox )
+ return sfnt->get_color_glyph_clipbox( ttface,
+ base_glyph,
+ clip_box );
+ else
+ return 0;
+ }
+
+
/* documentation is in freetype.h */
FT_EXPORT_DEF( FT_Bool )
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c b/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c
index f14c7012cf1..5992998ba3e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftstream.c
@@ -61,7 +61,7 @@
if ( stream->read )
{
- if ( stream->read( stream, pos, 0, 0 ) )
+ if ( stream->read( stream, pos, NULL, 0 ) )
{
FT_ERROR(( "FT_Stream_Seek:"
" invalid i/o; pos = 0x%lx, size = 0x%lx\n",
@@ -347,17 +347,17 @@
}
- FT_BASE_DEF( FT_Char )
- FT_Stream_GetChar( FT_Stream stream )
+ FT_BASE_DEF( FT_Byte )
+ FT_Stream_GetByte( FT_Stream stream )
{
- FT_Char result;
+ FT_Byte result;
FT_ASSERT( stream && stream->cursor );
result = 0;
if ( stream->cursor < stream->limit )
- result = (FT_Char)*stream->cursor++;
+ result = *stream->cursor++;
return result;
}
@@ -455,8 +455,8 @@
}
- FT_BASE_DEF( FT_Char )
- FT_Stream_ReadChar( FT_Stream stream,
+ FT_BASE_DEF( FT_Byte )
+ FT_Stream_ReadByte( FT_Stream stream,
FT_Error* error )
{
FT_Byte result = 0;
@@ -464,31 +464,32 @@
FT_ASSERT( stream );
- *error = FT_Err_Ok;
-
- if ( stream->read )
+ if ( stream->pos < stream->size )
{
- if ( stream->read( stream, stream->pos, &result, 1L ) != 1L )
- goto Fail;
- }
- else
- {
- if ( stream->pos < stream->size )
- result = stream->base[stream->pos];
+ if ( stream->read )
+ {
+ if ( stream->read( stream, stream->pos, &result, 1L ) != 1L )
+ goto Fail;
+ }
else
- goto Fail;
+ result = stream->base[stream->pos];
}
+ else
+ goto Fail;
+
stream->pos++;
- return (FT_Char)result;
+ *error = FT_Err_Ok;
+
+ return result;
Fail:
*error = FT_THROW( Invalid_Stream_Operation );
- FT_ERROR(( "FT_Stream_ReadChar:"
+ FT_ERROR(( "FT_Stream_ReadByte:"
" invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
- return 0;
+ return result;
}
@@ -497,14 +498,12 @@
FT_Error* error )
{
FT_Byte reads[2];
- FT_Byte* p = 0;
+ FT_Byte* p;
FT_UShort result = 0;
FT_ASSERT( stream );
- *error = FT_Err_Ok;
-
if ( stream->pos + 1 < stream->size )
{
if ( stream->read )
@@ -525,6 +524,8 @@
stream->pos += 2;
+ *error = FT_Err_Ok;
+
return result;
Fail:
@@ -533,7 +534,7 @@
" invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
- return 0;
+ return result;
}
@@ -542,14 +543,12 @@
FT_Error* error )
{
FT_Byte reads[2];
- FT_Byte* p = 0;
+ FT_Byte* p;
FT_UShort result = 0;
FT_ASSERT( stream );
- *error = FT_Err_Ok;
-
if ( stream->pos + 1 < stream->size )
{
if ( stream->read )
@@ -570,6 +569,8 @@
stream->pos += 2;
+ *error = FT_Err_Ok;
+
return result;
Fail:
@@ -578,7 +579,7 @@
" invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
- return 0;
+ return result;
}
@@ -587,14 +588,12 @@
FT_Error* error )
{
FT_Byte reads[3];
- FT_Byte* p = 0;
+ FT_Byte* p;
FT_ULong result = 0;
FT_ASSERT( stream );
- *error = FT_Err_Ok;
-
if ( stream->pos + 2 < stream->size )
{
if ( stream->read )
@@ -615,6 +614,8 @@
stream->pos += 3;
+ *error = FT_Err_Ok;
+
return result;
Fail:
@@ -623,7 +624,7 @@
" invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
- return 0;
+ return result;
}
@@ -632,14 +633,12 @@
FT_Error* error )
{
FT_Byte reads[4];
- FT_Byte* p = 0;
+ FT_Byte* p;
FT_ULong result = 0;
FT_ASSERT( stream );
- *error = FT_Err_Ok;
-
if ( stream->pos + 3 < stream->size )
{
if ( stream->read )
@@ -660,6 +659,8 @@
stream->pos += 4;
+ *error = FT_Err_Ok;
+
return result;
Fail:
@@ -668,7 +669,7 @@
" invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
- return 0;
+ return result;
}
@@ -677,14 +678,12 @@
FT_Error* error )
{
FT_Byte reads[4];
- FT_Byte* p = 0;
+ FT_Byte* p;
FT_ULong result = 0;
FT_ASSERT( stream );
- *error = FT_Err_Ok;
-
if ( stream->pos + 3 < stream->size )
{
if ( stream->read )
@@ -705,6 +704,8 @@
stream->pos += 4;
+ *error = FT_Err_Ok;
+
return result;
Fail:
@@ -713,7 +714,7 @@
" invalid i/o; pos = 0x%lx, size = 0x%lx\n",
stream->pos, stream->size ));
- return 0;
+ return result;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c b/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c
index 990c46d9939..0ca6d7810a5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c
+++ b/Build/source/libs/freetype2/freetype-src/src/base/fttrigon.c
@@ -53,7 +53,7 @@
};
-#ifdef FT_LONG64
+#ifdef FT_INT64
/* multiply a given value by the CORDIC shrink factor */
static FT_Fixed
@@ -76,7 +76,7 @@
return s < 0 ? -val : val;
}
-#else /* !FT_LONG64 */
+#else /* !FT_INT64 */
/* multiply a given value by the CORDIC shrink factor */
static FT_Fixed
@@ -125,7 +125,7 @@
return s < 0 ? -val : val;
}
-#endif /* !FT_LONG64 */
+#endif /* !FT_INT64 */
/* undefined and never called for zero vector */
diff --git a/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc b/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc
index 5fe433cbd7f..a3d05b37806 100644
--- a/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc
+++ b/Build/source/libs/freetype2/freetype-src/src/base/ftver.rc
@@ -18,8 +18,8 @@
#include<windows.h>
-#define FT_VERSION 2,11,0,0
-#define FT_VERSION_STR "2.11.0"
+#define FT_VERSION 2,11,1,0
+#define FT_VERSION_STR "2.11.1"
VS_VERSION_INFO VERSIONINFO
FILEVERSION FT_VERSION
diff --git a/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c b/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c
index e3c12032b97..eb73a7cf934 100644
--- a/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/bdf/bdfdrivr.c
@@ -487,7 +487,7 @@ THE SOFTWARE.
else
{
/* this is a heuristical value */
- bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 );
+ bsize->width = ( bsize->height * 2 + 1 ) / 3;
}
prop = bdf_get_font_property( font, "POINT_SIZE" );
@@ -606,7 +606,7 @@ THE SOFTWARE.
unsigned long n;
- if ( FT_NEW_ARRAY( face->en_table, font->glyphs_size ) )
+ if ( FT_QNEW_ARRAY( face->en_table, font->glyphs_size ) )
goto Exit;
face->default_glyph = 0;
diff --git a/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c b/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
index 8db9940f12a..b65c8a2f3e0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
+++ b/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
@@ -170,7 +170,7 @@
/* An auxiliary macro to parse properties, to be used in conditionals. */
/* It behaves like `strncmp' but also tests the following character */
- /* whether it is a whitespace or NULL. */
+ /* whether it is a whitespace or null. */
/* `property' is a constant string of length `n' to compare with. */
#define _bdf_strncmp( name, property, n ) \
( ft_strncmp( name, property, n ) || \
@@ -346,7 +346,7 @@
unsigned long i, u;
- if ( list == 0 || list->used == 0 || n == 0 )
+ if ( list == NULL || list->used == 0 || n == 0 )
return;
if ( n >= list->used )
@@ -377,7 +377,7 @@
*alen = 0;
- if ( list == 0 || list->used == 0 )
+ if ( list == NULL || list->used == 0 )
return 0;
dp = list->field[0];
@@ -436,7 +436,7 @@
/* In the original code, if the `separators' parameter is NULL or */
/* empty, the list is split into individual bytes. We don't need */
/* this, so an error is signaled. */
- if ( separators == 0 || *separators == 0 )
+ if ( separators == NULL || *separators == 0 )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
@@ -504,7 +504,7 @@
if ( final_empty )
list->field[list->used++] = (char*)empty;
- list->field[list->used] = 0;
+ list->field[list->used] = NULL;
Exit:
return error;
@@ -529,7 +529,7 @@
FT_Error error = FT_Err_Ok;
- if ( callback == 0 )
+ if ( callback == NULL )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
@@ -581,8 +581,14 @@
/* or even resizing it */
if ( end >= avail )
{
- if ( bytes == 0 ) /* last line in file doesn't end in \r or \n */
- break; /* ignore it then exit */
+ if ( bytes == 0 )
+ {
+ /* last line in file doesn't end in \r or \n; */
+ /* ignore it then exit */
+ if ( lineno == 1 )
+ error = FT_THROW( Missing_Startfont_Field );
+ break;
+ }
if ( start == 0 )
{
@@ -593,8 +599,13 @@
if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */
{
- FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno ));
- error = FT_THROW( Invalid_Argument );
+ if ( lineno == 1 )
+ error = FT_THROW( Missing_Startfont_Field );
+ else
+ {
+ FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno ));
+ error = FT_THROW( Invalid_Argument );
+ }
goto Exit;
}
@@ -697,7 +708,7 @@
unsigned long v;
- if ( s == 0 || *s == 0 )
+ if ( s == NULL || *s == 0 )
return 0;
for ( v = 0; sbitset( ddigits, *s ); s++ )
@@ -722,7 +733,7 @@
long v, neg;
- if ( s == 0 || *s == 0 )
+ if ( s == NULL || *s == 0 )
return 0;
/* Check for a minus sign. */
@@ -755,7 +766,7 @@
unsigned short v;
- if ( s == 0 || *s == 0 )
+ if ( s == NULL || *s == 0 )
return 0;
for ( v = 0; sbitset( ddigits, *s ); s++ )
@@ -780,7 +791,7 @@
short v, neg;
- if ( s == 0 || *s == 0 )
+ if ( s == NULL || *s == 0 )
return 0;
/* Check for a minus. */
@@ -852,7 +863,7 @@
p = font->user_props + font->nuser_props;
n = ft_strlen( name ) + 1;
- if ( n > FT_ULONG_MAX )
+ if ( n > FT_LONG_MAX )
return FT_THROW( Invalid_Argument );
if ( FT_QALLOC( p->name, n ) )
@@ -860,8 +871,9 @@
FT_MEM_COPY( (char *)p->name, name, n );
- p->format = format;
- p->builtin = 0;
+ p->format = format;
+ p->builtin = 0;
+ p->value.atom = NULL; /* nothing is ever stored here */
n = _num_bdf_properties + font->nuser_props;
@@ -883,7 +895,7 @@
size_t* propid;
- if ( name == 0 || *name == 0 )
+ if ( name == NULL || *name == 0 )
return 0;
if ( ( propid = ft_hash_str_lookup( name, &(font->proptbl) ) ) == NULL )
@@ -949,7 +961,7 @@
cp = font->comments + font->comments_len;
FT_MEM_COPY( cp, comment, len );
- cp[len] = '\n';
+ cp[len] = '\0';
font->comments_len += len + 1;
@@ -974,7 +986,7 @@
FT_UNUSED( lineno ); /* only used in debug mode */
- if ( font == 0 || font->name == 0 || font->name[0] == 0 )
+ if ( font == NULL || font->name == NULL || font->name[0] == 0 )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
@@ -1181,8 +1193,8 @@
switch ( prop->format )
{
case BDF_ATOM:
- fp->value.atom = 0;
- if ( value != 0 && value[0] )
+ fp->value.atom = NULL;
+ if ( value && value[0] )
{
if ( FT_STRDUP( fp->value.atom, value ) )
goto Exit;
@@ -1304,15 +1316,18 @@
/* Check for a comment. */
if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
{
- linelen -= 7;
-
- s = line + 7;
- if ( *s != 0 )
+ if ( p->opts->keep_comments )
{
- s++;
- linelen--;
+ linelen -= 7;
+
+ s = line + 7;
+ if ( *s != 0 )
+ {
+ s++;
+ linelen--;
+ }
+ error = _bdf_add_comment( p->font, s, linelen );
}
- error = _bdf_add_comment( p->font, s, linelen );
goto Exit;
}
@@ -1496,7 +1511,7 @@
{
/* Unencoded glyph. Check whether it should */
/* be added or not. */
- if ( p->opts->keep_unencoded != 0 )
+ if ( p->opts->keep_unencoded )
{
/* Allocate the next unencoded glyph. */
if ( font->unencoded_used == font->unencoded_size )
@@ -1609,20 +1624,20 @@
if ( error )
goto Exit;
- glyph->swidth = (unsigned short)_bdf_atoul( p->list.field[1] );
+ glyph->swidth = _bdf_atous( p->list.field[1] );
p->flags |= BDF_SWIDTH_;
goto Exit;
}
- /* Expect the DWIDTH (scalable width) field next. */
+ /* Expect the DWIDTH (device width) field next. */
if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 )
{
error = _bdf_list_split( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- glyph->dwidth = (unsigned short)_bdf_atoul( p->list.field[1] );
+ glyph->dwidth = _bdf_atous( p->list.field[1] );
if ( !( p->flags & BDF_SWIDTH_ ) )
{
@@ -1677,7 +1692,7 @@
/* If the BDF_CORRECT_METRICS flag is set, then adjust the SWIDTH */
/* value if necessary. */
- if ( p->opts->correct_metrics != 0 )
+ if ( p->opts->correct_metrics )
{
/* Determine the point size of the glyph. */
unsigned short sw = (unsigned short)FT_MulDiv(
@@ -1884,7 +1899,7 @@
/* comments before the STARTFONT line for some reason. */
if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
{
- if ( p->opts->keep_comments != 0 && p->font != 0 )
+ if ( p->opts->keep_comments && p->font )
{
linelen -= 7;
@@ -1894,13 +1909,8 @@
s++;
linelen--;
}
-
error = _bdf_add_comment( p->font, s, linelen );
- if ( error )
- goto Exit;
- /* here font is not defined! */
}
-
goto Exit;
}
@@ -1917,14 +1927,13 @@
}
p->flags = BDF_START_;
- font = p->font = 0;
+ font = p->font = NULL;
if ( FT_NEW( font ) )
goto Exit;
p->font = font;
font->memory = p->memory;
- p->memory = 0;
{ /* setup */
size_t i;
@@ -2085,7 +2094,7 @@
unsigned short bpp;
- bpp = (unsigned short)_bdf_atos( p->list.field[4] );
+ bpp = _bdf_atous( p->list.field[4] );
/* Only values 1, 2, 4, 8 are allowed for greymap fonts. */
if ( bpp > 4 )
@@ -2164,34 +2173,32 @@
FT_LOCAL_DEF( FT_Error )
bdf_load_font( FT_Stream stream,
- FT_Memory extmemory,
+ FT_Memory memory,
bdf_options_t* opts,
bdf_font_t* *font )
{
unsigned long lineno = 0; /* make compiler happy */
_bdf_parse_t *p = NULL;
- FT_Memory memory = extmemory; /* needed for FT_NEW */
- FT_Error error = FT_Err_Ok;
+ FT_Error error = FT_Err_Ok;
if ( FT_NEW( p ) )
goto Exit;
- memory = NULL;
- p->opts = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts );
+ p->opts = (bdf_options_t*)( opts ? opts : &_bdf_opts );
p->minlb = 32767;
p->size = stream->size;
- p->memory = extmemory; /* only during font creation */
+ p->memory = memory; /* only during font creation */
- _bdf_list_init( &p->list, extmemory );
+ _bdf_list_init( &p->list, memory );
error = _bdf_readstream( stream, _bdf_parse_start,
(void *)p, &lineno );
if ( error )
goto Fail;
- if ( p->font != 0 )
+ if ( p->font )
{
/* If the font is not proportional, set the font's monowidth */
/* field to the width of the font bounding box. */
@@ -2272,22 +2279,7 @@
}
}
- if ( p->font != 0 )
- {
- /* Make sure the comments are NULL terminated if they exist. */
- memory = p->font->memory;
-
- if ( p->font->comments_len > 0 )
- {
- if ( FT_QRENEW_ARRAY( p->font->comments,
- p->font->comments_len,
- p->font->comments_len + 1 ) )
- goto Fail;
-
- p->font->comments[p->font->comments_len] = 0;
- }
- }
- else if ( !error )
+ if ( !p->font && !error )
error = FT_THROW( Invalid_File_Format );
*font = p->font;
@@ -2297,8 +2289,6 @@
{
_bdf_list_done( &p->list );
- memory = extmemory;
-
FT_FREE( p->glyph_name );
FT_FREE( p );
}
@@ -2308,8 +2298,6 @@
Fail:
bdf_free_font( p->font );
- memory = extmemory;
-
FT_FREE( p->font );
goto Exit;
@@ -2325,7 +2313,7 @@
FT_Memory memory;
- if ( font == 0 )
+ if ( font == NULL )
return;
memory = font->memory;
@@ -2375,11 +2363,7 @@
/* Free up the user defined properties. */
for ( prop = font->user_props, i = 0;
i < font->nuser_props; i++, prop++ )
- {
FT_FREE( prop->name );
- if ( prop->format == BDF_ATOM )
- FT_FREE( prop->value.atom );
- }
FT_FREE( font->user_props );
@@ -2394,7 +2378,7 @@
size_t* propid;
- if ( font == 0 || font->props_size == 0 || name == 0 || *name == 0 )
+ if ( font == NULL || font->props_size == 0 || name == NULL || *name == 0 )
return 0;
propid = ft_hash_str_lookup( name, (FT_Hash)font->internal );
diff --git a/Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c b/Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c
index 3df7496a6ef..296cea088b6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c
+++ b/Build/source/libs/freetype2/freetype-src/src/bzip2/ftbzip2.c
@@ -70,7 +70,7 @@
FT_Pointer p = NULL;
- (void)FT_QALLOC( p, sz );
+ FT_MEM_QALLOC( p, sz );
return p;
}
@@ -327,12 +327,13 @@
FT_ULong count )
{
FT_Error error = FT_Err_Ok;
- FT_ULong delta;
for (;;)
{
- delta = (FT_ULong)( zip->limit - zip->cursor );
+ FT_ULong delta = (FT_ULong)( zip->limit - zip->cursor );
+
+
if ( delta >= count )
delta = count;
@@ -494,7 +495,7 @@
stream->size = 0x7FFFFFFFL; /* don't know the real size! */
stream->pos = 0;
- stream->base = 0;
+ stream->base = NULL;
stream->read = ft_bzip2_stream_io;
stream->close = ft_bzip2_stream_close;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c
index 4c0324278f5..5bbf3292983 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.c
@@ -90,15 +90,14 @@
ftc_get_top_node_for_hash( FTC_Cache cache,
FT_Offset hash )
{
- FTC_Node* pnode;
FT_Offset idx;
idx = hash & cache->mask;
if ( idx < cache->p )
idx = hash & ( 2 * cache->mask + 1 );
- pnode = cache->buckets + idx;
- return pnode;
+
+ return cache->buckets + idx;
}
#endif /* !FTC_INLINE */
@@ -119,7 +118,7 @@
FT_UFast count = mask + p + 1; /* number of buckets */
- /* do we need to shrink the buckets array? */
+ /* do we need to expand the buckets array? */
if ( cache->slack < 0 )
{
FTC_Node new_list = NULL;
@@ -172,7 +171,7 @@
cache->p = p + 1;
}
- /* do we need to expand the buckets array? */
+ /* do we need to shrink the buckets array? */
else if ( cache->slack > (FT_Long)count * FTC_HASH_SUB_LOAD )
{
FT_UFast old_index = p + mask;
@@ -189,7 +188,7 @@
/* if we can't shrink the array, leave immediately */
- if ( FT_RENEW_ARRAY( cache->buckets,
+ if ( FT_QRENEW_ARRAY( cache->buckets,
( mask + 1 ) * 2, mask + 1 ) )
break;
@@ -341,7 +340,7 @@
cache->mask = FTC_HASH_INITIAL_SIZE - 1;
cache->slack = FTC_HASH_INITIAL_SIZE * FTC_HASH_MAX_LOAD;
- (void)FT_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE * 2 );
+ FT_MEM_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE * 2 );
return error;
}
@@ -360,7 +359,7 @@
for ( i = 0; i < count; i++ )
{
- FTC_Node *pnode = cache->buckets + i, next, node = *pnode;
+ FTC_Node node = cache->buckets[i], next;
while ( node )
@@ -417,7 +416,7 @@
FTC_Node node )
{
node->hash = hash;
- node->cache_index = (FT_UInt16)cache->index;
+ node->cache_index = (FT_UShort)cache->index;
node->ref_count = 0;
ftc_node_hash_link( node, cache );
@@ -528,7 +527,7 @@
goto NewNode;
}
else
- pnode = &((*pnode)->link);
+ pnode = &(*pnode)->link;
}
}
@@ -571,8 +570,7 @@
count = cache->p + cache->mask + 1;
for ( i = 0; i < count; i++ )
{
- FTC_Node* bucket = cache->buckets + i;
- FTC_Node* pnode = bucket;
+ FTC_Node* pnode = cache->buckets + i;
for (;;)
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h b/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h
index 73410933ef3..4849b92352d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftccache.h
@@ -251,7 +251,7 @@ FT_BEGIN_HEADER
goto NewNode_; \
} \
else \
- _pnode = &((*_pnode)->link); \
+ _pnode = &(*_pnode)->link; \
} \
} \
\
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c
index cfce0a6d32a..40b449b9ccb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftccmap.c
@@ -273,12 +273,11 @@
if ( error )
goto Exit;
- FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) <
- FTC_CMAP_INDICES_MAX );
+ FT_ASSERT( char_code - FTC_CMAP_NODE( node )->first <
+ FTC_CMAP_INDICES_MAX );
/* something rotten can happen with rogue clients */
- if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >=
- FTC_CMAP_INDICES_MAX ) )
+ if ( char_code - FTC_CMAP_NODE( node )->first >= FTC_CMAP_INDICES_MAX )
return 0; /* XXX: should return appropriate error */
gindex = FTC_CMAP_NODE( node )->indices[char_code -
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c
index 312a83cfb67..512de8a3fc5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmanag.c
@@ -357,7 +357,7 @@
{
FT_Error error;
FT_Memory memory;
- FTC_Manager manager = 0;
+ FTC_Manager manager = NULL;
if ( !library )
@@ -368,7 +368,7 @@
memory = library->memory;
- if ( FT_NEW( manager ) )
+ if ( FT_QNEW( manager ) )
goto Exit;
if ( max_faces == 0 )
@@ -399,6 +399,10 @@
manager,
memory );
+ manager->nodes_list = NULL;
+ manager->num_nodes = 0;
+ manager->num_caches = 0;
+
*amanager = manager;
Exit:
@@ -593,7 +597,7 @@
goto Exit;
}
- if ( !FT_ALLOC( cache, clazz->cache_size ) )
+ if ( !FT_QALLOC( cache, clazz->cache_size ) )
{
cache->manager = manager;
cache->memory = memory;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c
index 1a9d8281d15..2cac6f9d3aa 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcmru.c
@@ -262,7 +262,7 @@
if ( list->clazz.node_done )
list->clazz.node_done( node, list->data );
}
- else if ( FT_ALLOC( node, list->clazz.node_size ) )
+ else if ( FT_QALLOC( node, list->clazz.node_size ) )
goto Exit;
error = list->clazz.node_init( node, key, list->data );
diff --git a/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c b/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c
index 7e24d81d93d..362999fce0a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cache/ftcsbits.c
@@ -111,7 +111,7 @@
FTC_SFamilyClass clazz;
- if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count )
+ if ( gindex - gnode->gindex >= snode->count )
{
FT_ERROR(( "ftc_snode_load: invalid glyph index" ));
return FT_THROW( Invalid_Argument );
@@ -342,8 +342,8 @@
if (list_changed)
*list_changed = FALSE;
- result = FT_BOOL( gnode->family == gquery->family &&
- (FT_UInt)( gindex - gnode->gindex ) < snode->count );
+ result = FT_BOOL( gnode->family == gquery->family &&
+ gindex - gnode->gindex < snode->count );
if ( result )
{
/* check if we need to load the glyph bitmap now */
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c
index 9bde3c7b7f9..59210f37c52 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffdrivr.c
@@ -474,11 +474,11 @@
if ( cff && !cff->font_info )
{
CFF_FontRecDict dict = &cff->top_font.font_dict;
- PS_FontInfoRec *font_info = NULL;
FT_Memory memory = face->root.memory;
+ PS_FontInfoRec* font_info = NULL;
- if ( FT_QALLOC( font_info, sizeof ( *font_info ) ) )
+ if ( FT_QNEW( font_info ) )
goto Fail;
font_info->version = cff_index_get_sid_string( cff,
@@ -515,15 +515,15 @@
FT_Error error = FT_Err_Ok;
- if ( cff && cff->font_extra == NULL )
+ if ( cff && !cff->font_extra )
{
CFF_FontRecDict dict = &cff->top_font.font_dict;
- PS_FontExtraRec* font_extra = NULL;
FT_Memory memory = face->root.memory;
+ PS_FontExtraRec* font_extra = NULL;
FT_String* embedded_postscript;
- if ( FT_ALLOC( font_extra, sizeof ( *font_extra ) ) )
+ if ( FT_QNEW( font_extra ) )
goto Fail;
font_extra->fs_type = 0U;
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c
index 831b3ae1df2..97e8f9c1c65 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffgload.c
@@ -59,7 +59,7 @@
*pointer = (FT_Byte*)data.pointer;
- *length = (FT_ULong)data.length;
+ *length = data.length;
return error;
}
@@ -94,7 +94,7 @@
data.pointer = *pointer;
- data.length = (FT_Int)length;
+ data.length = (FT_UInt)length;
face->root.internal->incremental_interface->funcs->free_glyph_data(
face->root.internal->incremental_interface->object, &data );
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffload.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffload.c
index 4a4010d6147..3c3f6fe502f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffload.c
@@ -400,7 +400,7 @@
/* Allocate a table containing pointers to an index's elements. */
/* The `pool' argument makes this function convert the index */
- /* entries to C-style strings (this is, NULL-terminated). */
+ /* entries to C-style strings (this is, null-terminated). */
static FT_Error
cff_index_get_pointers( CFF_Index idx,
FT_Byte*** table,
@@ -622,7 +622,7 @@
FT_Byte* bytes;
FT_ULong byte_len;
FT_Error error;
- FT_String* name = 0;
+ FT_String* name = NULL;
if ( !idx->stream ) /* CFF2 does not include a name index */
@@ -771,8 +771,7 @@
case 3:
/* first, compare to the cache */
- if ( (FT_UInt)( glyph_index - fdselect->cache_first ) <
- fdselect->cache_count )
+ if ( glyph_index - fdselect->cache_first < fdselect->cache_count )
{
fd = fdselect->cache_fd;
break;
@@ -835,7 +834,6 @@
{
FT_Error error = FT_Err_Ok;
FT_UInt i;
- FT_Long j;
FT_UShort max_cid = 0;
@@ -853,9 +851,10 @@
/* 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 = (FT_Long)num_glyphs - 1; j >= 0; j-- )
- charset->cids[charset->sids[j]] = (FT_UShort)j;
+ /* behaviour of recent Acroread versions. The loop stops when */
+ /* the unsigned index wraps around after reaching zero. */
+ for ( i = num_glyphs - 1; i < num_glyphs; i-- )
+ charset->cids[charset->sids[i]] = (FT_UShort)i;
charset->max_cid = max_cid;
charset->num_glyphs = num_glyphs;
@@ -1139,6 +1138,8 @@
{
FT_UInt vsOffset;
FT_UInt format;
+ FT_UInt dataCount;
+ FT_UInt regionCount;
FT_ULong regionListOffset;
@@ -1161,16 +1162,16 @@
}
/* read top level fields */
- if ( FT_READ_ULONG( regionListOffset ) ||
- FT_READ_USHORT( vstore->dataCount ) )
+ if ( FT_READ_ULONG( regionListOffset ) ||
+ FT_READ_USHORT( dataCount ) )
goto Exit;
/* make temporary copy of item variation data offsets; */
/* we'll parse region list first, then come back */
- if ( FT_QNEW_ARRAY( dataOffsetArray, vstore->dataCount ) )
+ if ( FT_QNEW_ARRAY( dataOffsetArray, dataCount ) )
goto Exit;
- for ( i = 0; i < vstore->dataCount; i++ )
+ for ( i = 0; i < dataCount; i++ )
{
if ( FT_READ_ULONG( dataOffsetArray[i] ) )
goto Exit;
@@ -1179,13 +1180,14 @@
/* parse regionList and axisLists */
if ( FT_STREAM_SEEK( vsOffset + regionListOffset ) ||
FT_READ_USHORT( vstore->axisCount ) ||
- FT_READ_USHORT( vstore->regionCount ) )
+ FT_READ_USHORT( regionCount ) )
goto Exit;
- if ( FT_QNEW_ARRAY( vstore->varRegionList, vstore->regionCount ) )
+ vstore->regionCount = 0;
+ if ( FT_QNEW_ARRAY( vstore->varRegionList, regionCount ) )
goto Exit;
- for ( i = 0; i < vstore->regionCount; i++ )
+ for ( i = 0; i < regionCount; i++ )
{
CFF_VarRegion* region = &vstore->varRegionList[i];
@@ -1193,6 +1195,9 @@
if ( FT_QNEW_ARRAY( region->axisList, vstore->axisCount ) )
goto Exit;
+ /* keep track of how many axisList to deallocate on error */
+ vstore->regionCount++;
+
for ( j = 0; j < vstore->axisCount; j++ )
{
CFF_AxisCoords* axis = &region->axisList[j];
@@ -1212,10 +1217,11 @@
}
/* use dataOffsetArray now to parse varData items */
- if ( FT_QNEW_ARRAY( vstore->varData, vstore->dataCount ) )
+ vstore->dataCount = 0;
+ if ( FT_QNEW_ARRAY( vstore->varData, dataCount ) )
goto Exit;
- for ( i = 0; i < vstore->dataCount; i++ )
+ for ( i = 0; i < dataCount; i++ )
{
CFF_VarData* data = &vstore->varData[i];
@@ -1237,6 +1243,9 @@
if ( FT_QNEW_ARRAY( data->regionIndices, data->regionIdxCount ) )
goto Exit;
+ /* keep track of how many regionIndices to deallocate on error */
+ vstore->dataCount++;
+
for ( j = 0; j < data->regionIdxCount; j++ )
{
if ( FT_READ_USHORT( data->regionIndices[j] ) )
@@ -1819,7 +1828,8 @@
/* Construct code to GID mapping from code to SID mapping */
/* and charset. */
- encoding->count = 0;
+ encoding->offset = offset; /* used in cff_face_init */
+ encoding->count = 0;
error = cff_charset_compute_cids( charset, num_glyphs,
stream->memory );
diff --git a/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c b/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c
index c50281342de..3a4d47dbddd 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cff/cffobjs.c
@@ -283,6 +283,8 @@
cff_size_request( FT_Size size,
FT_Size_Request req )
{
+ FT_Error error;
+
CFF_Size cffsize = (CFF_Size)size;
PSH_Globals_Funcs funcs;
@@ -304,7 +306,9 @@
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
- FT_Request_Metrics( size->face, req );
+ error = FT_Request_Metrics( size->face, req );
+ if ( error )
+ goto Exit;
funcs = cff_size_get_globals_funcs( cffsize );
@@ -345,7 +349,8 @@
}
}
- return FT_Err_Ok;
+ Exit:
+ return error;
}
@@ -684,13 +689,13 @@
/* In Multiple Master CFFs, two SIDs hold the Normalize Design */
/* Vector (NDV) and Convert Design Vector (CDV) charstrings, */
- /* which may contain NULL bytes in the middle of the data, too. */
+ /* which may contain null bytes in the middle of the data, too. */
/* We thus access `cff->strings' directly. */
for ( idx = 1; idx < cff->num_strings; idx++ )
{
FT_Byte* s1 = cff->strings[idx - 1];
FT_Byte* s2 = cff->strings[idx];
- FT_PtrDist s1len = s2 - s1 - 1; /* without the final NULL byte */
+ FT_PtrDist s1len = s2 - s1 - 1; /* without the final null byte */
FT_PtrDist l;
@@ -1049,11 +1054,11 @@
{
FT_CharMapRec cmaprec;
FT_CharMap cmap;
- FT_UInt nn;
+ FT_Int nn;
CFF_Encoding encoding = &cff->encoding;
- for ( nn = 0; nn < (FT_UInt)cffface->num_charmaps; nn++ )
+ for ( nn = 0; nn < cffface->num_charmaps; nn++ )
{
cmap = cffface->charmaps[nn];
@@ -1078,7 +1083,7 @@
cmaprec.encoding_id = TT_MS_ID_UNICODE_CS;
cmaprec.encoding = FT_ENCODING_UNICODE;
- nn = (FT_UInt)cffface->num_charmaps;
+ nn = cffface->num_charmaps;
error = FT_CMap_New( &cff_cmap_unicode_class_rec, NULL,
&cmaprec, NULL );
@@ -1089,7 +1094,7 @@
error = FT_Err_Ok;
/* if no Unicode charmap was previously selected, select this one */
- if ( !cffface->charmap && nn != (FT_UInt)cffface->num_charmaps )
+ if ( !cffface->charmap && nn != cffface->num_charmaps )
cffface->charmap = cffface->charmaps[nn];
Skip_Unicode:
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c
index bd0a7e7fb10..a46d063dfeb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidgload.c
@@ -63,7 +63,7 @@
#endif
- FT_TRACE1(( "cid_load_glyph: glyph index %d\n", glyph_index ));
+ FT_TRACE1(( "cid_load_glyph: glyph index %u\n", glyph_index ));
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -76,20 +76,17 @@
error = inc->funcs->get_glyph_data( inc->object,
glyph_index, &glyph_data );
- if ( error )
+ if ( error || glyph_data.length < cid->fd_bytes )
goto Exit;
p = (FT_Byte*)glyph_data.pointer;
- fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
+ fd_select = cid_get_offset( &p, cid->fd_bytes );
- if ( glyph_data.length != 0 )
- {
- glyph_length = (FT_ULong)( glyph_data.length - cid->fd_bytes );
+ glyph_length = glyph_data.length - cid->fd_bytes;
- if ( !FT_QALLOC( charstring, glyph_length ) )
- FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes,
- glyph_length );
- }
+ if ( !FT_QALLOC( charstring, glyph_length ) )
+ FT_MEM_COPY( charstring, glyph_data.pointer + cid->fd_bytes,
+ glyph_length );
inc->funcs->free_glyph_data( inc->object, &glyph_data );
@@ -104,7 +101,7 @@
/* For ordinary fonts read the CID font dictionary index */
/* and charstring offset from the CIDMap. */
{
- FT_UInt entry_len = (FT_UInt)( cid->fd_bytes + cid->gd_bytes );
+ FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes;
FT_ULong off1, off2;
@@ -114,15 +111,15 @@
goto Exit;
p = (FT_Byte*)stream->cursor;
- fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
- off1 = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
+ fd_select = cid_get_offset( &p, cid->fd_bytes );
+ off1 = cid_get_offset( &p, cid->gd_bytes );
p += cid->fd_bytes;
- off2 = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
+ off2 = cid_get_offset( &p, cid->gd_bytes );
FT_FRAME_EXIT();
- if ( fd_select >= (FT_ULong)cid->num_dicts ||
- off2 > stream->size ||
- off1 > off2 )
+ if ( fd_select >= cid->num_dicts ||
+ off2 > stream->size ||
+ off1 > off2 )
{
FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" ));
error = FT_THROW( Invalid_Offset );
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidload.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidload.c
index 7fd0d7c78c2..496219de804 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidload.c
@@ -41,7 +41,7 @@
/* read a single offset */
FT_LOCAL_DEF( FT_ULong )
cid_get_offset( FT_Byte* *start,
- FT_Byte offsize )
+ FT_UInt offsize )
{
FT_ULong result;
FT_Byte* p = *start;
@@ -113,7 +113,7 @@
CID_FaceDict dict;
- if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts )
+ if ( parser->num_dict >= cid->num_dicts )
{
FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n",
keyword->ident ));
@@ -164,7 +164,7 @@
FT_Fixed temp_scale;
- if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
+ if ( parser->num_dict < face->cid.num_dicts )
{
FT_Matrix* matrix;
FT_Vector* offset;
@@ -244,11 +244,11 @@
FT_Memory memory = face->root.memory;
FT_Stream stream = parser->stream;
FT_Error error = FT_Err_Ok;
- FT_Long num_dicts;
+ FT_Long num_dicts, max_dicts;
num_dicts = cid_parser_to_int( parser );
- if ( num_dicts < 0 )
+ if ( num_dicts < 0 || num_dicts > FT_INT_MAX )
{
FT_ERROR(( "parse_fd_array: invalid number of dictionaries\n" ));
goto Exit;
@@ -272,18 +272,18 @@
* need a `dup X' at the very beginning and a `put' at the end, so a
* rough guess using 100 bytes as the minimum is justified.
*/
- if ( (FT_ULong)num_dicts > stream->size / 100 )
+ max_dicts = (FT_Long)( stream->size / 100 );
+ if ( num_dicts > max_dicts )
{
FT_TRACE0(( "parse_fd_array: adjusting FDArray size"
" (from %ld to %ld)\n",
- num_dicts,
- stream->size / 100 ));
- num_dicts = (FT_Long)( stream->size / 100 );
+ num_dicts, max_dicts ));
+ num_dicts = max_dicts;
}
if ( !cid->font_dicts )
{
- FT_Int n;
+ FT_UInt n;
if ( FT_NEW_ARRAY( cid->font_dicts, num_dicts ) )
@@ -322,7 +322,7 @@
CID_FaceDict dict;
- if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
+ if ( parser->num_dict < face->cid.num_dicts )
{
dict = face->cid.font_dicts + parser->num_dict;
@@ -345,7 +345,7 @@
CID_Parser* parser )
{
#ifdef FT_DEBUG_LEVEL_TRACE
- if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
+ if ( parser->num_dict < face->cid.num_dicts )
{
T1_TokenRec token;
FT_UInt len;
@@ -427,7 +427,7 @@
parser->num_dict++;
#ifdef FT_DEBUG_LEVEL_TRACE
- FT_TRACE4(( " FontDict %d", parser->num_dict ));
+ FT_TRACE4(( " FontDict %u", parser->num_dict ));
if ( parser->num_dict > face->cid.num_dicts )
FT_TRACE4(( " (ignored)" ));
FT_TRACE4(( "\n" ));
@@ -517,7 +517,7 @@
FT_Memory memory = face->root.memory;
FT_Stream stream = face->cid_stream;
FT_Error error;
- FT_Int n;
+ FT_UInt n;
CID_Subrs subr;
FT_UInt max_offsets = 0;
FT_ULong* offsets = NULL;
@@ -559,13 +559,13 @@
}
/* read the subrmap's offsets */
- if ( FT_STREAM_SEEK( cid->data_offset + dict->subrmap_offset ) ||
- FT_FRAME_ENTER( ( num_subrs + 1 ) * (FT_UInt)dict->sd_bytes ) )
+ if ( FT_STREAM_SEEK( cid->data_offset + dict->subrmap_offset ) ||
+ FT_FRAME_ENTER( ( num_subrs + 1 ) * dict->sd_bytes ) )
goto Fail;
p = (FT_Byte*)stream->cursor;
for ( count = 0; count <= num_subrs; count++ )
- offsets[count] = cid_get_offset( &p, (FT_Byte)dict->sd_bytes );
+ offsets[count] = cid_get_offset( &p, dict->sd_bytes );
FT_FRAME_EXIT();
@@ -594,7 +594,7 @@
goto Fail;
if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
- FT_STREAM_READ( subr->code[0], data_len ) )
+ FT_STREAM_READ( subr->code[0], data_len ) )
goto Fail;
/* set up pointers */
@@ -771,12 +771,11 @@
CID_Parser* parser;
FT_Memory memory = face->root.memory;
FT_Error error;
- FT_Int n;
+ FT_UInt n;
CID_FaceInfo cid = &face->cid;
FT_ULong binary_length;
- FT_ULong entry_len;
cid_init_loader( &loader, face );
@@ -805,7 +804,7 @@
face->root.stream->size - parser->data_offset )
{
FT_TRACE0(( "cid_face_open: adjusting length of binary data\n" ));
- FT_TRACE0(( " (from %ld to %ld bytes)\n",
+ FT_TRACE0(( " (from %lu to %lu bytes)\n",
parser->binary_length,
face->root.stream->size - parser->data_offset ));
parser->binary_length = face->root.stream->size -
@@ -833,10 +832,10 @@
/* sanity tests */
- if ( cid->fd_bytes < 0 || cid->gd_bytes < 1 )
+ if ( cid->gd_bytes == 0 )
{
FT_ERROR(( "cid_face_open:"
- " Invalid `FDBytes' or `GDBytes' value\n" ));
+ " Invalid `GDBytes' value\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -853,7 +852,24 @@
}
binary_length = face->cid_stream->size - cid->data_offset;
- entry_len = (FT_ULong)( cid->fd_bytes + cid->gd_bytes );
+
+ if ( cid->cidmap_offset > binary_length )
+ {
+ FT_ERROR(( "cid_face_open: Invalid `CIDMapOffset' value\n" ));
+ error = FT_THROW( Invalid_File_Format );
+ goto Exit;
+ }
+
+ /* the initial pre-check prevents the multiplication overflow */
+ if ( cid->cid_count > FT_ULONG_MAX / 8 ||
+ cid->cid_count * ( cid->fd_bytes + cid->gd_bytes ) >
+ binary_length - cid->cidmap_offset )
+ {
+ FT_ERROR(( "cid_face_open: Invalid `CIDCount' value\n" ));
+ error = FT_THROW( Invalid_File_Format );
+ goto Exit;
+ }
+
for ( n = 0; n < cid->num_dicts; n++ )
{
@@ -879,8 +895,7 @@
dict->private_dict.blue_fuzz = 1;
}
- if ( dict->sd_bytes < 0 ||
- ( dict->num_subrs && dict->sd_bytes < 1 ) )
+ if ( dict->num_subrs && dict->sd_bytes == 0 )
{
FT_ERROR(( "cid_face_open: Invalid `SDBytes' value\n" ));
error = FT_THROW( Invalid_File_Format );
@@ -903,11 +918,10 @@
goto Exit;
}
- /* `num_subrs' is scanned as a signed integer */
- if ( (FT_Int)dict->num_subrs < 0 ||
- ( dict->sd_bytes &&
- dict->num_subrs > ( binary_length - dict->subrmap_offset ) /
- (FT_UInt)dict->sd_bytes ) )
+ /* the initial pre-check prevents the multiplication overflow */
+ if ( dict->num_subrs > FT_UINT_MAX / 4 ||
+ dict->num_subrs * dict->sd_bytes >
+ binary_length - dict->subrmap_offset )
{
FT_ERROR(( "cid_face_open: Invalid `SubrCount' value\n" ));
error = FT_THROW( Invalid_File_Format );
@@ -915,22 +929,6 @@
}
}
- if ( cid->cidmap_offset > binary_length )
- {
- FT_ERROR(( "cid_face_open: Invalid `CIDMapOffset' value\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( entry_len &&
- cid->cid_count >
- ( binary_length - cid->cidmap_offset ) / entry_len )
- {
- FT_ERROR(( "cid_face_open: Invalid `CIDCount' value\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
/* we can now safely proceed */
error = cid_read_subrs( face );
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidload.h b/Build/source/libs/freetype2/freetype-src/src/cid/cidload.h
index 456685c2af1..ee1d4865055 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidload.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidload.h
@@ -37,7 +37,7 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_ULong )
cid_get_offset( FT_Byte** start,
- FT_Byte offsize );
+ FT_UInt offsize );
FT_LOCAL( FT_Error )
cid_face_open( CID_Face face,
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c
index c7568118547..e3c29c22f67 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidobjs.c
@@ -157,10 +157,14 @@
cid_size_request( FT_Size size,
FT_Size_Request req )
{
+ FT_Error error;
+
PSH_Globals_Funcs funcs;
- FT_Request_Metrics( size->face, req );
+ error = FT_Request_Metrics( size->face, req );
+ if ( error )
+ goto Exit;
funcs = cid_size_get_globals_funcs( (CID_Size)size );
@@ -170,7 +174,8 @@
size->metrics.y_scale,
0, 0 );
- return FT_Err_Ok;
+ Exit:
+ return error;
}
@@ -211,7 +216,7 @@
/* release subrs */
if ( face->subrs )
{
- FT_Int n;
+ FT_UInt n;
for ( n = 0; n < cid->num_dicts; n++ )
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c b/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c
index a28f8ee5590..852c9b6b965 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.c
@@ -73,7 +73,11 @@
/* first of all, check the font format in the header */
if ( FT_FRAME_ENTER( 31 ) )
+ {
+ FT_TRACE2(( " not a CID-keyed font\n" ));
+ error = FT_THROW( Unknown_File_Format );
goto Exit;
+ }
if ( ft_strncmp( (char *)stream->cursor,
"%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )
@@ -181,7 +185,7 @@
parser->root.base = parser->postscript;
parser->root.cursor = parser->postscript;
parser->root.limit = parser->root.cursor + ps_len;
- parser->num_dict = -1;
+ parser->num_dict = FT_UINT_MAX;
/* Finally, we check whether `StartData' or `/sfnts' was real -- */
/* it could be in a comment or string. We also get the arguments */
diff --git a/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h b/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h
index 6a00c6cee12..fbc437bc380 100644
--- a/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h
+++ b/Build/source/libs/freetype2/freetype-src/src/cid/cidparse.h
@@ -78,7 +78,7 @@ FT_BEGIN_HEADER
FT_ULong binary_length;
CID_FaceInfo cid;
- FT_Int num_dict;
+ FT_UInt num_dict;
} CID_Parser;
diff --git a/Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c b/Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c
index 5b2006c1260..e0b9a8d29d6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c
+++ b/Build/source/libs/freetype2/freetype-src/src/dlg/dlgwrap.c
@@ -16,15 +16,12 @@
*/
- /* We have to duplicate these feature test macros from `dlg.c` */
- /* since `freetype.h` loads some affected standard headers. */
-#define _XOPEN_SOURCE 600
-#define _POSIX_C_SOURCE 200809L
-
-#include <freetype/freetype.h>
+#include <ft2build.h>
+#include FT_CONFIG_OPTIONS_H
#ifdef FT_DEBUG_LOGGING
+#define DLG_STATIC
#include "dlg.c"
#else
/* ANSI C doesn't like empty source files */
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c
index f96d57bdb48..18e42b0cd8d 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.c
@@ -438,7 +438,7 @@
GXV_LIMIT_CHECK( 2 );
if ( p + 2 >= limit ) /* some fonts have too-short fmt0 array */
{
- GXV_TRACE(( "too short, glyphs %d - %d are missing\n",
+ GXV_TRACE(( "too short, glyphs %d - %ld are missing\n",
i, gxvalid->face->num_glyphs ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
break;
@@ -533,7 +533,7 @@
if ( lastGlyph < firstGlyph )
{
- GXV_TRACE(( "reverse ordered range specification at unit %d:",
+ GXV_TRACE(( "reverse ordered range specification at unit %d:"
" lastGlyph %d < firstGlyph %d ",
unit, lastGlyph, firstGlyph ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
@@ -604,7 +604,7 @@
if ( lastGlyph < firstGlyph )
{
- GXV_TRACE(( "reverse ordered range specification at unit %d:",
+ GXV_TRACE(( "reverse ordered range specification at unit %d:"
" lastGlyph %d < firstGlyph %d ",
unit, lastGlyph, firstGlyph ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
@@ -824,7 +824,7 @@
face = gxvalid->face;
if ( face->num_glyphs < gid )
{
- GXV_TRACE(( " gxv_glyphid_check() gid overflow: num_glyphs %d < %d\n",
+ GXV_TRACE(( " gxv_glyphid_check() gid overflow: num_glyphs %ld < %d\n",
face->num_glyphs, gid ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
}
@@ -1418,7 +1418,7 @@
GXV_NAME_ENTER( "XStateArray" );
GXV_TRACE(( "parse % 3d bytes by stateSize=% 3d maxClassID=% 3d\n",
- (int)(*length_p), stateSize, (int)(maxClassID) ));
+ (int)(*length_p), (int)stateSize, (int)(maxClassID) ));
/*
* 2 states are predefined and must be described:
@@ -1582,10 +1582,10 @@
stateArray = FT_NEXT_ULONG( p );
entryTable = FT_NEXT_ULONG( p );
- GXV_TRACE(( "nClasses =0x%08x\n", gxvalid->xstatetable.nClasses ));
- GXV_TRACE(( "offset to classTable=0x%08x\n", classTable ));
- GXV_TRACE(( "offset to stateArray=0x%08x\n", stateArray ));
- GXV_TRACE(( "offset to entryTable=0x%08x\n", entryTable ));
+ GXV_TRACE(( "nClasses =0x%08lx\n", gxvalid->xstatetable.nClasses ));
+ GXV_TRACE(( "offset to classTable=0x%08lx\n", classTable ));
+ GXV_TRACE(( "offset to stateArray=0x%08lx\n", stateArray ));
+ GXV_TRACE(( "offset to entryTable=0x%08lx\n", entryTable ));
if ( gxvalid->xstatetable.nClasses > 0xFFFFU )
FT_INVALID_DATA;
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h
index de134ced102..b79b641142c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvcommn.h
@@ -61,8 +61,11 @@ FT_BEGIN_HEADER
#undef GXV_LOAD_UNUSED_VARS /* debug purpose */
-#define IS_PARANOID_VALIDATION ( gxvalid->root->level >= FT_VALIDATE_PARANOID )
-#define GXV_SET_ERR_IF_PARANOID( err ) { if ( IS_PARANOID_VALIDATION ) ( err ); }
+#define IS_PARANOID_VALIDATION \
+ ( gxvalid->root->level >= FT_VALIDATE_PARANOID )
+#define GXV_SET_ERR_IF_PARANOID( err ) \
+ do { if ( IS_PARANOID_VALIDATION ) ( err ); } while ( 0 )
+
/*************************************************************************/
/*************************************************************************/
@@ -261,17 +264,17 @@ FT_BEGIN_HEADER
} GXV_ValidatorRec;
-#define GXV_TABLE_DATA( tag, field ) \
+#define GXV_TABLE_DATA( tag, field ) \
( ( (GXV_ ## tag ## _Data)gxvalid->table_data )->field )
#undef FT_INVALID_
-#define FT_INVALID_( _error ) \
+#define FT_INVALID_( _error ) \
ft_validator_error( gxvalid->root, FT_THROW( _error ) )
-#define GXV_LIMIT_CHECK( _count ) \
- FT_BEGIN_STMNT \
+#define GXV_LIMIT_CHECK( _count ) \
+ FT_BEGIN_STMNT \
if ( p + _count > ( limit? limit : gxvalid->root->limit ) ) \
- FT_INVALID_TOO_SHORT; \
+ FT_INVALID_TOO_SHORT; \
FT_END_STMNT
@@ -279,19 +282,19 @@ FT_BEGIN_HEADER
#define GXV_INIT gxvalid->debug_indent = 0
-#define GXV_NAME_ENTER( name ) \
- FT_BEGIN_STMNT \
- gxvalid->debug_indent += 2; \
- FT_TRACE4(( "%*.s", gxvalid->debug_indent, 0 )); \
- FT_TRACE4(( "%s table\n", name )); \
+#define GXV_NAME_ENTER( name ) \
+ FT_BEGIN_STMNT \
+ gxvalid->debug_indent += 2; \
+ FT_TRACE4(( "%*.s", gxvalid->debug_indent, "" )); \
+ FT_TRACE4(( "%s table\n", name )); \
FT_END_STMNT
#define GXV_EXIT gxvalid->debug_indent -= 2
-#define GXV_TRACE( s ) \
- FT_BEGIN_STMNT \
- FT_TRACE4(( "%*.s", gxvalid->debug_indent, 0 )); \
- FT_TRACE4( s ); \
+#define GXV_TRACE( s ) \
+ FT_BEGIN_STMNT \
+ FT_TRACE4(( "%*.s", gxvalid->debug_indent, "" )); \
+ FT_TRACE4( s ); \
FT_END_STMNT
#else /* !FT_DEBUG_LEVEL_TRACE */
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c
index bc76d72001c..0a8e2f201ab 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvfeat.c
@@ -90,7 +90,7 @@
if ( feature >= gxv_feat_registry_length )
{
- GXV_TRACE(( "feature number %d is out of range %d\n",
+ GXV_TRACE(( "feature number %d is out of range %lu\n",
feature, gxv_feat_registry_length ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );
goto Exit;
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c
index 54a2a548e32..ec289b8ebf1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvjust.c
@@ -78,7 +78,7 @@
return;
GXV_TRACE(( "just table includes too large %s"
- " GID=%d > %d (in maxp)\n",
+ " GID=%d > %ld (in maxp)\n",
msg_tag, gid, gxvalid->face->num_glyphs ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
}
@@ -140,7 +140,7 @@
count = FT_NEXT_ULONG( p );
for ( i = 0; i < count; i++ )
{
- GXV_TRACE(( "validating wdc pair %d/%d\n", i + 1, count ));
+ GXV_TRACE(( "validating wdc pair %lu/%lu\n", i + 1, count ));
gxv_just_wdp_entry_validate( p, limit, gxvalid );
p += gxvalid->subtable_length;
}
@@ -206,7 +206,8 @@
if ( lowerLimit >= upperLimit )
{
GXV_TRACE(( "just table includes invalid range spec:"
- " lowerLimit(%d) > upperLimit(%d)\n" ));
+ " lowerLimit(%ld) > upperLimit(%ld)\n",
+ lowerLimit, upperLimit ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );
}
@@ -294,14 +295,14 @@
gxvalid->subtable_length = (FT_ULong)( p - table );
if ( variantsAxis != 0x64756374L ) /* 'duct' */
- GXV_TRACE(( "variantsAxis 0x%08x is non default value",
+ GXV_TRACE(( "variantsAxis 0x%08lx is non default value",
variantsAxis ));
if ( minimumLimit > noStretchValue )
- GXV_TRACE(( "type4:minimumLimit 0x%08x > noStretchValue 0x%08x\n",
+ GXV_TRACE(( "type4:minimumLimit 0x%08lx > noStretchValue 0x%08lx\n",
minimumLimit, noStretchValue ));
else if ( noStretchValue > maximumLimit )
- GXV_TRACE(( "type4:noStretchValue 0x%08x > maximumLimit 0x%08x\n",
+ GXV_TRACE(( "type4:noStretchValue 0x%08lx > maximumLimit 0x%08lx\n",
noStretchValue, maximumLimit ));
else if ( !IS_PARANOID_VALIDATION )
return;
@@ -389,7 +390,7 @@
GXV_LIMIT_CHECK( 4 );
actionCount = FT_NEXT_ULONG( p );
- GXV_TRACE(( "actionCount = %d\n", actionCount ));
+ GXV_TRACE(( "actionCount = %lu\n", actionCount ));
for ( i = 0; i < actionCount; i++ )
{
@@ -514,14 +515,14 @@
coverage = FT_NEXT_USHORT( p );
subFeatureFlags = FT_NEXT_ULONG( p );
- GXV_TRACE(( " justClassTable: coverage = 0x%04x (%s) ", coverage ));
+ GXV_TRACE(( " justClassTable: coverage = 0x%04x ", coverage ));
if ( ( coverage & 0x4000 ) == 0 )
GXV_TRACE(( "ascending\n" ));
else
GXV_TRACE(( "descending\n" ));
if ( subFeatureFlags )
- GXV_TRACE(( " justClassTable: nonzero value (0x%08x)"
+ GXV_TRACE(( " justClassTable: nonzero value (0x%08lx)"
" in unused subFeatureFlags\n", subFeatureFlags ));
gxvalid->statetable.optdata = NULL;
@@ -684,7 +685,7 @@
/* Version 1.0 (always:2000) */
- GXV_TRACE(( " (version = 0x%08x)\n", version ));
+ GXV_TRACE(( " (version = 0x%08lx)\n", version ));
if ( version != 0x00010000UL )
FT_INVALID_FORMAT;
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c
index 9fcdbaa7cdb..542e8bc0950 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvkern.c
@@ -487,7 +487,7 @@
if ( gxvalid->face->num_glyphs != glyphCount )
{
- GXV_TRACE(( "maxGID=%d, but glyphCount=%d\n",
+ GXV_TRACE(( "maxGID=%ld, but glyphCount=%d\n",
gxvalid->face->num_glyphs, glyphCount ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
}
@@ -745,7 +745,7 @@
#ifdef GXV_LOAD_TRACE_VARS
FT_UShort version = 0; /* MS only: subtable version, unused */
#endif
- FT_ULong length; /* MS: 16bit, Apple: 32bit*/
+ FT_ULong length; /* MS: 16bit, Apple: 32bit */
FT_UShort coverage;
#ifdef GXV_LOAD_TRACE_VARS
FT_UShort tupleIndex = 0; /* Apple only */
@@ -772,7 +772,7 @@
tupleIndex = 0;
#endif
GXV_TRACE(( "Subtable version = %d\n", version ));
- GXV_TRACE(( "Subtable length = %d\n", length ));
+ GXV_TRACE(( "Subtable length = %lu\n", length ));
break;
case KERN_DIALECT_APPLE:
@@ -783,7 +783,7 @@
#ifdef GXV_LOAD_TRACE_VARS
tupleIndex = 0;
#endif
- GXV_TRACE(( "Subtable length = %d\n", length ));
+ GXV_TRACE(( "Subtable length = %lu\n", length ));
if ( KERN_IS_NEW( gxvalid ) )
{
@@ -800,7 +800,7 @@
default:
length = u16[1];
GXV_TRACE(( "cannot detect subtable dialect, "
- "just skip %d byte\n", length ));
+ "just skip %lu byte\n", length ));
goto Exit;
}
@@ -884,7 +884,7 @@
for ( i = 0; i < nTables; i++ )
{
- GXV_TRACE(( "validating subtable %d/%d\n", i, nTables ));
+ GXV_TRACE(( "validating subtable %d/%lu\n", i, nTables ));
/* p should be 32bit-aligned? */
gxv_kern_subtable_validate( p, 0, gxvalid );
p += gxvalid->subtable_length;
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c
index ad6dfb075e7..1a11426ccbd 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmod.c
@@ -76,27 +76,31 @@
FT_Byte* volatile _sfnt = NULL; \
FT_ULong len_ ## _sfnt = 0
-#define GXV_TABLE_LOAD( _sfnt ) \
- if ( ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) && \
- ( gx_flags & FT_VALIDATE_ ## _sfnt ) ) \
- { \
- error = gxv_load_table( face, TTAG_ ## _sfnt, \
- &_sfnt, &len_ ## _sfnt ); \
- if ( error ) \
- goto Exit; \
- }
-
-#define GXV_TABLE_VALIDATE( _sfnt ) \
- if ( _sfnt ) \
- { \
- ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \
- FT_VALIDATE_DEFAULT ); \
- if ( ft_setjmp( valid.jump_buffer ) == 0 ) \
- gxv_ ## _sfnt ## _validate( _sfnt, face, &valid ); \
- error = valid.error; \
- if ( error ) \
- goto Exit; \
- }
+#define GXV_TABLE_LOAD( _sfnt ) \
+ FT_BEGIN_STMNT \
+ if ( ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) && \
+ ( gx_flags & FT_VALIDATE_ ## _sfnt ) ) \
+ { \
+ error = gxv_load_table( face, TTAG_ ## _sfnt, \
+ &_sfnt, &len_ ## _sfnt ); \
+ if ( error ) \
+ goto Exit; \
+ } \
+ FT_END_STMNT
+
+#define GXV_TABLE_VALIDATE( _sfnt ) \
+ FT_BEGIN_STMNT \
+ if ( _sfnt ) \
+ { \
+ ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \
+ FT_VALIDATE_DEFAULT ); \
+ if ( ft_setjmp( valid.jump_buffer ) == 0 ) \
+ gxv_ ## _sfnt ## _validate( _sfnt, face, &valid ); \
+ error = valid.error; \
+ if ( error ) \
+ goto Exit; \
+ } \
+ FT_END_STMNT
#define GXV_TABLE_SET( _sfnt ) \
if ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) \
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c
index 23bfe08344b..d0db7f4d2d4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort.c
@@ -288,7 +288,7 @@
for ( i = 0; i < nChains; i++ )
{
- GXV_TRACE(( "validating chain %d/%d\n", i + 1, nChains ));
+ GXV_TRACE(( "validating chain %lu/%lu\n", i + 1, nChains ));
GXV_32BIT_ALIGNMENT_VALIDATE( p - table );
gxv_mort_chain_validate( p, limit, gxvalid );
p += gxvalid->subtable_length;
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c
index 4abfbb64228..73f418ea1e0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort2.c
@@ -152,7 +152,7 @@
GXV_32BIT_ALIGNMENT_VALIDATE( ligActionOffset );
if ( p < lat_base )
{
- GXV_TRACE(( "too short offset 0x%04x: p < lat_base (%d byte rewind)\n",
+ GXV_TRACE(( "too short offset 0x%04x: p < lat_base (%ld byte rewind)\n",
ligActionOffset, lat_base - p ));
/* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */
@@ -160,7 +160,7 @@
}
else if ( lat_limit < p )
{
- GXV_TRACE(( "too large offset 0x%04x: lat_limit < p (%d byte overrun)\n",
+ GXV_TRACE(( "too large offset 0x%04x: lat_limit < p (%ld byte overrun)\n",
ligActionOffset, p - lat_limit ));
/* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */
@@ -187,17 +187,17 @@
offset = lig_action & 0x3FFFFFFFUL;
if ( offset * 2 < optdata->ligatureTable )
{
- GXV_TRACE(( "too short offset 0x%08x:"
- " 2 x offset < ligatureTable (%d byte rewind)\n",
+ GXV_TRACE(( "too short offset 0x%08lx:"
+ " 2 x offset < ligatureTable (%lu byte rewind)\n",
offset, optdata->ligatureTable - offset * 2 ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
} else if ( offset * 2 >
optdata->ligatureTable + optdata->ligatureTable_length )
{
- GXV_TRACE(( "too long offset 0x%08x:"
+ GXV_TRACE(( "too long offset 0x%08lx:"
" 2 x offset > ligatureTable + ligatureTable_length"
- " (%d byte overrun)\n",
+ " (%lu byte overrun)\n",
offset,
optdata->ligatureTable + optdata->ligatureTable_length
- offset * 2 ));
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c
index eedec2966f1..cfbf31208c9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmort5.c
@@ -63,7 +63,7 @@
*GXV_mort_subtable_type5_StateOptRecData;
- FT_LOCAL_DEF( void )
+ static void
gxv_mort_subtable_type5_subtable_setup( FT_UShort table_size,
FT_UShort classTable,
FT_UShort stateArray,
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c
index 12a77dbb721..babff518665 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx.c
@@ -84,7 +84,7 @@
p += 4;
#endif
- GXV_TRACE(( "validating chain subtable %d/%d (%d bytes)\n",
+ GXV_TRACE(( "validating chain subtable %d/%d (%lu bytes)\n",
i + 1, nSubtables, length ));
type = coverage & 0x0007;
@@ -99,7 +99,7 @@
func = fmt_funcs_table[type];
if ( !func )
- GXV_TRACE(( "morx type %d is reserved\n", type ));
+ GXV_TRACE(( "morx type %lu is reserved\n", type ));
func( p, p + rest, gxvalid );
@@ -186,7 +186,7 @@
for ( i = 0; i < nChains; i++ )
{
- GXV_TRACE(( "validating chain %d/%d\n", i + 1, nChains ));
+ GXV_TRACE(( "validating chain %lu/%lu\n", i + 1, nChains ));
GXV_32BIT_ALIGNMENT_VALIDATE( p - table );
gxv_morx_chain_validate( p, limit, gxvalid );
p += gxvalid->subtable_length;
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c
index 8eff5393f90..e7e008f0692 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvmorx2.c
@@ -72,11 +72,11 @@
optdata->componentTable = FT_NEXT_ULONG( p );
optdata->ligatureTable = FT_NEXT_ULONG( p );
- GXV_TRACE(( "offset to ligActionTable=0x%08x\n",
+ GXV_TRACE(( "offset to ligActionTable=0x%08lx\n",
optdata->ligActionTable ));
- GXV_TRACE(( "offset to componentTable=0x%08x\n",
+ GXV_TRACE(( "offset to componentTable=0x%08lx\n",
optdata->componentTable ));
- GXV_TRACE(( "offset to ligatureTable=0x%08x\n",
+ GXV_TRACE(( "offset to ligatureTable=0x%08lx\n",
optdata->ligatureTable ));
}
@@ -116,19 +116,19 @@
gxv_set_length_by_ulong_offset( o, l, buff, 6, table_size, gxvalid );
- GXV_TRACE(( "classTable: offset=0x%08x length=0x%08x\n",
+ GXV_TRACE(( "classTable: offset=0x%08lx length=0x%08lx\n",
classTable, *classTable_length_p ));
- GXV_TRACE(( "stateArray: offset=0x%08x length=0x%08x\n",
+ GXV_TRACE(( "stateArray: offset=0x%08lx length=0x%08lx\n",
stateArray, *stateArray_length_p ));
- GXV_TRACE(( "entryTable: offset=0x%08x length=0x%08x\n",
+ GXV_TRACE(( "entryTable: offset=0x%08lx length=0x%08lx\n",
entryTable, *entryTable_length_p ));
- GXV_TRACE(( "ligActionTable: offset=0x%08x length=0x%08x\n",
+ GXV_TRACE(( "ligActionTable: offset=0x%08lx length=0x%08lx\n",
optdata->ligActionTable,
optdata->ligActionTable_length ));
- GXV_TRACE(( "componentTable: offset=0x%08x length=0x%08x\n",
+ GXV_TRACE(( "componentTable: offset=0x%08lx length=0x%08lx\n",
optdata->componentTable,
optdata->componentTable_length ));
- GXV_TRACE(( "ligatureTable: offset=0x%08x length=0x%08x\n",
+ GXV_TRACE(( "ligatureTable: offset=0x%08lx length=0x%08lx\n",
optdata->ligatureTable,
optdata->ligatureTable_length ));
@@ -157,12 +157,12 @@
if ( p < lat_base )
{
- GXV_TRACE(( "p < lat_base (%d byte rewind)\n", lat_base - p ));
+ GXV_TRACE(( "p < lat_base (%ld byte rewind)\n", lat_base - p ));
FT_INVALID_OFFSET;
}
else if ( lat_limit < p )
{
- GXV_TRACE(( "lat_limit < p (%d byte overrun)\n", p - lat_limit ));
+ GXV_TRACE(( "lat_limit < p (%ld byte overrun)\n", p - lat_limit ));
FT_INVALID_OFFSET;
}
@@ -196,7 +196,7 @@
GXV_TRACE(( "ligature action table includes"
" too negative offset moving all GID"
- " below defined range: 0x%04x\n",
+ " below defined range: 0x%04lx\n",
offset & 0xFFFFU ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
}
@@ -207,14 +207,14 @@
GXV_TRACE(( "ligature action table includes"
" too large offset moving all GID"
- " over defined range: 0x%04x\n",
+ " over defined range: 0x%04lx\n",
offset & 0xFFFFU ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
}
GXV_TRACE(( "ligature action table includes"
" invalid offset to add to 16-bit GID:"
- " 0x%08x\n", offset ));
+ " 0x%08lx\n", offset ));
GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
}
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c
index b4abcd68e93..7a2feab4684 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvopbd.c
@@ -188,7 +188,7 @@
/* only 0x00010000 is defined (1996) */
- GXV_TRACE(( "(version=0x%08x)\n", version ));
+ GXV_TRACE(( "(version=0x%08lx)\n", version ));
if ( 0x00010000UL != version )
FT_INVALID_FORMAT;
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c
index f6ec16b4ac7..98cd3688455 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvprop.c
@@ -283,7 +283,7 @@
format = FT_NEXT_USHORT( p );
defaultProp = FT_NEXT_USHORT( p );
- GXV_TRACE(( " version 0x%08x\n", version ));
+ GXV_TRACE(( " version 0x%08lx\n", version ));
GXV_TRACE(( " format 0x%04x\n", format ));
GXV_TRACE(( " defaultProp 0x%04x\n", defaultProp ));
@@ -309,7 +309,7 @@
if ( format == 0 )
{
FT_TRACE3(( "(format 0, no per-glyph properties, "
- "remaining %d bytes are skipped)", limit - p ));
+ "remaining %ld bytes are skipped)", limit - p ));
goto Exit;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c
index 6a3d4b409e9..c1ed92872d5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gxvalid/gxvtrak.c
@@ -130,7 +130,7 @@
p = table + j * ( 4 + 2 + 2 );
t = FT_NEXT_LONG( p );
if ( t == track )
- GXV_TRACE(( "duplicated entries found for track value 0x%x\n",
+ GXV_TRACE(( "duplicated entries found for track value 0x%lx\n",
track ));
}
}
@@ -243,7 +243,7 @@
vertOffset = FT_NEXT_USHORT( p );
reserved = FT_NEXT_USHORT( p );
- GXV_TRACE(( " (version = 0x%08x)\n", version ));
+ GXV_TRACE(( " (version = 0x%08lx)\n", version ));
GXV_TRACE(( " (format = 0x%04x)\n", format ));
GXV_TRACE(( " (horizOffset = 0x%04x)\n", horizOffset ));
GXV_TRACE(( " (vertOffset = 0x%04x)\n", vertOffset ));
diff --git a/Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c b/Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c
index 788a37b3171..8f98a7d17ba 100644
--- a/Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c
+++ b/Build/source/libs/freetype2/freetype-src/src/gzip/ftgzip.c
@@ -132,7 +132,7 @@
/* allocate and zero out */
- (void)FT_ALLOC( p, sz );
+ FT_MEM_ALLOC( p, sz );
return p;
}
@@ -467,12 +467,13 @@
FT_ULong count )
{
FT_Error error = FT_Err_Ok;
- FT_ULong delta;
for (;;)
{
- delta = (FT_ULong)( zip->limit - zip->cursor );
+ FT_ULong delta = (FT_ULong)( zip->limit - zip->cursor );
+
+
if ( delta >= count )
delta = count;
diff --git a/Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c b/Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c
index 93c8f597820..e112418ab12 100644
--- a/Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c
+++ b/Build/source/libs/freetype2/freetype-src/src/lzw/ftlzw.c
@@ -383,7 +383,7 @@
stream->size = 0x7FFFFFFFL; /* don't know the real size! */
stream->pos = 0;
- stream->base = 0;
+ stream->base = NULL;
stream->read = ft_lzw_stream_io;
stream->close = ft_lzw_stream_close;
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h
index e092684c9a1..3b096ecca82 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvcommn.h
@@ -180,24 +180,24 @@ FT_BEGIN_HEADER
#define OTV_ENTER \
FT_BEGIN_STMNT \
otvalid->debug_indent += 2; \
- FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \
+ FT_TRACE4(( "%*.s", otvalid->debug_indent, "" )); \
FT_TRACE4(( "%s table\n", \
otvalid->debug_function_name[otvalid->nesting_level] )); \
FT_END_STMNT
-#define OTV_NAME_ENTER( name ) \
- FT_BEGIN_STMNT \
- otvalid->debug_indent += 2; \
- FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \
- FT_TRACE4(( "%s table\n", name )); \
+#define OTV_NAME_ENTER( name ) \
+ FT_BEGIN_STMNT \
+ otvalid->debug_indent += 2; \
+ FT_TRACE4(( "%*.s", otvalid->debug_indent, "" )); \
+ FT_TRACE4(( "%s table\n", name )); \
FT_END_STMNT
#define OTV_EXIT otvalid->debug_indent -= 2
-#define OTV_TRACE( s ) \
- FT_BEGIN_STMNT \
- FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \
- FT_TRACE4( s ); \
+#define OTV_TRACE( s ) \
+ FT_BEGIN_STMNT \
+ FT_TRACE4(( "%*.s", otvalid->debug_indent, "" )); \
+ FT_TRACE4( s ); \
FT_END_STMNT
#else /* !FT_DEBUG_LEVEL_TRACE */
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c
index 8dceabde90e..b4bfabb62e1 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmath.c
@@ -141,7 +141,7 @@
OTV_OPTIONAL_TABLE( DeviceTableOffset );
- /* OTV_NAME_ENTER( "MathKern" );*/
+ /* OTV_NAME_ENTER( "MathKern" ); */
OTV_LIMIT_CHECK( 2 );
diff --git a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c
index f76ac62fe1e..b7d674b5e22 100644
--- a/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c
+++ b/Build/source/libs/freetype2/freetype-src/src/otvalid/otvmod.c
@@ -94,7 +94,7 @@
*/
if ( face->num_glyphs > 0xFFFFL )
{
- FT_TRACE1(( "otv_validate: Invalid glyphs index (0x0000FFFF - 0x%08x) ",
+ FT_TRACE1(( "otv_validate: Invalid glyphs index (0x0000FFFF - 0x%08lx) ",
face->num_glyphs ));
FT_TRACE1(( "are not handled by OpenType tables\n" ));
num_glyphs = 0xFFFF;
diff --git a/Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c b/Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c
index 060554ae46a..e60a0a5141f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pcf/pcfread.c
@@ -238,7 +238,7 @@ THE SOFTWARE.
{
for ( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] );
j++ )
- if ( tables[i].type == (FT_UInt)( 1 << j ) )
+ if ( tables[i].type == 1UL << j )
name = tableNames[j];
FT_TRACE4(( " %d: type=%s, format=0x%lX,"
@@ -613,7 +613,8 @@ THE SOFTWARE.
strings[string_size] = '\0';
- if ( FT_QNEW_ARRAY( properties, nprops ) )
+ /* zero out in case of failure */
+ if ( FT_NEW_ARRAY( properties, nprops ) )
goto Bail;
face->properties = properties;
@@ -1612,7 +1613,7 @@ THE SOFTWARE.
else
{
/* this is a heuristical value */
- bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 );
+ bsize->width = ( bsize->height * 2 + 1 ) / 3;
}
prop = pcf_find_property( face, "POINT_SIZE" );
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c
index 5302fac4cf6..3080cb650be 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrobjs.c
@@ -83,7 +83,11 @@
/* load the header and check it */
error = pfr_header_load( &face->header, stream );
if ( error )
+ {
+ FT_TRACE2(( " not a PFR font\n" ));
+ error = FT_THROW( Unknown_File_Format );
goto Exit;
+ }
if ( !pfr_header_check( &face->header ) )
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h
index dff3b464494..dc4fead7000 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pfr/pfrtypes.h
@@ -109,7 +109,7 @@ FT_BEGIN_HEADER
#define PFR_BITMAP_2BYTE_SIZE 0x02U
#define PFR_BITMAP_3BYTE_OFFSET 0x04U
- /*not part of the specification but used for implementation */
+ /* not part of the specification but used for implementation */
#define PFR_BITMAP_CHARCODES_VALIDATED 0x40U
#define PFR_BITMAP_VALID_CHARCODES 0x80U
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c
index 3498f670c79..29b68a8e4fb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/cffdecode.c
@@ -1871,7 +1871,7 @@
case cff_op_put:
{
FT_Fixed val = args[0];
- FT_Int idx = (FT_Int)( args[1] >> 16 );
+ FT_UInt idx = (FT_UInt)( args[1] >> 16 );
FT_TRACE4(( " put\n" ));
@@ -1880,20 +1880,20 @@
/* didn't give a hard-coded size limit of the temporary */
/* storage array; instead, an argument of the */
/* `MultipleMaster' operator set the size */
- if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
+ if ( idx < CFF_MAX_TRANS_ELEMENTS )
decoder->buildchar[idx] = val;
}
break;
case cff_op_get:
{
- FT_Int idx = (FT_Int)( args[0] >> 16 );
+ FT_UInt idx = (FT_UInt)( args[0] >> 16 );
FT_Fixed val = 0;
FT_TRACE4(( " get\n" ));
- if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
+ if ( idx < CFF_MAX_TRANS_ELEMENTS )
val = decoder->buildchar[idx];
args[0] = val;
@@ -1914,9 +1914,9 @@
/* this operator was removed from the Type2 specification */
/* in version 16-March-2000 */
{
- FT_Int reg_idx = (FT_Int)args[0];
- FT_Int idx = (FT_Int)args[1];
- FT_Int count = (FT_Int)args[2];
+ FT_UInt reg_idx = (FT_UInt)args[0];
+ FT_UInt idx = (FT_UInt)args[1];
+ FT_UInt count = (FT_UInt)args[2];
FT_TRACE4(( " load\n" ));
@@ -1924,11 +1924,11 @@
/* since we currently don't handle interpolation of multiple */
/* master fonts, we store a vector [1 0 0 ...] in the */
/* temporary storage array regardless of the Registry index */
- if ( reg_idx >= 0 && reg_idx <= 2 &&
- idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS &&
- count >= 0 && count <= num_axes )
+ if ( reg_idx <= 2 &&
+ idx < CFF_MAX_TRANS_ELEMENTS &&
+ count <= num_axes )
{
- FT_Int end, i;
+ FT_UInt end, i;
end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS );
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psft.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psft.c
index 41c16542c17..ac72d8259c4 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psft.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psft.c
@@ -742,13 +742,13 @@
/* For ordinary fonts get the character data stored in the face record. */
{
glyph_data.pointer = type1->charstrings[glyph_index];
- glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index];
+ glyph_data.length = type1->charstrings_len[glyph_index];
}
if ( !error )
{
FT_Byte* charstring_base = (FT_Byte*)glyph_data.pointer;
- FT_ULong charstring_len = (FT_ULong)glyph_data.length;
+ FT_ULong charstring_len = glyph_data.length;
FT_ASSERT( charstring_base + charstring_len >= charstring_base );
@@ -778,7 +778,7 @@
face = (T1_Face)decoder->builder.face;
data.pointer = buf->start;
- data.length = (FT_Int)( buf->end - buf->start );
+ data.length = (FT_UInt)( buf->end - buf->start );
if ( face->root.internal->incremental_interface )
face->root.internal->incremental_interface->funcs->free_glyph_data(
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c
index 40e92766389..c550533a0fc 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.c
@@ -469,7 +469,7 @@
*/
FT_LOCAL_DEF( void )
cf2_interpT2CharString( CF2_Font font,
- CF2_Buffer buf,
+ const CF2_Buffer buf,
CF2_OutlineCallbacks callbacks,
const FT_Vector* translation,
FT_Bool doingSeac,
@@ -1899,18 +1899,17 @@
/* cvi( <idx> ) of BuildCharArray with */
/* WeightVector */
{
- FT_Int idx;
+ FT_UInt idx;
PS_Blend blend = decoder->blend;
if ( arg_cnt != 1 || !blend )
goto Unexpected_OtherSubr;
- idx = cf2_stack_popInt( opStack );
+ idx = (FT_UInt)cf2_stack_popInt( opStack );
- if ( idx < 0 ||
- (FT_UInt)idx + blend->num_designs >
- decoder->len_buildchar )
+ if ( idx + blend->num_designs >
+ decoder->len_buildchar )
goto Unexpected_OtherSubr;
ft_memcpy( &decoder->buildchar[idx],
@@ -2010,17 +2009,16 @@
/* <val> <idx> 2 24 callothersubr */
/* ==> set BuildCharArray[cvi( <idx> )] = <val> */
{
- CF2_Int idx;
+ CF2_UInt idx;
PS_Blend blend = decoder->blend;
if ( arg_cnt != 2 || !blend )
goto Unexpected_OtherSubr;
- idx = cf2_stack_popInt( opStack );
+ idx = (CF2_UInt)cf2_stack_popInt( opStack );
- if ( idx < 0 ||
- (FT_UInt)idx >= decoder->len_buildchar )
+ if ( idx >= decoder->len_buildchar )
goto Unexpected_OtherSubr;
decoder->buildchar[idx] =
@@ -2033,17 +2031,16 @@
/* ==> push BuildCharArray[cvi( idx )] */
/* onto T1 stack */
{
- CF2_Int idx;
+ CF2_UInt idx;
PS_Blend blend = decoder->blend;
if ( arg_cnt != 1 || !blend )
goto Unexpected_OtherSubr;
- idx = cf2_stack_popInt( opStack );
+ idx = (CF2_UInt)cf2_stack_popInt( opStack );
- if ( idx < 0 ||
- (FT_UInt)idx >= decoder->len_buildchar )
+ if ( idx >= decoder->len_buildchar )
goto Unexpected_OtherSubr;
cf2_stack_pushFixed( opStack,
@@ -2185,29 +2182,29 @@
case cf2_escPUT:
{
CF2_F16Dot16 val;
- CF2_Int idx;
+ CF2_UInt idx;
FT_TRACE4(( " put\n" ));
- idx = cf2_stack_popInt( opStack );
+ idx = (CF2_UInt)cf2_stack_popInt( opStack );
val = cf2_stack_popFixed( opStack );
- if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
+ if ( idx < CF2_STORAGE_SIZE )
storage[idx] = val;
}
continue; /* do not clear the stack */
case cf2_escGET:
{
- CF2_Int idx;
+ CF2_UInt idx;
FT_TRACE4(( " get\n" ));
- idx = cf2_stack_popInt( opStack );
+ idx = (CF2_UInt)cf2_stack_popInt( opStack );
- if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
+ if ( idx < CF2_STORAGE_SIZE )
cf2_stack_pushFixed( opStack, storage[idx] );
}
continue; /* do not clear the stack */
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.h b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.h
index 669c09c0ae5..d8b9342ecb6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.h
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psintrp.h
@@ -65,7 +65,7 @@ FT_BEGIN_HEADER
FT_LOCAL( void )
cf2_interpT2CharString( CF2_Font font,
- CF2_Buffer charstring,
+ const CF2_Buffer buf,
CF2_OutlineCallbacks callbacks,
const FT_Vector* translation,
FT_Bool doingSeac,
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c b/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c
index bc8888c3ab3..797486588a3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/psstack.c
@@ -54,8 +54,7 @@
FT_Error* e,
FT_UInt stackSize )
{
- FT_Error error = FT_Err_Ok; /* for FT_NEW */
-
+ FT_Error error; /* for FT_QNEW */
CF2_Stack stack = NULL;
diff --git a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c
index ee1cb263449..7e65bde6322 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psaux/t1decode.c
@@ -27,8 +27,11 @@
#include "psauxerr.h"
+
/* ensure proper sign extension */
-#define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) )
+#define Fix2Int( f ) ( (FT_Int) (FT_Short)( (f) >> 16 ) )
+#define Fix2UInt( f ) ( (FT_UInt)(FT_Short)( (f) >> 16 ) )
+
/**************************************************************************
*
@@ -1025,16 +1028,16 @@
/* <val> <idx> 2 24 callothersubr */
/* ==> set BuildCharArray[cvi( <idx> )] = <val> */
{
- FT_Int idx;
+ FT_UInt idx;
PS_Blend blend = decoder->blend;
if ( arg_cnt != 2 || !blend )
goto Unexpected_OtherSubr;
- idx = Fix2Int( top[1] );
+ idx = Fix2UInt( top[1] );
- if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
+ if ( idx >= decoder->len_buildchar )
goto Unexpected_OtherSubr;
decoder->buildchar[idx] = top[0];
@@ -1046,16 +1049,16 @@
/* ==> push BuildCharArray[cvi( idx )] */
/* onto T1 stack */
{
- FT_Int idx;
+ FT_UInt idx;
PS_Blend blend = decoder->blend;
if ( arg_cnt != 1 || !blend )
goto Unexpected_OtherSubr;
- idx = Fix2Int( top[0] );
+ idx = Fix2UInt( top[0] );
- if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
+ if ( idx >= decoder->len_buildchar )
goto Unexpected_OtherSubr;
top[0] = decoder->buildchar[idx];
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c
index 79763ecd943..227caeae331 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.c
@@ -305,17 +305,18 @@
/* now, sort the hints; they are guaranteed to not overlap */
/* so we can compare their "org_pos" field directly */
{
- FT_Int i1, i2;
+ FT_UInt i1, i2;
PSH_Hint hint1, hint2;
PSH_Hint* sort = table->sort;
/* a simple bubble sort will do, since in 99% of cases, the hints */
/* will be already sorted -- and the sort will be linear */
- for ( i1 = 1; i1 < (FT_Int)count; i1++ )
+ for ( i1 = 1; i1 < count; i1++ )
{
hint1 = sort[i1];
- for ( i2 = i1 - 1; i2 >= 0; i2-- )
+ /* this loop stops when i2 wraps around after reaching 0 */
+ for ( i2 = i1 - 1; i2 < i1; i2-- )
{
hint2 = sort[i2];
@@ -869,7 +870,7 @@
return;
}
-#endif /* DEBUG_HINTER*/
+#endif /* DEBUG_HINTER */
hint = table->hints;
count = table->max_hints;
@@ -1049,12 +1050,12 @@
}
- static int
+ static PSH_Dir
psh_compute_dir( FT_Pos dx,
FT_Pos dy )
{
- FT_Pos ax, ay;
- int result = PSH_DIR_NONE;
+ FT_Pos ax, ay;
+ PSH_Dir result = PSH_DIR_NONE;
ax = FT_ABS( dx );
@@ -1233,12 +1234,12 @@
dxi = vec[n].x - vec[n_prev].x;
dyi = vec[n].y - vec[n_prev].y;
- point->dir_in = (FT_Char)psh_compute_dir( dxi, dyi );
+ point->dir_in = psh_compute_dir( dxi, dyi );
dxo = vec[n_next].x - vec[n].x;
dyo = vec[n_next].y - vec[n].y;
- point->dir_out = (FT_Char)psh_compute_dir( dxo, dyo );
+ point->dir_out = psh_compute_dir( dxo, dyo );
/* detect smooth points */
if ( point->flags & PSH_POINT_OFF )
@@ -1403,16 +1404,13 @@
}
- /* major_dir is the direction for points on the bottom/left of the stem; */
- /* Points on the top/right of the stem will have a direction of */
- /* -major_dir. */
-
+ /* the min and max are based on contour orientation and fill rule */
static void
psh_hint_table_find_strong_points( PSH_Hint_Table table,
PSH_Point point,
FT_UInt count,
FT_Int threshold,
- FT_Int major_dir )
+ PSH_Dir major_dir )
{
PSH_Hint* sort = table->sort;
FT_UInt num_hints = table->num_hints;
@@ -1420,59 +1418,53 @@
for ( ; count > 0; count--, point++ )
{
- FT_Int point_dir = 0;
- FT_Pos org_u = point->org_u;
+ PSH_Dir point_dir;
+ FT_Pos org_u = point->org_u;
if ( psh_point_is_strong( point ) )
continue;
- if ( PSH_DIR_COMPARE( point->dir_in, major_dir ) )
- point_dir = point->dir_in;
-
- else if ( PSH_DIR_COMPARE( point->dir_out, major_dir ) )
- point_dir = point->dir_out;
+ point_dir =
+ (PSH_Dir)( ( point->dir_in | point->dir_out ) & major_dir );
- if ( point_dir )
+ if ( point_dir & ( PSH_DIR_DOWN | PSH_DIR_RIGHT ) )
{
- if ( point_dir == major_dir )
- {
- FT_UInt nn;
+ FT_UInt nn;
- for ( nn = 0; nn < num_hints; nn++ )
- {
- PSH_Hint hint = sort[nn];
- FT_Pos d = org_u - hint->org_pos;
+ for ( nn = 0; nn < num_hints; nn++ )
+ {
+ PSH_Hint hint = sort[nn];
+ FT_Pos d = org_u - hint->org_pos;
- if ( d < threshold && -d < threshold )
- {
- psh_point_set_strong( point );
- point->flags2 |= PSH_POINT_EDGE_MIN;
- point->hint = hint;
- break;
- }
+ if ( d < threshold && -d < threshold )
+ {
+ psh_point_set_strong( point );
+ point->flags2 |= PSH_POINT_EDGE_MIN;
+ point->hint = hint;
+ break;
}
}
- else if ( point_dir == -major_dir )
- {
- FT_UInt nn;
+ }
+ else if ( point_dir & ( PSH_DIR_UP | PSH_DIR_LEFT ) )
+ {
+ FT_UInt nn;
- for ( nn = 0; nn < num_hints; nn++ )
- {
- PSH_Hint hint = sort[nn];
- FT_Pos d = org_u - hint->org_pos - hint->org_len;
+ for ( nn = 0; nn < num_hints; nn++ )
+ {
+ PSH_Hint hint = sort[nn];
+ FT_Pos d = org_u - hint->org_pos - hint->org_len;
- if ( d < threshold && -d < threshold )
- {
- psh_point_set_strong( point );
- point->flags2 |= PSH_POINT_EDGE_MAX;
- point->hint = hint;
- break;
- }
+ if ( d < threshold && -d < threshold )
+ {
+ psh_point_set_strong( point );
+ point->flags2 |= PSH_POINT_EDGE_MAX;
+ point->hint = hint;
+ break;
}
}
}
@@ -1571,7 +1563,7 @@
PS_Mask mask = table->hint_masks->masks;
FT_UInt num_masks = table->hint_masks->num_masks;
FT_UInt first = 0;
- FT_Int major_dir = ( dimension == 0 ) ? PSH_DIR_VERTICAL
+ PSH_Dir major_dir = ( dimension == 0 ) ? PSH_DIR_VERTICAL
: PSH_DIR_HORIZONTAL;
PSH_Dimension dim = &glyph->globals->dimension[dimension];
FT_Fixed scale = dim->scale_mult;
@@ -1656,8 +1648,8 @@
/* check tangents */
- if ( !PSH_DIR_COMPARE( point->dir_in, PSH_DIR_HORIZONTAL ) &&
- !PSH_DIR_COMPARE( point->dir_out, PSH_DIR_HORIZONTAL ) )
+ if ( !( point->dir_in & PSH_DIR_HORIZONTAL ) &&
+ !( point->dir_out & PSH_DIR_HORIZONTAL ) )
continue;
/* skip strong points */
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h
index 1bc5294072d..999c60192b7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshalgo.h
@@ -93,21 +93,17 @@ FT_BEGIN_HEADER
typedef struct PSH_PointRec_* PSH_Point;
typedef struct PSH_ContourRec_* PSH_Contour;
- enum
+ typedef enum PSH_Dir_
{
- PSH_DIR_NONE = 4,
- PSH_DIR_UP = -1,
- PSH_DIR_DOWN = 1,
- PSH_DIR_LEFT = -2,
- PSH_DIR_RIGHT = 2
- };
+ PSH_DIR_NONE = 0,
+ PSH_DIR_UP = 1,
+ PSH_DIR_DOWN = 2,
+ PSH_DIR_VERTICAL = 1 | 2,
+ PSH_DIR_LEFT = 4,
+ PSH_DIR_RIGHT = 8,
+ PSH_DIR_HORIZONTAL = 4 | 8
-#define PSH_DIR_HORIZONTAL 2
-#define PSH_DIR_VERTICAL 1
-
-#define PSH_DIR_COMPARE( d1, d2 ) ( (d1) == (d2) || (d1) == -(d2) )
-#define PSH_DIR_IS_HORIZONTAL( d ) PSH_DIR_COMPARE( d, PSH_DIR_HORIZONTAL )
-#define PSH_DIR_IS_VERTICAL( d ) PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL )
+ } PSH_Dir;
/* the following bit-flags are computed once by the glyph */
@@ -160,8 +156,8 @@ FT_BEGIN_HEADER
PSH_Contour contour;
FT_UInt flags;
FT_UInt flags2;
- FT_Char dir_in;
- FT_Char dir_out;
+ PSH_Dir dir_in;
+ PSH_Dir dir_out;
PSH_Hint hint;
FT_Pos org_u;
FT_Pos org_v;
@@ -199,10 +195,6 @@ FT_BEGIN_HEADER
PSH_Globals globals;
PSH_Hint_TableRec hint_tables[2];
- FT_Bool vertical;
- FT_Int major_dir;
- FT_Int minor_dir;
-
FT_Bool do_horz_hints;
FT_Bool do_vert_hints;
FT_Bool do_horz_snapping;
diff --git a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c
index a108734d49d..1faabdaafa6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c
+++ b/Build/source/libs/freetype2/freetype-src/src/pshinter/pshrec.c
@@ -499,23 +499,18 @@
ps_mask_table_merge_all( PS_Mask_Table table,
FT_Memory memory )
{
- FT_Int index1, index2;
+ FT_UInt index1, index2;
FT_Error error = FT_Err_Ok;
- /* both loops go down to 0, thus FT_Int for index1 and index2 */
- for ( index1 = (FT_Int)table->num_masks - 1; index1 > 0; index1-- )
+ /* the loops stop when unsigned indices wrap around after 0 */
+ for ( index1 = table->num_masks - 1; index1 < table->num_masks; index1-- )
{
- for ( index2 = index1 - 1; index2 >= 0; index2-- )
+ for ( index2 = index1 - 1; index2 < index1; index2-- )
{
- if ( ps_mask_table_test_intersect( table,
- (FT_UInt)index1,
- (FT_UInt)index2 ) )
+ if ( ps_mask_table_test_intersect( table, index1, index2 ) )
{
- error = ps_mask_table_merge( table,
- (FT_UInt)index2,
- (FT_UInt)index1,
- memory );
+ error = ps_mask_table_merge( table, index2, index1, memory );
if ( error )
goto Exit;
diff --git a/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c b/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c
index fff9c42a37d..74adefa15be 100644
--- a/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c
+++ b/Build/source/libs/freetype2/freetype-src/src/psnames/psmodule.c
@@ -325,7 +325,6 @@
/* we first allocate the table */
table->num_maps = 0;
- table->maps = NULL;
if ( !FT_QNEW_ARRAY( table->maps, num_glyphs + EXTRA_GLYPH_LIST_SIZE ) )
{
@@ -390,9 +389,9 @@
/* Reallocate if the number of used entries is much smaller. */
if ( count < num_glyphs / 2 )
{
- (void)FT_QRENEW_ARRAY( table->maps,
- num_glyphs + EXTRA_GLYPH_LIST_SIZE,
- count );
+ FT_MEM_QRENEW_ARRAY( table->maps,
+ num_glyphs + EXTRA_GLYPH_LIST_SIZE,
+ count );
error = FT_Err_Ok;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h b/Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h
index 9de0b126993..b12a0512343 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/ftmisc.h
@@ -47,11 +47,8 @@
typedef signed long FT_F26Dot6;
typedef int FT_Error;
-#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
- ( ( (FT_ULong)_x1 << 24 ) | \
- ( (FT_ULong)_x2 << 16 ) | \
- ( (FT_ULong)_x3 << 8 ) | \
- (FT_ULong)_x4 )
+
+#define FT_STATIC_BYTE_CAST( type, var ) (type)(FT_Byte)(var)
/* from include/freetype/ftsystem.h */
diff --git a/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c b/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c
index fbcf8d22a21..bfc059c1e8f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c
+++ b/Build/source/libs/freetype2/freetype-src/src/raster/ftraster.c
@@ -2095,8 +2095,8 @@
* Removes an old profile from a linked list.
*/
static void
- DelOld( PProfileList list,
- PProfile profile )
+ DelOld( PProfileList list,
+ const PProfile profile )
{
PProfile *old, current;
@@ -2206,8 +2206,7 @@
PProfile left,
PProfile right )
{
- Long e1, e2;
- Byte* target;
+ Long e1, e2;
Int dropOutControl = left->flags & 7;
@@ -2240,6 +2239,8 @@
if ( e2 >= 0 && e1 < ras.bWidth )
{
+ Byte* target;
+
Int c1, c2;
Byte f1, f2;
@@ -2949,11 +2950,11 @@
FT_Outline_Get_CBox( const FT_Outline* outline,
FT_BBox *acbox )
{
- Long xMin, yMin, xMax, yMax;
-
-
if ( outline && acbox )
{
+ Long xMin, yMin, xMax, yMax;
+
+
if ( outline->n_points == 0 )
{
xMin = 0;
@@ -3132,13 +3133,6 @@
}
- static void
- ft_black_init( black_PRaster raster )
- {
- FT_UNUSED( raster );
- }
-
-
/**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/
/**** a static object. *****/
@@ -3156,7 +3150,6 @@
*araster = (FT_Raster)&the_raster;
FT_ZERO( &the_raster );
- ft_black_init( &the_raster );
return 0;
}
@@ -3181,14 +3174,10 @@
black_PRaster raster = NULL;
- *araster = 0;
if ( !FT_NEW( raster ) )
- {
raster->memory = memory;
- ft_black_init( raster );
- *araster = raster;
- }
+ *araster = raster;
return error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c b/Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c
index db4a2dd11aa..8da5c9d9e07 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sdf/ftbsdf.c
@@ -163,7 +163,7 @@
{
FT_Memory memory;
- } BSDF_TRaster;
+ } BSDF_TRaster, *BSDF_PRaster;
/**************************************************************************
@@ -928,7 +928,7 @@
/* Forward pass of rows (left -> right). Leave the first */
/* column, which gets covered in the backward pass. */
- for ( i = 1; i < w; i++ )
+ for ( i = 1; i < w - 1; i++ )
{
index = j * w + i;
current = dm + index;
@@ -997,7 +997,7 @@
/* Forward pass of rows (left -> right). Leave the first */
/* column, which gets covered in the backward pass. */
- for ( i = 1; i < w; i++ )
+ for ( i = 1; i < w - 1; i++ )
{
index = j * w + i;
current = dm + index;
@@ -1173,19 +1173,17 @@
/* called when adding a new module through @FT_Add_Module */
static FT_Error
- bsdf_raster_new( FT_Memory memory,
- FT_Raster* araster )
+ bsdf_raster_new( FT_Memory memory,
+ BSDF_PRaster* araster )
{
- FT_Error error = FT_Err_Ok;
- BSDF_TRaster* raster = NULL;
+ FT_Error error;
+ BSDF_PRaster raster = NULL;
- *araster = 0;
- if ( !FT_ALLOC( raster, sizeof ( BSDF_TRaster ) ) )
- {
+ if ( !FT_NEW( raster ) )
raster->memory = memory;
- *araster = (FT_Raster)raster;
- }
+
+ *araster = raster;
return error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c
index d3722b1dc17..f69cf49b471 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdf.c
@@ -204,7 +204,7 @@
{
FT_Memory memory;
- } SDF_TRaster;
+ } SDF_TRaster, *SDF_PRaster;
/**************************************************************************
@@ -841,12 +841,12 @@
*
*/
- /* Return the control box of a edge. The control box is a rectangle */
- /* in which all the control points can fit tightly. */
+ /* Return the control box of an edge. The control box is a rectangle */
+ /* in which all the control points can fit tightly. */
static FT_CBox
get_control_box( SDF_Edge edge )
{
- FT_CBox cbox;
+ FT_CBox cbox = { 0, 0, 0, 0 };
FT_Bool is_set = 0;
@@ -3706,25 +3706,19 @@
*/
static FT_Error
- sdf_raster_new( FT_Memory memory,
- FT_Raster* araster)
+ sdf_raster_new( FT_Memory memory,
+ SDF_PRaster* araster )
{
- FT_Error error = FT_Err_Ok;
- SDF_TRaster* raster = NULL;
- FT_Int line = __LINE__;
+ FT_Error error;
+ SDF_PRaster raster = NULL;
- /* in non-debugging mode this is not used */
- FT_UNUSED( line );
-
- *araster = 0;
- if ( !FT_ALLOC( raster, sizeof ( SDF_TRaster ) ) )
- {
+ if ( !FT_NEW( raster ) )
raster->memory = memory;
- *araster = (FT_Raster)raster;
- }
- return error;
+ *araster = raster;
+
+ return error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c
index 420ad496c74..30f2e62a4fe 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sdf/ftsdfrend.c
@@ -298,8 +298,15 @@
goto Exit;
}
+ /* the rows and pitch must be valid after presetting the */
+ /* bitmap using outline */
if ( !bitmap->rows || !bitmap->pitch )
+ {
+ FT_ERROR(( "ft_sdf_render: failed to preset bitmap\n" ));
+
+ error = FT_THROW( Cannot_Render_Glyph );
goto Exit;
+ }
/* the padding will simply be equal to the `spread' */
x_pad = sdf_module->spread;
@@ -350,6 +357,10 @@
error = render->raster_render( render->raster,
(const FT_Raster_Params*)&params );
+ /* transform the outline back to the original state */
+ if ( x_shift || y_shift )
+ FT_Outline_Translate( outline, -x_shift, -y_shift );
+
Exit:
if ( !error )
{
@@ -362,9 +373,6 @@
slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
}
- if ( x_shift || y_shift )
- FT_Outline_Translate( outline, -x_shift, -y_shift );
-
return error;
}
@@ -506,8 +514,24 @@
goto Exit;
}
+ /* Do not generate SDF if the bitmap is not owned by the */
+ /* glyph: it might be that the source buffer is already freed. */
+ if ( !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
+ {
+ FT_ERROR(( "ft_bsdf_render: can't generate SDF from"
+ " unowned source bitmap\n" ));
+
+ error = FT_THROW( Invalid_Argument );
+ goto Exit;
+ }
+
if ( !bitmap->rows || !bitmap->pitch )
+ {
+ FT_ERROR(( "ft_bsdf_render: invalid bitmap size\n" ));
+
+ error = FT_THROW( Invalid_Argument );
goto Exit;
+ }
FT_Bitmap_New( &target );
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c
index 824e709fab6..d1d01c99e52 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfdriver.c
@@ -1292,13 +1292,15 @@
/* TT_Get_Colr_Layer_Func get_colr_layer */
PUT_COLOR_LAYERS_V1( tt_face_get_colr_glyph_paint ),
- /* TT_Get_Colr_Glyph_Paint_Func get_colr_glyph_paint */
+ /* TT_Get_Color_Glyph_Paint_Func get_colr_glyph_paint */
+ PUT_COLOR_LAYERS_V1( tt_face_get_color_glyph_clipbox ),
+ /* TT_Get_Color_Glyph_ClipBox_Func get_clipbox */
PUT_COLOR_LAYERS_V1( tt_face_get_paint_layers ),
- /* TT_Get_Paint_Layers_Func get_paint_layers */
+ /* TT_Get_Paint_Layers_Func get_paint_layers */
PUT_COLOR_LAYERS_V1( tt_face_get_colorline_stops ),
- /* TT_Get_Paint get_paint */
+ /* TT_Get_Paint get_paint */
PUT_COLOR_LAYERS_V1( tt_face_get_paint ),
- /* TT_Get_Colorline_Stops_Func get_colorline_stops */
+ /* TT_Get_Colorline_Stops_Func get_colorline_stops */
PUT_COLOR_LAYERS( tt_face_colr_blend_layer ),
/* TT_Blend_Colr_Func colr_blend */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c
index cf730717eb0..78910247900 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfobjs.c
@@ -360,17 +360,27 @@
FT_FRAME_END
};
+#ifndef FT_CONFIG_OPTION_USE_BROTLI
+ FT_UNUSED( face_instance_index );
+ FT_UNUSED( woff2_num_faces );
+#endif
+
face->ttc_header.tag = 0;
face->ttc_header.version = 0;
face->ttc_header.count = 0;
+#if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \
+ defined( FT_CONFIG_OPTION_USE_BROTLI )
retry:
+#endif
+
offset = FT_STREAM_POS();
if ( FT_READ_ULONG( tag ) )
return error;
+#ifdef FT_CONFIG_OPTION_USE_ZLIB
if ( tag == TTAG_wOFF )
{
FT_TRACE2(( "sfnt_open_font: file is a WOFF; synthesizing SFNT\n" ));
@@ -386,7 +396,9 @@
stream = face->root.stream;
goto retry;
}
+#endif
+#ifdef FT_CONFIG_OPTION_USE_BROTLI
if ( tag == TTAG_wOF2 )
{
FT_TRACE2(( "sfnt_open_font: file is a WOFF2; synthesizing SFNT\n" ));
@@ -405,6 +417,7 @@
stream = face->root.stream;
goto retry;
}
+#endif
if ( tag != 0x00010000UL &&
tag != TTAG_ttcf &&
@@ -1209,7 +1222,7 @@
/* of `FT_Face', we map `available_sizes' indices to strike */
/* indices */
if ( FT_NEW_ARRAY( root->available_sizes, count ) ||
- FT_NEW_ARRAY( sbit_strike_map, count ) )
+ FT_QNEW_ARRAY( sbit_strike_map, count ) )
goto Exit;
bsize_idx = 0;
@@ -1238,7 +1251,7 @@
}
/* reduce array size to the actually used elements */
- (void)FT_QRENEW_ARRAY( sbit_strike_map, count, bsize_idx );
+ FT_MEM_QRENEW_ARRAY( sbit_strike_map, count, bsize_idx );
/* from now on, all strike indices are mapped */
/* using `sbit_strike_map' */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c
index 44c926ed413..422c816a215 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.c
@@ -23,6 +23,9 @@
#include <freetype/ftgzip.h>
+#ifdef FT_CONFIG_OPTION_USE_ZLIB
+
+
/**************************************************************************
*
* The macro FT_COMPONENT is used in trace mode. It is an implicit
@@ -109,7 +112,7 @@
FT_ULong sfnt_offset;
FT_Int nn;
- FT_ULong old_tag = 0;
+ FT_Tag old_tag = 0;
static const FT_Frame_Field woff_header_fields[] =
{
@@ -360,8 +363,6 @@
}
else
{
-#ifdef FT_CONFIG_OPTION_USE_ZLIB
-
/* Uncompress with zlib. */
FT_ULong output_len = table->OrigLength;
@@ -377,13 +378,6 @@
error = FT_THROW( Invalid_Table );
goto Exit1;
}
-
-#else /* !FT_CONFIG_OPTION_USE_ZLIB */
-
- error = FT_THROW( Unimplemented_Feature );
- goto Exit1;
-
-#endif /* !FT_CONFIG_OPTION_USE_ZLIB */
}
FT_FRAME_EXIT();
@@ -433,5 +427,12 @@
#undef WRITE_USHORT
#undef WRITE_ULONG
+#else /* !FT_CONFIG_OPTION_USE_ZLIB */
+
+ /* ANSI C doesn't like empty source files */
+ typedef int _sfwoff_dummy;
+
+#endif /* !FT_CONFIG_OPTION_USE_ZLIB */
+
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h
index e2f22731e20..3fbdac0fde7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff.h
@@ -26,12 +26,15 @@
FT_BEGIN_HEADER
+#ifdef FT_CONFIG_OPTION_USE_ZLIB
FT_LOCAL( FT_Error )
woff_open_font( FT_Stream stream,
TT_Face face );
+#endif
+
FT_END_HEADER
#endif /* SFWOFF_H_ */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c
index df04072382e..5ee8dea28a7 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.c
@@ -26,8 +26,6 @@
#include <brotli/decode.h>
-#endif
-
/**************************************************************************
*
@@ -108,8 +106,8 @@
WOFF2_Table table1 = *(WOFF2_Table*)a;
WOFF2_Table table2 = *(WOFF2_Table*)b;
- FT_ULong tag1 = table1->Tag;
- FT_ULong tag2 = table2->Tag;
+ FT_Tag tag1 = table1->Tag;
+ FT_Tag tag2 = table2->Tag;
if ( tag1 > tag2 )
@@ -316,8 +314,6 @@
const FT_Byte* src,
FT_ULong src_size )
{
-#ifdef FT_CONFIG_OPTION_USE_BROTLI
-
/* this cast is only of importance on 32bit systems; */
/* we don't validate it */
FT_Offset uncompressed_size = (FT_Offset)dst_size;
@@ -338,25 +334,13 @@
FT_TRACE2(( "woff2_decompress: Brotli stream decompressed.\n" ));
return FT_Err_Ok;
-
-#else /* !FT_CONFIG_OPTION_USE_BROTLI */
-
- FT_UNUSED( dst );
- FT_UNUSED( dst_size );
- FT_UNUSED( src );
- FT_UNUSED( src_size );
-
- FT_ERROR(( "woff2_decompress: Brotli support not available.\n" ));
- return FT_THROW( Unimplemented_Feature );
-
-#endif /* !FT_CONFIG_OPTION_USE_BROTLI */
}
static WOFF2_Table
find_table( WOFF2_Table* tables,
FT_UShort num_tables,
- FT_ULong tag )
+ FT_Tag tag )
{
FT_Int i;
@@ -2216,7 +2200,7 @@
/* reject fonts that have multiple tables with the same tag */
for ( nn = 1; nn < woff2.num_tables; nn++ )
{
- FT_ULong tag = indices[nn]->Tag;
+ FT_Tag tag = indices[nn]->Tag;
if ( tag == indices[nn - 1]->Tag )
@@ -2356,5 +2340,12 @@
#undef BBOX_STREAM
#undef INSTRUCTION_STREAM
+#else /* !FT_CONFIG_OPTION_USE_BROTLI */
+
+ /* ANSI C doesn't like empty source files */
+ typedef int _sfwoff2_dummy;
+
+#endif /* !FT_CONFIG_OPTION_USE_BROTLI */
+
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h
index 27f3da7b1d3..fa78b024297 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/sfwoff2.h
@@ -26,6 +26,7 @@
FT_BEGIN_HEADER
+#ifdef FT_CONFIG_OPTION_USE_BROTLI
/* Leave the first byte open to store `flag_byte'. */
#define WOFF2_FLAGS_TRANSFORM 1 << 8
@@ -66,6 +67,7 @@ FT_BEGIN_HEADER
FT_Int* face_index,
FT_Long* num_faces );
+#endif /* FT_CONFIG_OPTION_USE_BROTLI */
FT_END_HEADER
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c
index bd478ab9b5b..8f5cc8bcd1f 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.c
@@ -27,6 +27,7 @@
*/
+#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/tttags.h>
@@ -94,6 +95,8 @@
FT_ULong num_layers_v1;
FT_Byte* layers_v1;
+ FT_Byte* clip_list;
+
/*
* Paint tables start at the minimum of the end of the LayerList and the
* end of the BaseGlyphList. Record this location in a field here for
@@ -134,7 +137,7 @@
FT_ULong base_glyph_offset, layer_offset;
FT_ULong base_glyphs_offset_v1, num_base_glyphs_v1;
- FT_ULong layer_offset_v1, num_layers_v1;
+ FT_ULong layer_offset_v1, num_layers_v1, clip_list_offset;
FT_ULong table_size;
@@ -226,6 +229,16 @@
colr->base_glyphs_v1 +
colr->num_base_glyphs_v1 * BASE_GLYPH_PAINT_RECORD_SIZE;
}
+
+ clip_list_offset = FT_NEXT_ULONG( p );
+
+ if ( clip_list_offset >= table_size )
+ goto InvalidTable;
+
+ if ( clip_list_offset )
+ colr->clip_list = (FT_Byte*)( table + clip_list_offset );
+ else
+ colr->clip_list = 0;
}
colr->base_glyphs = (FT_Byte*)( table + base_glyph_offset );
@@ -493,12 +506,16 @@
&apaint->u.linear_gradient.colorline ) )
return 0;
- apaint->u.linear_gradient.p0.x = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p0.y = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p1.x = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p1.y = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p2.x = FT_NEXT_SHORT( p );
- apaint->u.linear_gradient.p2.y = FT_NEXT_SHORT( p );
+ /*
+ * In order to support variations expose these as FT_Fixed 16.16 values so
+ * that we can support fractional values after interpolation.
+ */
+ apaint->u.linear_gradient.p0.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.linear_gradient.p0.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.linear_gradient.p1.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.linear_gradient.p1.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.linear_gradient.p2.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.linear_gradient.p2.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
return 1;
}
@@ -509,15 +526,15 @@
&apaint->u.radial_gradient.colorline ) )
return 0;
- apaint->u.radial_gradient.c0.x = FT_NEXT_SHORT( p );
- apaint->u.radial_gradient.c0.y = FT_NEXT_SHORT( p );
+ apaint->u.radial_gradient.c0.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.radial_gradient.c0.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
- apaint->u.radial_gradient.r0 = FT_NEXT_USHORT( p );
+ apaint->u.radial_gradient.r0 = FT_NEXT_USHORT( p ) << 16;
- apaint->u.radial_gradient.c1.x = FT_NEXT_SHORT( p );
- apaint->u.radial_gradient.c1.y = FT_NEXT_SHORT( p );
+ apaint->u.radial_gradient.c1.x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.radial_gradient.c1.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
- apaint->u.radial_gradient.r1 = FT_NEXT_USHORT( p );
+ apaint->u.radial_gradient.r1 = FT_NEXT_USHORT( p ) << 16;
return 1;
}
@@ -528,11 +545,15 @@
&apaint->u.sweep_gradient.colorline ) )
return 0;
- apaint->u.sweep_gradient.center.x = FT_NEXT_SHORT( p );
- apaint->u.sweep_gradient.center.y = FT_NEXT_SHORT( p );
+ apaint->u.sweep_gradient.center.x =
+ INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.sweep_gradient.center.y =
+ INT_TO_FIXED( FT_NEXT_SHORT( p ) );
- apaint->u.sweep_gradient.start_angle = FT_NEXT_LONG( p );
- apaint->u.sweep_gradient.end_angle = FT_NEXT_LONG( p );
+ apaint->u.sweep_gradient.start_angle =
+ F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.sweep_gradient.end_angle =
+ F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
return 1;
}
@@ -551,6 +572,15 @@
apaint->u.transform.paint.p = child_table_p;
apaint->u.transform.paint.insert_root_transform = 0;
+ if ( !get_child_table_pointer( colr, paint_base, &p, &child_table_p ) )
+ return 0;
+
+ p = child_table_p;
+
+ /*
+ * The following matrix coefficients are encoded as
+ * OpenType 16.16 fixed-point values.
+ */
apaint->u.transform.affine.xx = FT_NEXT_LONG( p );
apaint->u.transform.affine.yx = FT_NEXT_LONG( p );
apaint->u.transform.affine.xy = FT_NEXT_LONG( p );
@@ -566,8 +596,8 @@
apaint->u.translate.paint.p = child_table_p;
apaint->u.translate.paint.insert_root_transform = 0;
- apaint->u.translate.dx = FT_NEXT_LONG( p );
- apaint->u.translate.dy = FT_NEXT_LONG( p );
+ apaint->u.translate.dx = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.translate.dy = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
return 1;
}
@@ -585,14 +615,14 @@
apaint->u.scale.paint.insert_root_transform = 0;
/* All scale paints get at least one scale value. */
- apaint->u.scale.scale_x = FT_NEXT_LONG( p );
+ apaint->u.scale.scale_x = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
/* Non-uniform ones read an extra y value. */
if ( apaint->format ==
FT_COLR_PAINTFORMAT_SCALE ||
(FT_PaintFormat_Internal)apaint->format ==
FT_COLR_PAINTFORMAT_INTERNAL_SCALE_CENTER )
- apaint->u.scale.scale_y = FT_NEXT_LONG( p );
+ apaint->u.scale.scale_y = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
else
apaint->u.scale.scale_y = apaint->u.scale.scale_x;
@@ -603,8 +633,8 @@
(FT_PaintFormat_Internal)apaint->format ==
FT_COLR_PAINTFORMAT_INTERNAL_SCALE_UNIFORM_CENTER )
{
- apaint->u.scale.center_x = FT_NEXT_LONG ( p );
- apaint->u.scale.center_y = FT_NEXT_LONG ( p );
+ apaint->u.scale.center_x = INT_TO_FIXED( FT_NEXT_SHORT ( p ) );
+ apaint->u.scale.center_y = INT_TO_FIXED( FT_NEXT_SHORT ( p ) );
}
else
{
@@ -619,29 +649,55 @@
return 1;
}
- else if ( apaint->format == FT_COLR_PAINTFORMAT_ROTATE )
+ else if ( apaint->format == FT_COLR_PAINTFORMAT_ROTATE ||
+ (FT_PaintFormat_Internal)apaint->format ==
+ FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER )
{
apaint->u.rotate.paint.p = child_table_p;
apaint->u.rotate.paint.insert_root_transform = 0;
- apaint->u.rotate.angle = FT_NEXT_LONG( p );
+ apaint->u.rotate.angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
+
+ if ( (FT_PaintFormat_Internal)apaint->format ==
+ FT_COLR_PAINTFORMAT_INTERNAL_ROTATE_CENTER )
+ {
+ apaint->u.rotate.center_x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.rotate.center_y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ }
+ else
+ {
+ apaint->u.rotate.center_x = 0;
+ apaint->u.rotate.center_y = 0;
+ }
- apaint->u.rotate.center_x = FT_NEXT_LONG( p );
- apaint->u.rotate.center_y = FT_NEXT_LONG( p );
+ apaint->format = FT_COLR_PAINTFORMAT_ROTATE;
return 1;
}
- else if ( apaint->format == FT_COLR_PAINTFORMAT_SKEW )
+ else if ( apaint->format == FT_COLR_PAINTFORMAT_SKEW ||
+ (FT_PaintFormat_Internal)apaint->format ==
+ FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER )
{
apaint->u.skew.paint.p = child_table_p;
apaint->u.skew.paint.insert_root_transform = 0;
- apaint->u.skew.x_skew_angle = FT_NEXT_LONG( p );
- apaint->u.skew.y_skew_angle = FT_NEXT_LONG( p );
+ apaint->u.skew.x_skew_angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.skew.y_skew_angle = F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
+
+ if ( (FT_PaintFormat_Internal)apaint->format ==
+ FT_COLR_PAINTFORMAT_INTERNAL_SKEW_CENTER )
+ {
+ apaint->u.skew.center_x = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ apaint->u.skew.center_y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
+ }
+ else
+ {
+ apaint->u.skew.center_x = 0;
+ apaint->u.skew.center_y = 0;
+ }
- apaint->u.skew.center_x = FT_NEXT_LONG( p );
- apaint->u.skew.center_y = FT_NEXT_LONG( p );
+ apaint->format = FT_COLR_PAINTFORMAT_SKEW;
return 1;
}
@@ -762,6 +818,117 @@
FT_LOCAL_DEF( FT_Bool )
+ tt_face_get_color_glyph_clipbox( TT_Face face,
+ FT_UInt base_glyph,
+ FT_ClipBox* clip_box )
+ {
+ Colr* colr;
+
+ FT_Byte *p, *p1, *clip_base;
+
+ FT_Byte clip_list_format;
+ FT_ULong num_clip_boxes, i;
+ FT_UShort gid_start, gid_end;
+ FT_UInt32 clip_box_offset;
+ FT_Byte format;
+
+ const FT_Byte num_corners = 4;
+ FT_Vector corners[4];
+ FT_Byte j;
+ FT_BBox font_clip_box;
+
+
+ colr = (Colr*)face->colr;
+ if ( !colr )
+ return 0;
+
+ if ( !colr->clip_list )
+ return 0;
+
+ p = colr->clip_list;
+
+ clip_base = p;
+ clip_list_format = FT_NEXT_BYTE ( p );
+
+ /* Format byte used here to be able to upgrade ClipList for >16bit */
+ /* glyph ids; for now we can expect it to be 0. */
+ if ( !( clip_list_format == 1 ) )
+ return 0;
+
+ num_clip_boxes = FT_NEXT_ULONG( p );
+
+ for ( i = 0; i < num_clip_boxes; ++i )
+ {
+ gid_start = FT_NEXT_USHORT( p );
+ gid_end = FT_NEXT_USHORT( p );
+ clip_box_offset = FT_NEXT_UOFF3( p );
+
+ if ( base_glyph >= gid_start && base_glyph <= gid_end )
+ {
+ p1 = (FT_Byte*)( clip_base + clip_box_offset );
+
+ if ( p1 >= ( (FT_Byte*)colr->table + colr->table_size ) )
+ return 0;
+
+ format = FT_NEXT_BYTE( p1 );
+
+ if ( format > 1 )
+ return 0;
+
+ /* `face->root.size->metrics.x_scale` and `y_scale` are factors */
+ /* that scale a font unit value in integers to a 26.6 fixed value */
+ /* according to the requested size, see for example */
+ /* `ft_recompute_scaled_metrics`. */
+ font_clip_box.xMin = FT_MulFix( FT_NEXT_SHORT( p1 ),
+ face->root.size->metrics.x_scale );
+ font_clip_box.yMin = FT_MulFix( FT_NEXT_SHORT( p1 ),
+ face->root.size->metrics.x_scale );
+ font_clip_box.xMax = FT_MulFix( FT_NEXT_SHORT( p1 ),
+ face->root.size->metrics.x_scale );
+ font_clip_box.yMax = FT_MulFix( FT_NEXT_SHORT( p1 ),
+ face->root.size->metrics.x_scale );
+
+ /* Make 4 corner points (xMin, yMin), (xMax, yMax) and transform */
+ /* them. If we we would only transform two corner points and */
+ /* span a rectangle based on those, the rectangle may become too */
+ /* small to cover the glyph. */
+ corners[0].x = font_clip_box.xMin;
+ corners[1].x = font_clip_box.xMin;
+ corners[2].x = font_clip_box.xMax;
+ corners[3].x = font_clip_box.xMax;
+
+ corners[0].y = font_clip_box.yMin;
+ corners[1].y = font_clip_box.yMax;
+ corners[2].y = font_clip_box.yMax;
+ corners[3].y = font_clip_box.yMin;
+
+ for ( j = 0; j < num_corners; ++j )
+ {
+ if ( face->root.internal->transform_flags & 1 )
+ FT_Vector_Transform( &corners[j],
+ &face->root.internal->transform_matrix );
+
+ if ( face->root.internal->transform_flags & 2 )
+ {
+ corners[j].x += face->root.internal->transform_delta.x;
+ corners[j].y += face->root.internal->transform_delta.y;
+ }
+ }
+
+ clip_box->bottom_left = corners[0];
+ clip_box->top_left = corners[1];
+ clip_box->top_right = corners[2];
+ clip_box->bottom_right = corners[3];
+
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+
+
+ FT_LOCAL_DEF( FT_Bool )
tt_face_get_paint_layers( TT_Face face,
FT_LayerIterator* iterator,
FT_OpaquePaint* opaque_paint )
@@ -928,9 +1095,9 @@
if ( face->root.internal->transform_flags & 2 )
{
paint->u.transform.affine.dx =
- face->root.internal->transform_delta.x << 10;
+ face->root.internal->transform_delta.x * ( 1 << 10 );
paint->u.transform.affine.dy =
- face->root.internal->transform_delta.y << 10;
+ face->root.internal->transform_delta.y * ( 1 << 10 );
}
else
{
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h
index c91d2b1723e..b81e4cb958c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttcolr.h
@@ -49,6 +49,11 @@ FT_BEGIN_HEADER
FT_OpaquePaint* paint );
FT_LOCAL( FT_Bool )
+ tt_face_get_color_glyph_clipbox( TT_Face face,
+ FT_UInt base_glyph,
+ FT_ClipBox* clip_box );
+
+ FT_LOCAL( FT_Bool )
tt_face_get_paint_layers( TT_Face face,
FT_LayerIterator* iterator,
FT_OpaquePaint* paint );
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c
index d8ea9ea01cd..51416d80b4a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/ttload.c
@@ -837,6 +837,8 @@
FT_ULong table_pos, table_len;
FT_ULong storage_start, storage_limit;
TT_NameTable table;
+ TT_Name names = NULL;
+ TT_LangTag langTags = NULL;
static const FT_Frame_Field name_table_fields[] =
{
@@ -917,13 +919,13 @@
storage_start += 2 + 4 * table->numLangTagRecords;
/* allocate language tag records array */
- if ( FT_QNEW_ARRAY( table->langTags, table->numLangTagRecords ) ||
- FT_FRAME_ENTER( table->numLangTagRecords * 4 ) )
+ if ( FT_QNEW_ARRAY( langTags, table->numLangTagRecords ) ||
+ FT_FRAME_ENTER( table->numLangTagRecords * 4 ) )
goto Exit;
/* load language tags */
{
- TT_LangTag entry = table->langTags;
+ TT_LangTag entry = langTags;
TT_LangTag limit = FT_OFFSET( entry, table->numLangTagRecords );
@@ -939,7 +941,13 @@
/* invalid entry; ignore it */
entry->stringLength = 0;
}
+
+ /* mark the string as not yet loaded */
+ entry->string = NULL;
}
+
+ table->langTags = langTags;
+ langTags = NULL;
}
FT_FRAME_EXIT();
@@ -948,14 +956,15 @@
}
/* allocate name records array */
- if ( FT_QNEW_ARRAY( table->names, table->numNameRecords ) ||
- FT_FRAME_ENTER( table->numNameRecords * 12 ) )
+ if ( FT_QNEW_ARRAY( names, table->numNameRecords ) ||
+ FT_FRAME_ENTER( table->numNameRecords * 12 ) )
goto Exit;
/* load name records */
{
- TT_Name entry = table->names;
+ TT_Name entry = names;
FT_UInt count = table->numNameRecords;
+ FT_UInt valid = 0;
for ( ; count > 0; count-- )
@@ -988,15 +997,20 @@
}
}
+ /* mark the string as not yet converted */
+ entry->string = NULL;
+
+ valid++;
entry++;
}
/* reduce array size to the actually used elements */
- count = (FT_UInt)( entry - table->names );
- (void)FT_QRENEW_ARRAY( table->names,
- table->numNameRecords,
- count );
- table->numNameRecords = count;
+ FT_MEM_QRENEW_ARRAY( names,
+ table->numNameRecords,
+ valid );
+ table->names = names;
+ names = NULL;
+ table->numNameRecords = valid;
}
FT_FRAME_EXIT();
@@ -1005,6 +1019,8 @@
face->num_names = (FT_UShort)table->numNameRecords;
Exit:
+ FT_FREE( names );
+ FT_FREE( langTags );
return error;
}
@@ -1417,8 +1433,8 @@
FT_Error error;
FT_Memory memory = stream->memory;
- FT_UInt j,num_ranges;
- TT_GaspRange gaspranges = NULL;
+ FT_UShort j, num_ranges;
+ TT_GaspRange gasp_ranges = NULL;
/* the gasp table is optional */
@@ -1429,8 +1445,8 @@
if ( FT_FRAME_ENTER( 4L ) )
goto Exit;
- face->gasp.version = FT_GET_USHORT();
- face->gasp.numRanges = FT_GET_USHORT();
+ face->gasp.version = FT_GET_USHORT();
+ num_ranges = FT_GET_USHORT();
FT_FRAME_EXIT();
@@ -1442,29 +1458,31 @@
goto Exit;
}
- num_ranges = face->gasp.numRanges;
- FT_TRACE3(( "numRanges: %u\n", num_ranges ));
+ FT_TRACE3(( "numRanges: %hu\n", num_ranges ));
- if ( FT_QNEW_ARRAY( face->gasp.gaspRanges, num_ranges ) ||
- FT_FRAME_ENTER( num_ranges * 4L ) )
+ if ( FT_QNEW_ARRAY( gasp_ranges, num_ranges ) ||
+ FT_FRAME_ENTER( num_ranges * 4L ) )
goto Exit;
- gaspranges = face->gasp.gaspRanges;
-
for ( j = 0; j < num_ranges; j++ )
{
- gaspranges[j].maxPPEM = FT_GET_USHORT();
- gaspranges[j].gaspFlag = FT_GET_USHORT();
+ gasp_ranges[j].maxPPEM = FT_GET_USHORT();
+ gasp_ranges[j].gaspFlag = FT_GET_USHORT();
FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\n",
j,
- gaspranges[j].maxPPEM,
- gaspranges[j].gaspFlag ));
+ gasp_ranges[j].maxPPEM,
+ gasp_ranges[j].gaspFlag ));
}
+ face->gasp.gaspRanges = gasp_ranges;
+ gasp_ranges = NULL;
+ face->gasp.numRanges = num_ranges;
+
FT_FRAME_EXIT();
Exit:
+ FT_FREE( gasp_ranges );
return error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c
index 84748268c1a..fe8f5cf76f6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.c
@@ -17,6 +17,9 @@
#include <freetype/tttags.h>
+
+#ifdef FT_CONFIG_OPTION_USE_BROTLI
+
#include "woff2tags.h"
/*
@@ -28,10 +31,10 @@
*
* for details.
*/
- FT_LOCAL_DEF( FT_ULong )
+ FT_LOCAL_DEF( FT_Tag )
woff2_known_tags( FT_Byte index )
{
- const FT_ULong known_tags[63] =
+ static const FT_Tag known_tags[63] =
{
FT_MAKE_TAG('c', 'm', 'a', 'p'), /* 0 */
FT_MAKE_TAG('h', 'e', 'a', 'd'), /* 1 */
@@ -105,5 +108,12 @@
return known_tags[index];
}
+#else /* !FT_CONFIG_OPTION_USE_BROTLI */
+
+ /* ANSI C doesn't like empty source files */
+ typedef int _woff2tags_dummy;
+
+#endif /* !FT_CONFIG_OPTION_USE_BROTLI */
+
/* END */
diff --git a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h
index 543daf89111..4ef0a651c3e 100644
--- a/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h
+++ b/Build/source/libs/freetype2/freetype-src/src/sfnt/woff2tags.h
@@ -2,7 +2,7 @@
*
* woff2tags.h
*
- * WOFFF2 Font table tags (specification).
+ * WOFF2 Font table tags (specification).
*
* Copyright (C) 2019-2021 by
* Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
@@ -26,10 +26,12 @@
FT_BEGIN_HEADER
+#ifdef FT_CONFIG_OPTION_USE_BROTLI
- FT_LOCAL( FT_ULong )
+ FT_LOCAL( FT_Tag )
woff2_known_tags( FT_Byte index );
+#endif
FT_END_HEADER
diff --git a/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c b/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c
index b4cbd3c8eb2..d982c2820b9 100644
--- a/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c
+++ b/Build/source/libs/freetype2/freetype-src/src/smooth/ftgrays.c
@@ -149,14 +149,10 @@
#define FT_INT_MAX INT_MAX
#define FT_ULONG_MAX ULONG_MAX
-#define ADD_LONG( a, b ) \
- (long)( (unsigned long)(a) + (unsigned long)(b) )
-#define SUB_LONG( a, b ) \
- (long)( (unsigned long)(a) - (unsigned long)(b) )
-#define MUL_LONG( a, b ) \
- (long)( (unsigned long)(a) * (unsigned long)(b) )
-#define NEG_LONG( a ) \
- (long)( -(unsigned long)(a) )
+#define ADD_INT( a, b ) \
+ (int)( (unsigned int)(a) + (unsigned int)(b) )
+
+#define FT_STATIC_BYTE_CAST( type, var ) (type)(unsigned char)(var)
#define ft_memset memset
@@ -243,10 +239,13 @@ typedef ptrdiff_t FT_PtrDist;
#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
#define FT_THROW( e ) FT_ERR_CAT( Smooth_Err_, e )
-
#endif /* !FT_DEBUG_LEVEL_TRACE */
+#define FT_Trace_Enable() do { } while ( 0 ) /* nothing */
+#define FT_Trace_Disable() do { } while ( 0 ) /* nothing */
+
+
#define FT_DEFINE_OUTLINE_FUNCS( class_, \
move_to_, line_to_, \
conic_to_, cubic_to_, \
@@ -279,6 +278,8 @@ typedef ptrdiff_t FT_PtrDist;
#else /* !STANDALONE_ */
+#include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
#include "ftgrays.h"
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftdebug.h>
@@ -359,7 +360,7 @@ typedef ptrdiff_t FT_PtrDist;
} \
FT_END_STMNT
-#ifdef __arm__
+#if defined( __GNUC__ ) && __GNUC__ < 7 && defined( __arm__ )
/* Work around a bug specific to GCC which make the compiler fail to */
/* optimize a division and modulo operation on the same parameters */
/* into a single call to `__aeabi_idivmod'. See */
@@ -379,14 +380,23 @@ typedef ptrdiff_t FT_PtrDist;
#endif /* __arm__ */
- /* These macros speed up repetitive divisions by replacing them */
- /* with multiplications and right shifts. */
-#define FT_UDIVPREP( c, b ) \
- long b ## _r = c ? (long)( FT_ULONG_MAX >> PIXEL_BITS ) / ( b ) \
- : 0
-#define FT_UDIV( a, b ) \
- (TCoord)( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \
- ( sizeof( long ) * FT_CHAR_BIT - PIXEL_BITS ) )
+ /* Calculating coverages for a slanted line requires a division each */
+ /* time the line crosses from cell to cell. These macros speed up */
+ /* the repetitive divisions by replacing them with multiplications */
+ /* and right shifts so that at most two divisions are performed for */
+ /* each slanted line. Nevertheless, these divisions are noticeable */
+ /* in the overall performance because flattened curves produce a */
+ /* very large number of slanted lines. */
+ /* */
+ /* The division results here are always within ONE_PIXEL. Therefore */
+ /* the shift magnitude should be at least PIXEL_BITS wider than the */
+ /* divisors to provide sufficient accuracy of the multiply-shift. */
+ /* It should not exceed (64 - PIXEL_BITS) to prevent overflowing and */
+ /* leave enough room for 64-bit unsigned multiplication however. */
+#define FT_UDIVPREP( c, b ) \
+ FT_Int64 b ## _r = c ? (FT_Int64)0xFFFFFFFF / ( b ) : 0
+#define FT_UDIV( a, b ) \
+ (TCoord)( ( (FT_UInt64)( a ) * (FT_UInt64)( b ## _r ) ) >> 32 )
/* Scale area and apply fill rule to calculate the coverage byte. */
@@ -437,16 +447,17 @@ typedef ptrdiff_t FT_PtrDist;
typedef int TCoord; /* integer scanline/pixel coordinate */
typedef int TArea; /* cell areas, coordinate products */
- struct TCell_
+
+ typedef struct TCell_* PCell;
+
+ typedef struct TCell_
{
TCoord x; /* same with gray_TWorker.ex */
TCoord cover; /* same with gray_TWorker.cover */
TArea area;
- struct TCell_ *next;
- };
+ PCell next;
- typedef struct TCell_ TCell;
- typedef TCell *PCell;
+ } TCell;
typedef struct TPixmap_
{
@@ -484,14 +495,11 @@ typedef ptrdiff_t FT_PtrDist;
PCell cell; /* current cell */
PCell cell_free; /* call allocation next free slot */
- PCell cell_limit; /* cell allocation limit */
+ PCell cell_null; /* last cell, used as dumpster and limit */
PCell* ycells; /* array of cell linked-lists; one per */
/* vertical coordinate in the current band */
- PCell cells; /* cell storage area */
- FT_PtrDist max_cells; /* cell storage capacity */
-
TPos x, y; /* last point position */
FT_Outline outline; /* input outline */
@@ -512,25 +520,14 @@ typedef ptrdiff_t FT_PtrDist;
static gray_TWorker ras;
#endif
- /*
- * Return a pointer to the 'null cell', used as a sentinel at the end of
- * all `ycells` linked lists. Its x coordinate should be maximal to
- * ensure no NULL checks are necessary when looking for an insertion point
- * in `gray_set_cell`. Other loops should check the cell pointer with
- * CELL_IS_NULL() to detect the end of the list.
- */
-#define NULL_CELL_PTR( ras ) (ras).cells
-
/* The |x| value of the null cell. Must be the largest possible */
/* integer value stored in a `TCell.x` field. */
#define CELL_MAX_X_VALUE INT_MAX
- /* Return true iff |cell| points to the null cell. */
-#define CELL_IS_NULL( cell ) ( (cell)->x == CELL_MAX_X_VALUE )
-
-#define FT_INTEGRATE( ras, a, b ) \
- ras.cell->cover += (a), ras.cell->area += (a) * (TArea)(b)
+#define FT_INTEGRATE( ras, a, b ) \
+ ras.cell->cover = ADD_INT( ras.cell->cover, a ), \
+ ras.cell->area = ADD_INT( ras.cell->area, (a) * (TArea)(b) )
typedef struct gray_TRaster_
@@ -557,7 +554,7 @@ typedef ptrdiff_t FT_PtrDist;
printf( "%3d:", y );
- for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
+ for ( ; cell != ras.cell_null; cell = cell->next )
printf( " (%3d, c:%4d, a:%6d)",
cell->x, cell->cover, cell->area );
printf( "\n" );
@@ -576,7 +573,7 @@ typedef ptrdiff_t FT_PtrDist;
TCoord ey )
{
/* Move the cell pointer to a new position in the linked list. We use */
- /* NULL to indicate that the cell is outside of the clipping region */
+ /* a dumpster null cell for everything outside of the clipping region */
/* during the render phase. This means that: */
/* */
/* . the new vertical position must be within min_ey..max_ey-1. */
@@ -589,7 +586,7 @@ typedef ptrdiff_t FT_PtrDist;
if ( ey_index < 0 || ey_index >= ras.count_ey || ex >= ras.max_ex )
- ras.cell = NULL_CELL_PTR( ras );
+ ras.cell = ras.cell_null;
else
{
PCell* pcell = ras.ycells + ey_index;
@@ -613,7 +610,7 @@ typedef ptrdiff_t FT_PtrDist;
/* insert new cell */
cell = ras.cell_free++;
- if ( cell >= ras.cell_limit )
+ if ( cell >= ras.cell_null )
ft_longjmp( ras.jump_buffer, 1 );
cell->x = ex;
@@ -629,7 +626,7 @@ typedef ptrdiff_t FT_PtrDist;
}
-#ifndef FT_LONG64
+#ifndef FT_INT64
/**************************************************************************
*
@@ -657,8 +654,8 @@ typedef ptrdiff_t FT_PtrDist;
return;
}
- fx1 = FRACT( x1 );
- fx2 = FRACT( x2 );
+ fx1 = FRACT( x1 );
+ fx2 = FRACT( x2 );
/* everything is located in a single cell. That is easy! */
/* */
@@ -925,7 +922,7 @@ typedef ptrdiff_t FT_PtrDist;
}
else /* any other line */
{
- TPos prod = dx * (TPos)fy1 - dy * (TPos)fx1;
+ FT_Int64 prod = dx * (FT_Int64)fy1 - dy * (FT_Int64)fx1;
FT_UDIVPREP( ex1 != ex2, dx );
FT_UDIVPREP( ey1 != ey2, dy );
@@ -1007,10 +1004,17 @@ typedef ptrdiff_t FT_PtrDist;
*
* For other cases, using binary splits is actually slightly faster.
*/
-#if defined( __SSE2__ ) || \
- defined( __x86_64__ ) || \
+#if defined( __SSE2__ ) || \
+ defined( __x86_64__ ) || \
+ defined( _M_AMD64 ) || \
+ ( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 )
+# define FT_SSE2 1
+#else
+# define FT_SSE2 0
+#endif
+
+#if FT_SSE2 || \
defined( __aarch64__ ) || \
- defined( _M_AMD64 ) || \
defined( _M_ARM64 )
# define BEZIER_USE_DDA 1
#else
@@ -1019,30 +1023,32 @@ typedef ptrdiff_t FT_PtrDist;
/*
* For now, the code that depends on `BEZIER_USE_DDA` requires `FT_Int64`
- * to be defined. If `FT_LONG64` is not defined, meaning there is no
+ * to be defined. If `FT_INT64` is not defined, meaning there is no
* 64-bit type available, disable it to avoid compilation errors. See for
* example https://gitlab.freedesktop.org/freetype/freetype/-/issues/1071.
*/
-#if !defined( FT_LONG64 )
+#if !defined( FT_INT64 )
# undef BEZIER_USE_DDA
# define BEZIER_USE_DDA 0
#endif
#if BEZIER_USE_DDA
-#ifdef __SSE2__
+#if FT_SSE2
# include <emmintrin.h>
#endif
+#define LEFT_SHIFT( a, b ) (FT_Int64)( (FT_UInt64)(a) << (b) )
+
+
static void
gray_render_conic( RAS_ARG_ const FT_Vector* control,
const FT_Vector* to )
{
FT_Vector p0, p1, p2;
- TPos dx, dy;
+ TPos ax, ay, bx, by, dx, dy;
int shift;
- FT_Int64 ax, ay, bx, by;
FT_Int64 rx, ry;
FT_Int64 qx, qy;
FT_Int64 px, py;
@@ -1070,8 +1076,13 @@ typedef ptrdiff_t FT_PtrDist;
return;
}
- dx = FT_ABS( p0.x + p2.x - 2 * p1.x );
- dy = FT_ABS( p0.y + p2.y - 2 * p1.y );
+ bx = p1.x - p0.x;
+ by = p1.y - p0.y;
+ ax = p2.x - p1.x - bx; /* p0.x + p2.x - 2 * p1.x */
+ ay = p2.y - p1.y - by; /* p0.y + p2.y - 2 * p1.y */
+
+ dx = FT_ABS( ax );
+ dy = FT_ABS( ay );
if ( dx < dy )
dx = dy;
@@ -1125,16 +1136,18 @@ typedef ptrdiff_t FT_PtrDist;
* EMIT(P)
*
* To ensure accurate results, perform computations on 64-bit
- * values, after scaling them by 2^32:
+ * values, after scaling them by 2^32.
*
- * R << 32 = 2 * A << (32 - N - N)
- * = A << (33 - 2 *N)
+ * h = 1 / 2^N
*
- * Q << 32 = (2 * B << (32 - N)) + (A << (32 - N - N))
- * = (B << (33 - N)) + (A << (32 - N - N))
+ * R << 32 = 2 * A << (32 - N - N)
+ * = A << (33 - 2*N)
+ *
+ * Q << 32 = (2 * B << (32 - N)) + (A << (32 - N - N))
+ * = (B << (33 - N)) + (A << (32 - 2*N))
*/
-#ifdef __SSE2__
+#if FT_SSE2
/* Experience shows that for small shift values, */
/* SSE2 is actually slower. */
if ( shift > 2 )
@@ -1158,10 +1171,10 @@ typedef ptrdiff_t FT_PtrDist;
__m128i p;
- u.i.ax = p0.x + p2.x - 2 * p1.x;
- u.i.ay = p0.y + p2.y - 2 * p1.y;
- u.i.bx = p1.x - p0.x;
- u.i.by = p1.y - p0.y;
+ u.i.ax = ax;
+ u.i.ay = ay;
+ u.i.bx = bx;
+ u.i.by = by;
a = _mm_load_si128( &u.vec.a );
b = _mm_load_si128( &u.vec.b );
@@ -1179,7 +1192,7 @@ typedef ptrdiff_t FT_PtrDist;
p = _mm_load_si128( &v.vec );
- for ( count = ( 1U << shift ); count > 0; count-- )
+ for ( count = 1U << shift; count > 0; count-- )
{
p = _mm_add_epi64( p, q );
q = _mm_add_epi64( q, r );
@@ -1191,21 +1204,16 @@ typedef ptrdiff_t FT_PtrDist;
return;
}
-#endif /* __SSE2__ */
+#endif /* FT_SSE2 */
- ax = p0.x + p2.x - 2 * p1.x;
- ay = p0.y + p2.y - 2 * p1.y;
- bx = p1.x - p0.x;
- by = p1.y - p0.y;
-
- rx = ax << ( 33 - 2 * shift );
- ry = ay << ( 33 - 2 * shift );
+ rx = LEFT_SHIFT( ax, 33 - 2 * shift );
+ ry = LEFT_SHIFT( ay, 33 - 2 * shift );
- qx = ( bx << ( 33 - shift ) ) + ( ax << ( 32 - 2 * shift ) );
- qy = ( by << ( 33 - shift ) ) + ( ay << ( 32 - 2 * shift ) );
+ qx = LEFT_SHIFT( bx, 33 - shift ) + LEFT_SHIFT( ax, 32 - 2 * shift );
+ qy = LEFT_SHIFT( by, 33 - shift ) + LEFT_SHIFT( ay, 32 - 2 * shift );
- px = (FT_Int64)p0.x << 32;
- py = (FT_Int64)p0.y << 32;
+ px = LEFT_SHIFT( p0.x, 32 );
+ py = LEFT_SHIFT( p0.y, 32 );
for ( count = 1U << shift; count > 0; count-- )
{
@@ -1255,7 +1263,7 @@ typedef ptrdiff_t FT_PtrDist;
FT_Vector bez_stack[16 * 2 + 1]; /* enough to accommodate bisections */
FT_Vector* arc = bez_stack;
TPos dx, dy;
- int draw, split;
+ int draw;
arc[0].x = UPSCALE( to->x );
@@ -1298,7 +1306,9 @@ typedef ptrdiff_t FT_PtrDist;
/* many times as there are trailing zeros in the counter. */
do
{
- split = draw & ( -draw ); /* isolate the rightmost 1-bit */
+ int split = draw & ( -draw ); /* isolate the rightmost 1-bit */
+
+
while ( ( split >>= 1 ) )
{
gray_split_conic( arc );
@@ -1465,7 +1475,8 @@ typedef ptrdiff_t FT_PtrDist;
static void
gray_sweep( RAS_ARG )
{
- int fill = ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ? 0x100 : INT_MIN;
+ int fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
+ : INT_MIN;
int coverage;
int y;
@@ -1475,13 +1486,15 @@ typedef ptrdiff_t FT_PtrDist;
PCell cell = ras.ycells[y - ras.min_ey];
TCoord x = ras.min_ex;
TArea cover = 0;
- TArea area;
unsigned char* line = ras.target.origin - ras.target.pitch * y;
- for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
+ for ( ; cell != ras.cell_null; cell = cell->next )
{
+ TArea area;
+
+
if ( cover != 0 && cell->x > x )
{
FT_FILL_RULE( coverage, cover, fill );
@@ -1512,7 +1525,8 @@ typedef ptrdiff_t FT_PtrDist;
static void
gray_sweep_direct( RAS_ARG )
{
- int fill = ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ? 0x100 : INT_MIN;
+ int fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
+ : INT_MIN;
int coverage;
int y;
@@ -1525,11 +1539,13 @@ typedef ptrdiff_t FT_PtrDist;
PCell cell = ras.ycells[y - ras.min_ey];
TCoord x = ras.min_ex;
TArea cover = 0;
- TArea area;
- for ( ; !CELL_IS_NULL( cell ); cell = cell->next )
+ for ( ; cell != ras.cell_null; cell = cell->next )
{
+ TArea area;
+
+
if ( cover != 0 && cell->x > x )
{
FT_FILL_RULE( coverage, cover, fill );
@@ -1905,11 +1921,11 @@ typedef ptrdiff_t FT_PtrDist;
if ( continued )
FT_Trace_Enable();
- FT_TRACE7(( "band [%d..%d]: %ld cell%s\n",
+ FT_TRACE7(( "band [%d..%d]: %ld cell%s remaining/\n",
ras.min_ey,
ras.max_ey,
- ras.cell_free - ras.cells,
- ras.cell_free - ras.cells == 1 ? "" : "s" ));
+ ras.cell_null - ras.cell_free,
+ ras.cell_null - ras.cell_free == 1 ? "" : "s" ));
}
else
{
@@ -1937,9 +1953,18 @@ typedef ptrdiff_t FT_PtrDist;
TCoord* band;
int continued = 0;
- PCell null_cell;
+
+
+ /* Initialize the null cell at the end of the poll. */
+ ras.cell_null = buffer + FT_MAX_GRAY_POOL - 1;
+ ras.cell_null->x = CELL_MAX_X_VALUE;
+ ras.cell_null->area = 0;
+ ras.cell_null->cover = 0;
+ ras.cell_null->next = NULL;
/* set up vertical bands */
+ ras.ycells = (PCell*)buffer;
+
if ( height > n )
{
/* two divisions rounded up */
@@ -1947,23 +1972,6 @@ typedef ptrdiff_t FT_PtrDist;
height = ( height + n - 1 ) / n;
}
- /* memory management */
- n = ( height * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) / sizeof ( TCell );
-
- ras.cells = buffer + n;
- ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - n );
- ras.cell_limit = ras.cells + ras.max_cells;
- ras.ycells = (PCell*)buffer;
-
- /* Initialize the null cell at the start of the `cells` array. */
- /* Note that this requires `ras.cell_free` initialization to skip */
- /* over the first entry in the array. */
- null_cell = NULL_CELL_PTR( ras );
- null_cell->x = CELL_MAX_X_VALUE;
- null_cell->area = 0;
- null_cell->cover = 0;
- null_cell->next = NULL;;
-
for ( y = yMin; y < yMax; )
{
ras.min_ey = y;
@@ -1982,10 +1990,14 @@ typedef ptrdiff_t FT_PtrDist;
for ( w = 0; w < width; ++w )
- ras.ycells[w] = null_cell;
+ ras.ycells[w] = ras.cell_null;
- ras.cell_free = ras.cells + 1; /* NOTE: Skip over the null cell. */
- ras.cell = null_cell;
+ /* memory management: skip ycells */
+ n = ( (size_t)width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
+ sizeof ( TCell );
+
+ ras.cell_free = buffer + n;
+ ras.cell = ras.cell_null;
ras.min_ey = band[1];
ras.max_ey = band[0];
ras.count_ey = width;
@@ -2142,19 +2154,17 @@ typedef ptrdiff_t FT_PtrDist;
#else /* !STANDALONE_ */
static int
- gray_raster_new( FT_Memory memory,
- FT_Raster* araster )
+ gray_raster_new( FT_Memory memory,
+ gray_PRaster* araster )
{
FT_Error error;
gray_PRaster raster = NULL;
- *araster = 0;
- if ( !FT_ALLOC( raster, sizeof ( gray_TRaster ) ) )
- {
+ if ( !FT_NEW( raster ) )
raster->memory = memory;
- *araster = (FT_Raster)raster;
- }
+
+ *araster = raster;
return error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/tools/apinames.c b/Build/source/libs/freetype2/freetype-src/src/tools/apinames.c
index aeecf88d227..8a8b0822b13 100644
--- a/Build/source/libs/freetype2/freetype-src/src/tools/apinames.c
+++ b/Build/source/libs/freetype2/freetype-src/src/tools/apinames.c
@@ -22,7 +22,7 @@
#include <ctype.h>
#define PROGRAM_NAME "apinames"
-#define PROGRAM_VERSION "0.3"
+#define PROGRAM_VERSION "0.4"
#define LINEBUFF_SIZE 1024
@@ -33,6 +33,7 @@ typedef enum OutputFormat_
OUTPUT_WINDOWS_DEF, /* output a Windows .DEF file for Visual C++ or Mingw */
OUTPUT_BORLAND_DEF, /* output a Windows .DEF file for Borland C++ */
OUTPUT_WATCOM_LBC, /* output a Watcom Linker Command File */
+ OUTPUT_VMS_OPT, /* output an OpenVMS Linker Option File */
OUTPUT_NETWARE_IMP, /* output a NetWare ImportFile */
OUTPUT_GNU_VERMAP /* output a version map for GNU or Solaris linker */
@@ -167,7 +168,6 @@ names_dump( FILE* out,
case OUTPUT_WATCOM_LBC:
{
const char* dot;
- char temp[512];
if ( !dll_name )
@@ -181,7 +181,8 @@ names_dump( FILE* out,
dot = strchr( dll_name, '.' );
if ( dot )
{
- int len = dot - dll_name;
+ char temp[512];
+ int len = dot - dll_name;
if ( len > (int)( sizeof ( temp ) - 1 ) )
@@ -200,6 +201,16 @@ names_dump( FILE* out,
break;
+ case OUTPUT_VMS_OPT:
+ fprintf( out, "GSMATCH=LEQUAL,2,0\n"
+ "CASE_SENSITIVE=YES\n"
+ "SYMBOL_VECTOR=(-\n" );
+ for ( nn = 0; nn < num_names - 1; nn++ )
+ fprintf( out, " %s=PROCEDURE,-\n", the_names[nn].name );
+ fprintf( out, " %s=PROCEDURE)\n", the_names[num_names - 1].name );
+
+ break;
+
case OUTPUT_NETWARE_IMP:
if ( dll_name )
fprintf( out, " (%s)\n", dll_name );
@@ -352,6 +363,7 @@ usage( void )
" -w output .DEF file for Visual C++ and Mingw\n"
" -wB output .DEF file for Borland C++\n"
" -wW output Watcom Linker Response File\n"
+ " -wV output OpenVMS Linker Options File\n"
" -wN output NetWare Import File\n"
" -wL output version map for GNU or Solaris linker\n"
"\n";
@@ -445,6 +457,10 @@ main( int argc,
format = OUTPUT_WATCOM_LBC;
break;
+ case 'V':
+ format = OUTPUT_VMS_OPT;
+ break;
+
case 'N':
format = OUTPUT_NETWARE_IMP;
break;
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c
index eaa14aad8d6..6fcfdb23e48 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttdriver.c
@@ -354,7 +354,16 @@
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
- FT_Request_Metrics( size->face, req );
+ {
+ FT_Error err = FT_Request_Metrics( size->face, req );
+
+
+ if ( err )
+ {
+ error = err;
+ goto Exit;
+ }
+ }
if ( FT_IS_SCALABLE( size->face ) )
{
@@ -382,6 +391,7 @@
#endif
}
+ Exit:
return error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c
index b490b84b5e2..11968f6fdcf 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgload.c
@@ -1392,7 +1392,7 @@
FT_READ_USHORT( n_ins ) )
return error;
- FT_TRACE5(( " Instructions size = %d\n", n_ins ));
+ FT_TRACE5(( " Instructions size = %hu\n", n_ins ));
/* check it */
max_ins = loader->face->max_profile.maxSizeOfInstructions;
@@ -1400,10 +1400,10 @@
{
/* don't trust `maxSizeOfInstructions'; */
/* only do a rough safety check */
- if ( (FT_Int)n_ins > loader->byte_len )
+ if ( n_ins > loader->byte_len )
{
FT_TRACE1(( "TT_Process_Composite_Glyph:"
- " too many instructions (%d) for glyph with length %d\n",
+ " too many instructions (%hu) for glyph with length %u\n",
n_ins, loader->byte_len ));
return FT_THROW( Too_Many_Hints );
}
@@ -1686,7 +1686,7 @@
FT_ZERO( &inc_stream );
FT_Stream_OpenMemory( &inc_stream,
glyph_data.pointer,
- (FT_ULong)glyph_data.length );
+ glyph_data.length );
loader->stream = &inc_stream;
}
@@ -1694,8 +1694,7 @@
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- offset = tt_face_get_location( face, glyph_index,
- (FT_UInt*)&loader->byte_len );
+ offset = tt_face_get_location( face, glyph_index, &loader->byte_len );
if ( loader->byte_len > 0 )
{
@@ -1714,7 +1713,7 @@
error = face->access_glyph_frame( loader, glyph_index,
face->glyf_offset + offset,
- (FT_UInt)loader->byte_len );
+ loader->byte_len );
if ( error )
goto Exit;
@@ -1849,7 +1848,7 @@
/* (which consists of 10 bytes) */
error = face->access_glyph_frame( loader, glyph_index,
face->glyf_offset + offset + 10,
- (FT_UInt)loader->byte_len - 10 );
+ loader->byte_len - 10 );
if ( error )
goto Exit;
@@ -1903,7 +1902,7 @@
/* clear the nodes filled by sibling chains */
node = ft_list_get_node_at( &loader->composites, recurse_count );
for ( node2 = node; node2; node2 = node2->next )
- node2->data = (void*)FT_ULONG_MAX;
+ node2->data = (void*)-1;
/* check whether we already have a composite glyph with this index */
if ( FT_List_Find( &loader->composites,
@@ -1920,7 +1919,7 @@
else
{
- if ( FT_NEW( node ) )
+ if ( FT_QNEW( node ) )
goto Exit;
node->data = FT_UINT_TO_POINTER( glyph_index );
FT_List_Add( &loader->composites, node );
@@ -2105,7 +2104,7 @@
FT_UInt num_base_subgs = gloader->base.num_subglyphs;
FT_Stream old_stream = loader->stream;
- FT_Int old_byte_len = loader->byte_len;
+ FT_UInt old_byte_len = loader->byte_len;
FT_GlyphLoader_Add( gloader );
@@ -2718,6 +2717,9 @@
error = tt_size_run_prep( size, pedantic );
if ( error )
return error;
+ error = TT_Load_Context( exec, face, size );
+ if ( error )
+ return error;
}
/* check whether the cvt program has disabled hinting */
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c
index aad3e2929aa..7f2db0cbdc0 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.c
@@ -178,7 +178,7 @@
/* in the nested loops below we increase `i' twice; */
/* it is faster to simply allocate one more slot */
/* than to add another test within the loop */
- if ( FT_NEW_ARRAY( points, n + 1 ) )
+ if ( FT_QNEW_ARRAY( points, n + 1 ) )
return NULL;
*point_cnt = n;
@@ -264,55 +264,80 @@
FT_Fixed *deltas = NULL;
FT_UInt runcnt, cnt;
FT_UInt i, j;
+ FT_UInt bytes_used;
FT_Memory memory = stream->memory;
FT_Error error = FT_Err_Ok;
FT_UNUSED( error );
- if ( delta_cnt > size )
- {
- FT_TRACE1(( "ft_var_readpackeddeltas: number of points too large\n" ));
+ if ( FT_QNEW_ARRAY( deltas, delta_cnt ) )
return NULL;
- }
- if ( FT_NEW_ARRAY( deltas, delta_cnt ) )
- return NULL;
+ i = 0;
+ bytes_used = 0;
- i = 0;
- while ( i < delta_cnt )
+ while ( i < delta_cnt && bytes_used < size )
{
runcnt = FT_GET_BYTE();
cnt = runcnt & GX_DT_DELTA_RUN_COUNT_MASK;
+ bytes_used++;
+
if ( runcnt & GX_DT_DELTAS_ARE_ZERO )
{
- /* `runcnt' zeroes get added */
+ /* `cnt` + 1 zeroes get added */
for ( j = 0; j <= cnt && i < delta_cnt; j++ )
deltas[i++] = 0;
}
else if ( runcnt & GX_DT_DELTAS_ARE_WORDS )
{
- /* `runcnt' shorts from the stack */
+ /* `cnt` + 1 shorts from the stack */
+ bytes_used += 2 * ( cnt + 1 );
+ if ( bytes_used > size )
+ {
+ FT_TRACE1(( "ft_var_readpackeddeltas:"
+ " number of short deltas too large\n" ));
+ goto Fail;
+ }
+
for ( j = 0; j <= cnt && i < delta_cnt; j++ )
deltas[i++] = FT_intToFixed( FT_GET_SHORT() );
}
else
{
- /* `runcnt' signed bytes from the stack */
+ /* `cnt` + 1 signed bytes from the stack */
+ bytes_used += cnt + 1;
+ if ( bytes_used > size )
+ {
+ FT_TRACE1(( "ft_var_readpackeddeltas:"
+ " number of byte deltas too large\n" ));
+ goto Fail;
+ }
+
for ( j = 0; j <= cnt && i < delta_cnt; j++ )
deltas[i++] = FT_intToFixed( FT_GET_CHAR() );
}
if ( j <= cnt )
{
- /* bad format */
- FT_FREE( deltas );
- return NULL;
+ FT_TRACE1(( "ft_var_readpackeddeltas:"
+ " number of deltas too large\n" ));
+ goto Fail;
}
}
+ if ( i < delta_cnt )
+ {
+ FT_TRACE1(( "ft_var_readpackeddeltas: not enough deltas\n" ));
+ goto Fail;
+ }
+
return deltas;
+
+ Fail:
+ FT_FREE( deltas );
+ return NULL;
}
@@ -377,7 +402,7 @@
goto Exit;
}
- if ( FT_NEW_ARRAY( blend->avar_segment, axisCount ) )
+ if ( FT_QNEW_ARRAY( blend->avar_segment, axisCount ) )
goto Exit;
segment = &blend->avar_segment[0];
@@ -386,8 +411,8 @@
FT_TRACE5(( " axis %d:\n", i ));
segment->pairCount = FT_GET_USHORT();
- if ( (FT_ULong)segment->pairCount * 4 > table_len ||
- FT_NEW_ARRAY( segment->correspondence, segment->pairCount ) )
+ if ( (FT_ULong)segment->pairCount * 4 > table_len ||
+ FT_QNEW_ARRAY( segment->correspondence, segment->pairCount ) )
{
/* Failure. Free everything we have done so far. We must do */
/* it right now since loading the `avar' table is optional. */
@@ -432,7 +457,8 @@
FT_UShort format;
FT_ULong region_offset;
FT_UInt i, j, k;
- FT_UInt shortDeltaCount;
+ FT_UInt wordDeltaCount;
+ FT_Bool long_words;
GX_Blend blend = face->blend;
GX_ItemVarData varData;
@@ -467,7 +493,7 @@
/* make temporary copy of item variation data offsets; */
/* we will parse region list first, then come back */
- if ( FT_NEW_ARRAY( dataOffsetArray, itemStore->dataCount ) )
+ if ( FT_QNEW_ARRAY( dataOffsetArray, itemStore->dataCount ) )
goto Exit;
for ( i = 0; i < itemStore->dataCount; i++ )
@@ -547,15 +573,18 @@
goto Exit;
if ( FT_READ_USHORT( varData->itemCount ) ||
- FT_READ_USHORT( shortDeltaCount ) ||
+ FT_READ_USHORT( wordDeltaCount ) ||
FT_READ_USHORT( varData->regionIdxCount ) )
goto Exit;
+ long_words = !!( wordDeltaCount & 0x8000 );
+ wordDeltaCount &= 0x7FFF;
+
/* check some data consistency */
- if ( shortDeltaCount > varData->regionIdxCount )
+ if ( wordDeltaCount > varData->regionIdxCount )
{
FT_TRACE2(( "bad short count %d or region count %d\n",
- shortDeltaCount,
+ wordDeltaCount,
varData->regionIdxCount ));
error = FT_THROW( Invalid_Table );
goto Exit;
@@ -591,39 +620,52 @@
/* Parse delta set. */
/* */
- /* On input, deltas are (shortDeltaCount + regionIdxCount) bytes */
- /* each; on output, deltas are expanded to `regionIdxCount' shorts */
- /* each. */
+ /* On input, deltas are (wordDeltaCount + regionIdxCount) bytes */
+ /* each if `long_words` isn't set, and twice as much otherwise. */
+ /* */
+ /* On output, deltas are expanded to `regionIdxCount` shorts each. */
if ( FT_NEW_ARRAY( varData->deltaSet,
varData->regionIdxCount * varData->itemCount ) )
goto Exit;
- /* the delta set is stored as a 2-dimensional array of shorts; */
- /* sign-extend signed bytes to signed shorts */
- for ( j = 0; j < varData->itemCount * varData->regionIdxCount; )
+ /* the delta set is stored as a 2-dimensional array of shorts */
+ if ( long_words )
+ {
+ /* new in OpenType 1.9, currently for 'COLR' table only; */
+ /* the deltas are interpreted as 16.16 fixed-point scaling values */
+
+ /* not supported yet */
+
+ error = FT_THROW( Invalid_Table );
+ goto Exit;
+ }
+ else
{
- for ( k = 0; k < shortDeltaCount; k++, j++ )
+ for ( j = 0; j < varData->itemCount * varData->regionIdxCount; )
{
- /* read the short deltas */
- FT_Short delta;
+ for ( k = 0; k < wordDeltaCount; k++, j++ )
+ {
+ /* read the short deltas */
+ FT_Short delta;
- if ( FT_READ_SHORT( delta ) )
- goto Exit;
+ if ( FT_READ_SHORT( delta ) )
+ goto Exit;
- varData->deltaSet[j] = delta;
- }
+ varData->deltaSet[j] = delta;
+ }
- for ( ; k < varData->regionIdxCount; k++, j++ )
- {
- /* read the (signed) byte deltas */
- FT_Char delta;
+ for ( ; k < varData->regionIdxCount; k++, j++ )
+ {
+ /* read the (signed) byte deltas */
+ FT_Char delta;
- if ( FT_READ_CHAR( delta ) )
- goto Exit;
+ if ( FT_READ_CHAR( delta ) )
+ goto Exit;
- varData->deltaSet[j] = delta;
+ varData->deltaSet[j] = delta;
+ }
}
}
}
@@ -639,37 +681,66 @@
ft_var_load_delta_set_index_mapping( TT_Face face,
FT_ULong offset,
GX_DeltaSetIdxMap map,
- GX_ItemVarStore itemStore )
+ GX_ItemVarStore itemStore,
+ FT_ULong table_len )
{
FT_Stream stream = FT_FACE_STREAM( face );
FT_Memory memory = stream->memory;
- FT_Error error;
+ FT_Error error;
- FT_UShort format;
- FT_UInt entrySize;
- FT_UInt innerBitCount;
- FT_UInt innerIndexMask;
- FT_UInt i, j;
+ FT_Byte format;
+ FT_Byte entryFormat;
+ FT_UInt entrySize;
+ FT_UInt innerBitCount;
+ FT_UInt innerIndexMask;
+ FT_ULong i;
+ FT_UInt j;
- if ( FT_STREAM_SEEK( offset ) ||
- FT_READ_USHORT( format ) ||
- FT_READ_USHORT( map->mapCount ) )
+ if ( FT_STREAM_SEEK( offset ) ||
+ FT_READ_BYTE( format ) ||
+ FT_READ_BYTE( entryFormat ) )
goto Exit;
- if ( format & 0xFFC0 )
+ if ( format == 0 )
+ {
+ if ( FT_READ_USHORT( map->mapCount ) )
+ goto Exit;
+ }
+ else if ( format == 1 ) /* new in OpenType 1.9 */
+ {
+ if ( FT_READ_ULONG( map->mapCount ) )
+ goto Exit;
+ }
+ else
{
FT_TRACE2(( "bad map format %d\n", format ));
error = FT_THROW( Invalid_Table );
goto Exit;
}
+ if ( entryFormat & 0xC0 )
+ {
+ FT_TRACE2(( "bad entry format %d\n", format ));
+ error = FT_THROW( Invalid_Table );
+ goto Exit;
+ }
+
/* bytes per entry: 1, 2, 3, or 4 */
- entrySize = ( ( format & 0x0030 ) >> 4 ) + 1;
- innerBitCount = ( format & 0x000F ) + 1;
+ entrySize = ( ( entryFormat & 0x30 ) >> 4 ) + 1;
+ innerBitCount = ( entryFormat & 0x0F ) + 1;
innerIndexMask = ( 1 << innerBitCount ) - 1;
+ /* rough sanity check */
+ if ( map->mapCount * entrySize > table_len )
+ {
+ FT_TRACE1(( "ft_var_load_delta_set_index_mapping:"
+ " invalid number of delta-set index mappings\n" ));
+ error = FT_THROW( Invalid_Table );
+ goto Exit;
+ }
+
if ( FT_NEW_ARRAY( map->innerIndex, map->mapCount ) )
goto Exit;
@@ -698,7 +769,7 @@
if ( outerIndex >= itemStore->dataCount )
{
- FT_TRACE2(( "outerIndex[%d] == %d out of range\n",
+ FT_TRACE2(( "outerIndex[%ld] == %d out of range\n",
i,
outerIndex ));
error = FT_THROW( Invalid_Table );
@@ -711,7 +782,7 @@
if ( innerIndex >= itemStore->varData[outerIndex].itemCount )
{
- FT_TRACE2(( "innerIndex[%d] == %d out of range\n",
+ FT_TRACE2(( "innerIndex[%ld] == %d out of range\n",
i,
innerIndex ));
error = FT_THROW( Invalid_Table );
@@ -836,7 +907,8 @@
face,
table_offset + widthMap_offset,
&table->widthMap,
- &table->itemStore );
+ &table->itemStore,
+ table_len );
if ( error )
goto Exit;
}
@@ -1569,7 +1641,7 @@
goto Exit;
/* offsets (one more offset than glyphs, to mark size of last) */
- if ( FT_NEW_ARRAY( blend->glyphoffsets, gvar_head.glyphCount + 1 ) )
+ if ( FT_QNEW_ARRAY( blend->glyphoffsets, gvar_head.glyphCount + 1 ) )
goto Fail2;
if ( gvar_head.flags & 1 )
@@ -1648,8 +1720,8 @@
goto Fail;
}
- if ( FT_NEW_ARRAY( blend->tuplecoords,
- gvar_head.axisCount * gvar_head.globalCoordCount ) )
+ if ( FT_QNEW_ARRAY( blend->tuplecoords,
+ gvar_head.axisCount * gvar_head.globalCoordCount ) )
goto Fail2;
for ( i = 0; i < gvar_head.globalCoordCount; i++ )
@@ -1858,19 +1930,16 @@
" clamping\n",
a->minimum / 65536.0,
a->maximum / 65536.0 ));
-
- if ( coord > a->maximum )
- coord = a->maximum;
- else
- coord = a->minimum;
}
- if ( coord < a->def )
- normalized[i] = -FT_DivFix( SUB_LONG( coord, a->def ),
- SUB_LONG( a->minimum, a->def ) );
- else if ( coord > a->def )
- normalized[i] = FT_DivFix( SUB_LONG( coord, a->def ),
+ if ( coord > a->def )
+ normalized[i] = coord >= a->maximum ? 0x10000L :
+ FT_DivFix( SUB_LONG( coord, a->def ),
SUB_LONG( a->maximum, a->def ) );
+ else if ( coord < a->def )
+ normalized[i] = coord <= a->minimum ? -0x10000L :
+ FT_DivFix( SUB_LONG( coord, a->def ),
+ SUB_LONG( a->def, a->minimum ) );
else
normalized[i] = 0;
}
@@ -3164,6 +3233,8 @@
/*************************************************************************/
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
static FT_Error
tt_cvt_ready_iterator( FT_ListNode node,
void* user )
@@ -3178,6 +3249,9 @@
return FT_Err_Ok;
}
+#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+
/**************************************************************************
*
@@ -3206,6 +3280,8 @@
tt_face_vary_cvt( TT_Face face,
FT_Stream stream )
{
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
FT_Error error;
FT_Memory memory = stream->memory;
@@ -3409,9 +3485,7 @@
point_count == 0 ? face->cvt_size
: point_count );
- if ( !points ||
- !deltas ||
- ( localpoints == ALL_POINTS && point_count != face->cvt_size ) )
+ if ( !points || !deltas )
; /* failure, ignore it */
else if ( localpoints == ALL_POINTS )
@@ -3526,6 +3600,16 @@
NULL );
return error;
+
+#else /* !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
+ FT_UNUSED( face );
+ FT_UNUSED( stream );
+
+ return FT_Err_Ok;
+
+#endif /* !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h
index c587319510d..ded9ea1d6df 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttgxvar.h
@@ -106,9 +106,9 @@ FT_BEGIN_HEADER
typedef struct GX_DeltaSetIdxMapRec_
{
- FT_UInt mapCount;
- FT_UInt* outerIndex; /* indices to item var data */
- FT_UInt* innerIndex; /* indices to delta set */
+ FT_ULong mapCount;
+ FT_UInt* outerIndex; /* indices to item var data */
+ FT_UInt* innerIndex; /* indices to delta set */
} GX_DeltaSetIdxMapRec, *GX_DeltaSetIdxMap;
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c
index 96b48a00336..731095ed0cb 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.c
@@ -278,64 +278,6 @@
/**************************************************************************
*
* @Function:
- * Init_Context
- *
- * @Description:
- * Initializes a context object.
- *
- * @Input:
- * memory ::
- * A handle to the parent memory object.
- *
- * @InOut:
- * exec ::
- * A handle to the target execution context.
- *
- * @Return:
- * FreeType error code. 0 means success.
- */
- static FT_Error
- Init_Context( TT_ExecContext exec,
- FT_Memory memory )
- {
- FT_Error error;
-
-
- FT_TRACE1(( "Init_Context: new object at %p\n", (void *)exec ));
-
- exec->memory = memory;
- exec->callSize = 32;
-
- if ( FT_QNEW_ARRAY( exec->callStack, exec->callSize ) )
- goto Fail_Memory;
-
- /* all values in the context are set to 0 already, but this is */
- /* here as a remainder */
- exec->maxPoints = 0;
- exec->maxContours = 0;
-
- exec->stackSize = 0;
- exec->glyphSize = 0;
-
- exec->stack = NULL;
- exec->glyphIns = NULL;
-
- exec->face = NULL;
- exec->size = NULL;
-
- return FT_Err_Ok;
-
- Fail_Memory:
- FT_ERROR(( "Init_Context: not enough memory for %p\n", (void *)exec ));
- TT_Done_Context( exec );
-
- return error;
- }
-
-
- /**************************************************************************
- *
- * @Function:
* Update_Max
*
* @Description:
@@ -375,7 +317,7 @@
if ( *size < new_max )
{
- if ( FT_REALLOC( *pbuff, *size * multiplier, new_max * multiplier ) )
+ if ( FT_QREALLOC( *pbuff, *size * multiplier, new_max * multiplier ) )
return error;
*size = new_max;
}
@@ -408,6 +350,8 @@
*
* @Note:
* Only the glyph loader and debugger should call this function.
+ *
+ * Note that not all members of `TT_ExecContext` get initialized.
*/
FT_LOCAL_DEF( FT_Error )
TT_Load_Context( TT_ExecContext exec,
@@ -617,19 +561,19 @@
memory = driver->root.root.memory;
- /* allocate object */
+ /* allocate object and zero everything inside */
if ( FT_NEW( exec ) )
goto Fail;
- /* initialize it; in case of error this deallocates `exec' too */
- error = Init_Context( exec, memory );
- if ( error )
- goto Fail;
+ /* create callStack here, other allocations delayed */
+ exec->memory = memory;
+ exec->callSize = 32;
- return exec;
+ if ( FT_QNEW_ARRAY( exec->callStack, exec->callSize ) )
+ FT_FREE( exec );
Fail:
- return NULL;
+ return exec;
}
@@ -5059,9 +5003,9 @@
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/* Disable Type 2 Vacuform Rounds - e.g. Arial Narrow */
- if ( SUBPIXEL_HINTING_INFINALITY &&
- exc->ignore_x_mode &&
- FT_ABS( D ) == 64 )
+ if ( SUBPIXEL_HINTING_INFINALITY &&
+ exc->ignore_x_mode &&
+ ( D < 0 ? NEG_LONG( D ) : D ) == 64 )
D += 1;
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h b/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h
index a7578f829bc..9c01ec83cbc 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttinterp.h
@@ -144,36 +144,39 @@ FT_BEGIN_HEADER
*
* The main structure for the interpreter which collects all necessary
* variables and states.
+ *
+ * Members that are initialized by `TT_Load_Context` are marked with '!'.
+ * Members that are initialized by `TT_Run_Context` are marked with '@'.
*/
typedef struct TT_ExecContextRec_
{
- TT_Face face;
- TT_Size size;
+ TT_Face face; /* ! */
+ TT_Size size; /* ! */
FT_Memory memory;
/* instructions state */
FT_Error error; /* last execution error */
- FT_Long top; /* top of exec. stack */
+ FT_Long top; /* @ top of exec. stack */
- FT_Long stackSize; /* size of exec. stack */
- FT_Long* stack; /* current exec. stack */
+ FT_Long stackSize; /* ! size of exec. stack */
+ FT_Long* stack; /* ! current exec. stack */
FT_Long args;
- FT_Long new_top; /* new top after exec. */
+ FT_Long new_top; /* new top after exec. */
- TT_GlyphZoneRec zp0, /* zone records */
- zp1,
- zp2,
- pts,
- twilight;
+ TT_GlyphZoneRec zp0, /* @! zone records */
+ zp1, /* @! */
+ zp2, /* @! */
+ pts, /* ! */
+ twilight; /* ! */
- FT_Long pointSize; /* in 26.6 format */
- FT_Size_Metrics metrics;
- TT_Size_Metrics tt_metrics; /* size metrics */
+ FT_Long pointSize; /* ! in 26.6 format */
+ FT_Size_Metrics metrics; /* ! */
+ TT_Size_Metrics tt_metrics; /* ! size metrics */
- TT_GraphicsState GS; /* current graphics state */
+ TT_GraphicsState GS; /* !@ current graphics state */
FT_Int iniRange; /* initial code range number */
FT_Int curRange; /* current code range number */
@@ -186,39 +189,39 @@ FT_BEGIN_HEADER
FT_Bool step_ins; /* true if the interpreter must */
/* increment IP after ins. exec */
- FT_ULong cvtSize;
- FT_Long* cvt;
+ FT_ULong cvtSize; /* ! */
+ FT_Long* cvt; /* ! */
FT_ULong glyfCvtSize;
FT_Long* glyfCvt; /* cvt working copy for glyph */
FT_Long* origCvt;
- FT_UInt glyphSize; /* glyph instructions buffer size */
- FT_Byte* glyphIns; /* glyph instructions buffer */
+ FT_UInt glyphSize; /* ! glyph instructions buffer size */
+ FT_Byte* glyphIns; /* ! glyph instructions buffer */
- FT_UInt numFDefs; /* number of function defs */
- FT_UInt maxFDefs; /* maximum number of function defs */
- TT_DefArray FDefs; /* table of FDefs entries */
+ FT_UInt numFDefs; /* ! number of function defs */
+ FT_UInt maxFDefs; /* ! maximum number of function defs */
+ TT_DefArray FDefs; /* table of FDefs entries */
- FT_UInt numIDefs; /* number of instruction defs */
- FT_UInt maxIDefs; /* maximum number of ins defs */
- TT_DefArray IDefs; /* table of IDefs entries */
+ FT_UInt numIDefs; /* ! number of instruction defs */
+ FT_UInt maxIDefs; /* ! maximum number of ins defs */
+ TT_DefArray IDefs; /* table of IDefs entries */
- FT_UInt maxFunc; /* maximum function index */
- FT_UInt maxIns; /* maximum instruction index */
+ FT_UInt maxFunc; /* ! maximum function index */
+ FT_UInt maxIns; /* ! maximum instruction index */
- FT_Int callTop, /* top of call stack during execution */
- callSize; /* size of call stack */
- TT_CallStack callStack; /* call stack */
+ FT_Int callTop, /* @ top of call stack during execution */
+ callSize; /* size of call stack */
+ TT_CallStack callStack; /* call stack */
FT_UShort maxPoints; /* capacity of this context's `pts' */
FT_Short maxContours; /* record, expressed in points and */
/* contours. */
- TT_CodeRangeTable codeRangeTable; /* table of valid code ranges */
- /* useful for the debugger */
+ TT_CodeRangeTable codeRangeTable; /* ! table of valid code ranges */
+ /* useful for the debugger */
- FT_UShort storeSize; /* size of current storage */
- FT_Long* storage; /* storage area */
+ FT_UShort storeSize; /* ! size of current storage */
+ FT_Long* storage; /* ! storage area */
FT_UShort glyfStoreSize;
FT_Long* glyfStorage; /* storage working copy for glyph */
FT_Long* origStorage;
@@ -227,8 +230,8 @@ FT_BEGIN_HEADER
FT_F26Dot6 phase; /* `SuperRounding' */
FT_F26Dot6 threshold;
- FT_Bool instruction_trap; /* If `True', the interpreter will */
- /* exit after each instruction */
+ FT_Bool instruction_trap; /* ! If `True', the interpreter */
+ /* exits after each instruction */
TT_GraphicsState default_GS; /* graphics state resulting from */
/* the prep program */
@@ -245,7 +248,7 @@ FT_BEGIN_HEADER
func_dualproj, /* current dual proj. function */
func_freeProj; /* current freedom proj. func */
- TT_Move_Func func_move; /* current point move function */
+ TT_Move_Func func_move; /* current point move function */
TT_Move_Func func_move_orig; /* move original position function */
TT_Cur_Ppem_Func func_cur_ppem; /* get current proj. ppem value */
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c
index 92eff4dffe7..93fc5484473 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttobjs.c
@@ -140,7 +140,31 @@
return error;
}
-#endif /* TT_USE_BYTECODE_INTERPRETER */
+
+
+ /*
+ * Fonts embedded in PDFs are made unique by prepending randomization
+ * prefixes to their names: as defined in Section 5.5.3, 'Font Subsets',
+ * of the PDF Reference, they consist of 6 uppercase letters followed by
+ * the `+` sign. For safety, we do not skip prefixes violating this rule.
+ */
+
+ static const FT_String*
+ tt_skip_pdffont_random_tag( const FT_String* name )
+ {
+ unsigned int i;
+
+
+ if ( ft_strlen( name ) < 8 || name[6] != '+' )
+ return name;
+
+ for ( i = 0; i < 6; i++ )
+ if ( !ft_isupper( name[i] ) )
+ return name;
+
+ FT_TRACE7(( "name without randomization tag: %s\n", name + 7 ));
+ return name + 7;
+ }
/* Compare the face with a list of well-known `tricky' fonts. */
@@ -151,7 +175,7 @@
{
#define TRICK_NAMES_MAX_CHARACTERS 19
-#define TRICK_NAMES_COUNT 26
+#define TRICK_NAMES_COUNT 20
static const char trick_names[TRICK_NAMES_COUNT]
[TRICK_NAMES_MAX_CHARACTERS + 1] =
@@ -171,22 +195,28 @@
"DFGirl-W6-WIN-BF", /* dftt-h6.ttf; version 1.00, 1993 */
"DFGothic-EB", /* DynaLab Inc. 1992-1995 */
"DFGyoSho-Lt", /* DynaLab Inc. 1992-1995 */
- "DFHei-Md-HK-BF", /* maybe DynaLab Inc. */
+ "DFHei", /* DynaLab Inc. 1992-1995 [DFHei-Bd-WIN-HK-BF] */
+ /* covers "DFHei-Md-HK-BF", maybe DynaLab Inc. */
+
"DFHSGothic-W5", /* DynaLab Inc. 1992-1995 */
"DFHSMincho-W3", /* DynaLab Inc. 1992-1995 */
"DFHSMincho-W7", /* DynaLab Inc. 1992-1995 */
"DFKaiSho-SB", /* dfkaisb.ttf */
- "DFKaiShu",
- "DFKaiShu-Md-HK-BF", /* maybe DynaLab Inc. */
+ "DFKaiShu", /* covers "DFKaiShu-Md-HK-BF", maybe DynaLab Inc. */
"DFKai-SB", /* kaiu.ttf; version 3.00, 1998 [DFKaiShu-SB-Estd-BF] */
- "DFMing-Bd-HK-BF", /* maybe DynaLab Inc. */
+
+ "DFMing", /* DynaLab Inc. 1992-1995 [DFMing-Md-WIN-HK-BF] */
+ /* covers "DFMing-Bd-HK-BF", maybe DynaLab Inc. */
+
"DLC", /* dftt-m7.ttf; version 1.00, 1993 [DLCMingBold] */
/* dftt-f5.ttf; version 1.00, 1993 [DLCFongSung] */
- "DLCHayMedium", /* dftt-b5.ttf; version 1.00, 1993 */
- "DLCHayBold", /* dftt-b7.ttf; version 1.00, 1993 */
- "DLCKaiMedium", /* dftt-k5.ttf; version 1.00, 1992 */
- "DLCLiShu", /* dftt-l5.ttf; version 1.00, 1992 */
- "DLCRoundBold", /* dftt-r7.ttf; version 1.00, 1993 */
+ /* covers following */
+ /* "DLCHayMedium", dftt-b5.ttf; version 1.00, 1993 */
+ /* "DLCHayBold", dftt-b7.ttf; version 1.00, 1993 */
+ /* "DLCKaiMedium", dftt-k5.ttf; version 1.00, 1992 */
+ /* "DLCLiShu", dftt-l5.ttf; version 1.00, 1992 */
+ /* "DLCRoundBold", dftt-r7.ttf; version 1.00, 1993 */
+
"HuaTianKaiTi?", /* htkt2.ttf */
"HuaTianSongTi?", /* htst3.ttf */
"Ming(for ISO10646)", /* hkscsiic.ttf; version 0.12, 2007 [Ming] */
@@ -199,10 +229,12 @@
};
int nn;
+ const FT_String* name_without_tag;
+ name_without_tag = tt_skip_pdffont_random_tag( name );
for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ )
- if ( ft_strstr( name, trick_names[nn] ) )
+ if ( ft_strstr( name_without_tag, trick_names[nn] ) )
return TRUE;
return FALSE;
@@ -277,7 +309,7 @@
tt_check_trickyness_sfnt_ids( TT_Face face )
{
#define TRICK_SFNT_IDS_PER_FACE 3
-#define TRICK_SFNT_IDS_NUM_FACES 29
+#define TRICK_SFNT_IDS_NUM_FACES 31
static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES]
[TRICK_SFNT_IDS_PER_FACE] = {
@@ -430,6 +462,16 @@
{ 0x00170003UL, 0x00000060UL }, /* cvt */
{ 0xDBB4306EUL, 0x000058AAUL }, /* fpgm */
{ 0xD643482AUL, 0x00000035UL } /* prep */
+ },
+ { /* DFHei-Bd-WIN-HK-BF, issue #1087 */
+ { 0x1269EB58UL, 0x00000350UL }, /* cvt */
+ { 0x5CD5957AUL, 0x00006A4EUL }, /* fpgm */
+ { 0xF758323AUL, 0x00000380UL } /* prep */
+ },
+ { /* DFMing-Md-WIN-HK-BF, issue #1087 */
+ { 0x122FEB0BUL, 0x00000350UL }, /* cvt */
+ { 0x7F10919AUL, 0x000070A9UL }, /* fpgm */
+ { 0x7CD7E7B7UL, 0x0000025CUL } /* prep */
}
};
@@ -510,17 +552,27 @@
/* For first, check the face name for quick check. */
if ( face->family_name &&
tt_check_trickyness_family( face->family_name ) )
+ {
+ FT_TRACE3(( "found as a tricky font"
+ " by its family name: %s\n", face->family_name ));
return TRUE;
+ }
/* Type42 fonts may lack `name' tables, we thus try to identify */
/* tricky fonts by checking the checksums of Type42-persistent */
/* sfnt tables (`cvt', `fpgm', and `prep'). */
if ( tt_check_trickyness_sfnt_ids( (TT_Face)face ) )
+ {
+ FT_TRACE3(( "found as a tricky font"
+ " by its cvt/fpgm/prep table checksum\n" ));
return TRUE;
+ }
return FALSE;
}
+#endif /* TT_USE_BYTECODE_INTERPRETER */
+
/* Check whether `.notdef' is the only glyph in the `loca' table. */
static FT_Bool
@@ -666,8 +718,10 @@
if ( error )
goto Exit;
+#ifdef TT_USE_BYTECODE_INTERPRETER
if ( tt_check_trickyness( ttface ) )
ttface->face_flags |= FT_FACE_FLAG_TRICKY;
+#endif
error = tt_face_load_hdmx( face, stream );
if ( error )
@@ -1190,11 +1244,11 @@
/* rescale CVT when needed */
if ( size->cvt_ready < 0 )
{
- FT_UInt i;
+ FT_UShort i;
/* all twilight points are originally zero */
- for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )
+ for ( i = 0; i < size->twilight.n_points; i++ )
{
size->twilight.org[i].x = 0;
size->twilight.org[i].y = 0;
@@ -1203,7 +1257,7 @@
}
/* clear storage area */
- for ( i = 0; i < (FT_UInt)size->storage_size; i++ )
+ for ( i = 0; i < size->storage_size; i++ )
size->storage[i] = 0;
size->GS = tt_default_graphics_state;
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c
index 6c12c97bd7f..71db75ae1f5 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttpload.c
@@ -98,36 +98,23 @@
goto Exit;
}
- if ( face->header.Index_To_Loc_Format != 0 )
- {
- shift = 2;
+ shift = face->header.Index_To_Loc_Format != 0 ? 2 : 1;
- if ( table_len >= 0x40000L )
- {
- FT_TRACE2(( "table too large\n" ));
- table_len = 0x3FFFFL;
- }
- face->num_locations = table_len >> shift;
- }
- else
+ if ( table_len > 0x10000UL << shift )
{
- shift = 1;
-
- if ( table_len >= 0x20000L )
- {
- FT_TRACE2(( "table too large\n" ));
- table_len = 0x1FFFFL;
- }
- face->num_locations = table_len >> shift;
+ FT_TRACE2(( "table too large\n" ));
+ table_len = 0x10000UL << shift;
}
+ face->num_locations = table_len >> shift;
+
if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 )
{
FT_TRACE2(( "glyph count mismatch! loca: %ld, maxp: %ld\n",
face->num_locations - 1, face->root.num_glyphs ));
/* we only handle the case where `maxp' gives a larger value */
- if ( face->num_locations <= (FT_ULong)face->root.num_glyphs )
+ if ( face->num_locations < (FT_ULong)face->root.num_glyphs + 1 )
{
FT_ULong new_loca_len =
( (FT_ULong)face->root.num_glyphs + 1 ) << shift;
@@ -560,12 +547,6 @@
num_records = FT_NEXT_USHORT( p );
record_size = FT_NEXT_ULONG( p );
- /* The maximum number of bytes in an hdmx device record is the */
- /* maximum number of glyphs + 2; this is 0xFFFF + 2, thus */
- /* explaining why `record_size' is a long (which we read as */
- /* unsigned long for convenience). In practice, two bytes are */
- /* sufficient to hold the size value. */
- /* */
/* There are at least two fonts, HANNOM-A and HANNOM-B version */
/* 2.0 (2005), which get this wrong: The upper two bytes of */
/* the size value are set to 0xFF instead of 0x00. We catch */
@@ -574,19 +555,30 @@
if ( record_size >= 0xFFFF0000UL )
record_size &= 0xFFFFU;
+ FT_TRACE2(( "Hdmx " ));
+
/* The limit for `num_records' is a heuristic value. */
- if ( num_records > 255 ||
- ( num_records > 0 &&
- ( record_size > 0x10001L ||
- record_size < 4 ) ) )
+ if ( num_records > 255 || num_records == 0 )
{
- error = FT_THROW( Invalid_File_Format );
+ FT_TRACE2(( "with unreasonable %u records rejected\n", num_records ));
goto Fail;
}
- if ( FT_NEW_ARRAY( face->hdmx_record_sizes, num_records ) )
+ /* Out-of-spec tables are rejected. The record size must be */
+ /* equal to the number of glyphs + 2 + 32-bit padding. */
+ if ( (FT_Long)record_size != ( ( face->root.num_glyphs + 2 + 3 ) & ~3 ) )
+ {
+ FT_TRACE2(( "with record size off by %ld bytes rejected\n",
+ (FT_Long)record_size -
+ ( ( face->root.num_glyphs + 2 + 3 ) & ~3 ) ));
goto Fail;
+ }
+ if ( FT_QNEW_ARRAY( face->hdmx_record_sizes, num_records ) )
+ goto Fail;
+
+ /* XXX: We do not check if the records are sorted by ppem */
+ /* and cannot use binary search later. */
for ( nn = 0; nn < num_records; nn++ )
{
if ( p + record_size > limit )
@@ -600,6 +592,8 @@
face->hdmx_table_size = table_size;
face->hdmx_record_size = record_size;
+ FT_TRACE2(( "%ux%lu loaded\n", num_records, record_size ));
+
Exit:
return error;
diff --git a/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c b/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c
index e3b523e394b..c484665b957 100644
--- a/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c
+++ b/Build/source/libs/freetype2/freetype-src/src/truetype/ttsubpix.c
@@ -315,7 +315,7 @@
static const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules
[SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] =
{
- /* fix vwxyz thinness*/
+ /* fix vwxyz thinness */
{ "Consolas", 0, "", 0 },
/* Fix thin middle stems */
{ "Core MS Legacy Fonts", 0, "Regular", 0 },
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c
index 57ad39774f9..86649edf3a6 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1gload.c
@@ -79,7 +79,7 @@
/* For ordinary fonts get the character data stored in the face record. */
{
char_string->pointer = type1->charstrings[glyph_index];
- char_string->length = (FT_Int)type1->charstrings_len[glyph_index];
+ char_string->length = type1->charstrings_len[glyph_index];
}
if ( !error )
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1load.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1load.c
index 497c26aa7d8..bb62c79902a 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1load.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1load.c
@@ -117,6 +117,9 @@
goto Exit;
blend->num_default_design_vector = 0;
+ blend->weight_vector = NULL;
+ blend->default_weight_vector = NULL;
+ blend->design_pos[0] = NULL;
face->blend = blend;
}
@@ -130,14 +133,11 @@
/* allocate the blend `private' and `font_info' dictionaries */
- if ( FT_QNEW_ARRAY( blend->font_infos[1], num_designs ) ||
- FT_QNEW_ARRAY( blend->privates [1], num_designs ) ||
- FT_QNEW_ARRAY( blend->bboxes [1], num_designs ) ||
- FT_QNEW_ARRAY( blend->weight_vector, num_designs * 2 ) )
+ if ( FT_NEW_ARRAY( blend->font_infos[1], num_designs ) ||
+ FT_NEW_ARRAY( blend->privates [1], num_designs ) ||
+ FT_NEW_ARRAY( blend->bboxes [1], num_designs ) )
goto Exit;
- blend->default_weight_vector = blend->weight_vector + num_designs;
-
blend->font_infos[0] = &face->type1.font_info;
blend->privates [0] = &face->type1.private_dict;
blend->bboxes [0] = &face->type1.font_bbox;
@@ -164,21 +164,6 @@
blend->num_axis = num_axis;
}
- /* allocate the blend design pos table if needed */
- num_designs = blend->num_designs;
- num_axis = blend->num_axis;
- if ( num_designs && num_axis && blend->design_pos[0] == NULL )
- {
- FT_UInt n;
-
-
- if ( FT_QNEW_ARRAY( blend->design_pos[0], num_designs * num_axis ) )
- goto Exit;
-
- for ( n = 1; n < num_designs; n++ )
- blend->design_pos[n] = blend->design_pos[0] + num_axis * n;
- }
-
Exit:
return error;
@@ -580,7 +565,7 @@
{
FT_Error error;
PS_Blend blend = face->blend;
- FT_UInt n, p;
+ FT_UInt n;
FT_Fixed final_blends[T1_MAX_MM_DESIGNS];
@@ -599,7 +584,7 @@
PS_DesignMap map = blend->design_map + n;
FT_Long* designs = map->design_points;
FT_Fixed* blends = map->blend_points;
- FT_Int before = -1, after = -1;
+ FT_Int p, before = -1, after = -1;
/* use a default value if we don't have a coordinate */
@@ -608,7 +593,7 @@
else
design = ( designs[map->num_points - 1] - designs[0] ) / 2;
- for ( p = 0; p < (FT_UInt)map->num_points; p++ )
+ for ( p = 0; p < (FT_Int)map->num_points; p++ )
{
FT_Long p_design = designs[p];
@@ -622,11 +607,11 @@
if ( design < p_design )
{
- after = (FT_Int)p;
+ after = p;
break;
}
- before = (FT_Int)p;
+ before = p;
}
/* now interpolate if necessary */
@@ -872,12 +857,14 @@
{
T1_TokenRec design_tokens[T1_MAX_MM_DESIGNS];
FT_Int num_designs;
- FT_Int num_axis;
- T1_Parser parser = &loader->parser;
+ FT_Int num_axis = 0; /* make compiler happy */
+ T1_Parser parser = &loader->parser;
+ FT_Memory memory = face->root.memory;
+ FT_Error error = FT_Err_Ok;
+ FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];
- FT_Error error = FT_Err_Ok;
- PS_Blend blend;
+ design_pos[0] = NULL;
/* get the array of design tokens -- compute number of designs */
T1_ToTokenArray( parser, design_tokens,
@@ -899,12 +886,10 @@
{
FT_Byte* old_cursor = parser->root.cursor;
FT_Byte* old_limit = parser->root.limit;
- FT_Int n;
+ FT_Int n, nn;
+ PS_Blend blend;
- blend = face->blend;
- num_axis = 0; /* make compiler happy */
-
FT_TRACE4(( " [" ));
for ( n = 0; n < num_designs; n++ )
@@ -937,7 +922,13 @@
(FT_UInt)num_axis );
if ( error )
goto Exit;
- blend = face->blend;
+
+ /* allocate a blend design pos table */
+ if ( FT_QNEW_ARRAY( design_pos[0], num_designs * num_axis ) )
+ goto Exit;
+
+ for ( nn = 1; nn < num_designs; nn++ )
+ design_pos[nn] = design_pos[0] + num_axis * nn;
}
else if ( n_axis != num_axis )
{
@@ -955,8 +946,8 @@
parser->root.cursor = token2->start;
parser->root.limit = token2->limit;
- blend->design_pos[n][axis] = T1_ToFixed( parser, 0 );
- FT_TRACE4(( " %f", (double)blend->design_pos[n][axis] / 65536 ));
+ design_pos[n][axis] = T1_ToFixed( parser, 0 );
+ FT_TRACE4(( " %f", (double)design_pos[n][axis] / 65536 ));
}
FT_TRACE4(( "]" )) ;
}
@@ -965,9 +956,21 @@
loader->parser.root.cursor = old_cursor;
loader->parser.root.limit = old_limit;
+
+ /* a valid BlendDesignPosition has been parsed */
+ blend = face->blend;
+ if ( blend->design_pos[0] )
+ FT_FREE( blend->design_pos[0] );
+
+ for ( n = 0; n < num_designs; n++ )
+ {
+ blend->design_pos[n] = design_pos[n];
+ design_pos[n] = NULL;
+ }
}
Exit:
+ FT_FREE( design_pos[0] );
loader->parser.root.error = error;
}
@@ -1088,6 +1091,7 @@
T1_TokenRec design_tokens[T1_MAX_MM_DESIGNS];
FT_Int num_designs;
FT_Error error = FT_Err_Ok;
+ FT_Memory memory = face->root.memory;
T1_Parser parser = &loader->parser;
PS_Blend blend = face->blend;
T1_Token token;
@@ -1129,6 +1133,12 @@
goto Exit;
}
+ if ( !blend->weight_vector )
+ if ( FT_QNEW_ARRAY( blend->weight_vector, num_designs * 2 ) )
+ goto Exit;
+
+ blend->default_weight_vector = blend->weight_vector + num_designs;
+
old_cursor = parser->root.cursor;
old_limit = parser->root.limit;
@@ -2578,7 +2588,15 @@
( !face->blend->num_designs || !face->blend->num_axis ) )
T1_Done_Blend( face );
- /* another safety check */
+ /* the font may have no valid WeightVector */
+ if ( face->blend && !face->blend->weight_vector )
+ T1_Done_Blend( face );
+
+ /* the font may have no valid BlendDesignPositions */
+ if ( face->blend && !face->blend->design_pos[0] )
+ T1_Done_Blend( face );
+
+ /* the font may have no valid BlendDesignMap */
if ( face->blend )
{
FT_UInt i;
diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c
index ec202be2934..50dad038fd3 100644
--- a/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c
+++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1objs.c
@@ -116,11 +116,15 @@
T1_Size_Request( FT_Size t1size, /* T1_Size */
FT_Size_Request req )
{
+ FT_Error error;
+
T1_Size size = (T1_Size)t1size;
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
- FT_Request_Metrics( size->root.face, req );
+ error = FT_Request_Metrics( size->root.face, req );
+ if ( error )
+ goto Exit;
if ( funcs )
funcs->set_scale( (PSH_Globals)t1size->internal->module_data,
@@ -128,7 +132,8 @@
size->root.metrics.y_scale,
0, 0 );
- return FT_Err_Ok;
+ Exit:
+ return error;
}
diff --git a/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c b/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c
index d590c0a22b8..b4fabad2837 100644
--- a/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c
+++ b/Build/source/libs/freetype2/freetype-src/src/winfonts/winfnt.c
@@ -217,7 +217,11 @@
/* first of all, read the FNT header */
if ( FT_STREAM_SEEK( font->offset ) ||
FT_STREAM_READ_FIELDS( winfnt_header_fields, header ) )
+ {
+ FT_TRACE2(( " not a Windows FNT file\n" ));
+ error = FT_THROW( Unknown_File_Format );
goto Exit;
+ }
/* check header */
if ( header->version != 0x200 &&
@@ -284,7 +288,10 @@
/* does it begin with an MZ header? */
if ( FT_STREAM_SEEK( 0 ) ||
FT_STREAM_READ_FIELDS( winmz_header_fields, &mz_header ) )
+ {
+ error = FT_ERR( Unknown_File_Format );
goto Exit;
+ }
error = FT_ERR( Unknown_File_Format );
if ( mz_header.magic == WINFNT_MZ_MAGIC )
@@ -885,7 +892,7 @@
}
family_size = font->header.file_size - font->header.face_name_offset;
/* Some broken fonts don't delimit the face name with a final */
- /* NULL byte -- the frame is erroneously one byte too small. */
+ /* null byte -- the frame is erroneously one byte too small. */
/* We thus allocate one more byte, setting it explicitly to */
/* zero. */
if ( FT_QALLOC( font->family_name, family_size + 1 ) )
@@ -897,9 +904,10 @@
font->family_name[family_size] = '\0';
- if ( FT_REALLOC( font->family_name,
- family_size,
- ft_strlen( font->family_name ) + 1 ) )
+ /* shrink it to the actual length */
+ if ( FT_QREALLOC( font->family_name,
+ family_size + 1,
+ ft_strlen( font->family_name ) + 1 ) )
goto Fail;
root->family_name = font->family_name;