summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/pshinter
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/pshinter')
-rw-r--r--src/3rdparty/freetype/src/pshinter/Jamfile9
-rw-r--r--src/3rdparty/freetype/src/pshinter/module.mk2
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshalgo.c143
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshalgo.h49
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshglob.c12
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshglob.h2
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshinter.c2
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshmod.c2
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshmod.h2
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshnterr.h2
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshpic.c2
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshpic.h10
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshrec.c190
-rw-r--r--src/3rdparty/freetype/src/pshinter/pshrec.h10
-rw-r--r--src/3rdparty/freetype/src/pshinter/rules.mk7
15 files changed, 166 insertions, 278 deletions
diff --git a/src/3rdparty/freetype/src/pshinter/Jamfile b/src/3rdparty/freetype/src/pshinter/Jamfile
index 779f1b0b82..6fb3be11c7 100644
--- a/src/3rdparty/freetype/src/pshinter/Jamfile
+++ b/src/3rdparty/freetype/src/pshinter/Jamfile
@@ -1,6 +1,6 @@
# FreeType 2 src/pshinter Jamfile
#
-# Copyright 2001, 2003 by
+# Copyright 2001-2015 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -16,7 +16,12 @@ SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ;
if $(FT2_MULTI)
{
- _sources = pshrec pshglob pshalgo pshmod pshpic ;
+ _sources = pshalgo
+ pshglob
+ pshmod
+ pshpic
+ pshrec
+ ;
}
else
{
diff --git a/src/3rdparty/freetype/src/pshinter/module.mk b/src/3rdparty/freetype/src/pshinter/module.mk
index ed24eb7fa8..1fd8e55a33 100644
--- a/src/3rdparty/freetype/src/pshinter/module.mk
+++ b/src/3rdparty/freetype/src/pshinter/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2001, 2006 by
+# Copyright 1996-2015 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/3rdparty/freetype/src/pshinter/pshalgo.c b/src/3rdparty/freetype/src/pshinter/pshalgo.c
index 644c76d101..6e654cb1ef 100644
--- a/src/3rdparty/freetype/src/pshinter/pshalgo.c
+++ b/src/3rdparty/freetype/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (body). */
/* */
-/* Copyright 2001-2010, 2012-2014 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -30,16 +30,14 @@
#ifdef DEBUG_HINTER
- PSH_Hint_Table ps_debug_hint_table = 0;
- PSH_HintFunc ps_debug_hint_func = 0;
- PSH_Glyph ps_debug_glyph = 0;
+ PSH_Hint_Table ps_debug_hint_table = NULL;
+ PSH_HintFunc ps_debug_hint_func = NULL;
+ PSH_Glyph ps_debug_glyph = NULL;
#endif
#define COMPUTE_INFLEXS /* compute inflection points to optimize `S' */
/* and similar glyphs */
-#define STRONGER /* slightly increase the contrast of smooth */
- /* hinting */
/*************************************************************************/
@@ -67,13 +65,13 @@
{
FT_FREE( table->zones );
table->num_zones = 0;
- table->zone = 0;
+ table->zone = NULL;
FT_FREE( table->sort );
FT_FREE( table->hints );
table->num_hints = 0;
table->max_hints = 0;
- table->sort_global = 0;
+ table->sort_global = NULL;
}
@@ -121,7 +119,7 @@
PSH_Hint hint2;
- hint->parent = 0;
+ hint->parent = NULL;
for ( ; count > 0; count--, sorted++ )
{
hint2 = sorted[0];
@@ -194,7 +192,7 @@
table->sort_global = table->sort + count;
table->num_hints = 0;
table->num_zones = 0;
- table->zone = 0;
+ table->zone = NULL;
/* initialize the `table->hints' array */
{
@@ -890,9 +888,6 @@
/*************************************************************************/
/*************************************************************************/
-#define PSH_ZONE_MIN -3200000L
-#define PSH_ZONE_MAX +3200000L
-
#define xxDEBUG_ZONES
@@ -910,10 +905,6 @@
zone->max );
}
-#else
-
-#define psh_print_zone( x ) do { } while ( 0 )
-
#endif /* DEBUG_ZONES */
@@ -925,103 +916,9 @@
/*************************************************************************/
/*************************************************************************/
-#if 1
-
#define psh_corner_is_flat ft_corner_is_flat
#define psh_corner_orientation ft_corner_orientation
-#else
-
- FT_LOCAL_DEF( FT_Int )
- psh_corner_is_flat( FT_Pos x_in,
- FT_Pos y_in,
- FT_Pos x_out,
- FT_Pos y_out )
- {
- FT_Pos ax = x_in;
- FT_Pos ay = y_in;
-
- FT_Pos d_in, d_out, d_corner;
-
-
- if ( ax < 0 )
- ax = -ax;
- if ( ay < 0 )
- ay = -ay;
- d_in = ax + ay;
-
- ax = x_out;
- if ( ax < 0 )
- ax = -ax;
- ay = y_out;
- if ( ay < 0 )
- ay = -ay;
- d_out = ax + ay;
-
- ax = x_out + x_in;
- if ( ax < 0 )
- ax = -ax;
- ay = y_out + y_in;
- if ( ay < 0 )
- ay = -ay;
- d_corner = ax + ay;
-
- return ( d_in + d_out - d_corner ) < ( d_corner >> 4 );
- }
-
- static FT_Int
- psh_corner_orientation( FT_Pos in_x,
- FT_Pos in_y,
- FT_Pos out_x,
- FT_Pos out_y )
- {
- FT_Int result;
-
-
- /* deal with the trivial cases quickly */
- if ( in_y == 0 )
- {
- if ( in_x >= 0 )
- result = out_y;
- else
- result = -out_y;
- }
- else if ( in_x == 0 )
- {
- if ( in_y >= 0 )
- result = -out_x;
- else
- result = out_x;
- }
- else if ( out_y == 0 )
- {
- if ( out_x >= 0 )
- result = in_y;
- else
- result = -in_y;
- }
- else if ( out_x == 0 )
- {
- if ( out_y >= 0 )
- result = -in_x;
- else
- result = in_x;
- }
- else /* general case */
- {
- long long delta = (long long)in_x * out_y - (long long)in_y * out_x;
-
- if ( delta == 0 )
- result = 0;
- else
- result = 1 - 2 * ( delta < 0 );
- }
-
- return result;
- }
-
-#endif /* !1 */
-
#ifdef COMPUTE_INFLEXS
@@ -1149,7 +1046,7 @@
glyph->num_points = 0;
glyph->num_contours = 0;
- glyph->memory = 0;
+ glyph->memory = NULL;
}
@@ -1274,8 +1171,8 @@
FT_NEW_ARRAY( glyph->contours, outline->n_contours ) )
goto Exit;
- glyph->num_points = outline->n_points;
- glyph->num_contours = outline->n_contours;
+ glyph->num_points = (FT_UInt)outline->n_points;
+ glyph->num_contours = (FT_UInt)outline->n_contours;
{
FT_UInt first = 0, next, n;
@@ -1285,15 +1182,15 @@
for ( n = 0; n < glyph->num_contours; n++ )
{
- FT_Int count;
+ FT_UInt count;
PSH_Point point;
- next = outline->contours[n] + 1;
+ next = (FT_UInt)outline->contours[n] + 1;
count = next - first;
contour->start = points + first;
- contour->count = (FT_UInt)count;
+ contour->count = count;
if ( count > 0 )
{
@@ -1696,16 +1593,12 @@
mask++;
for ( ; num_masks > 1; num_masks--, mask++ )
{
- FT_UInt next;
- FT_Int count;
+ FT_UInt next = FT_MIN( mask->end_point, glyph->num_points );
- next = mask->end_point > glyph->num_points
- ? glyph->num_points
- : mask->end_point;
- count = next - first;
- if ( count > 0 )
+ if ( next > first )
{
+ FT_UInt count = next - first;
PSH_Point point = glyph->points + first;
@@ -2048,7 +1941,7 @@
/* count the number of strong points in this contour */
next = start + contour->count;
fit_count = 0;
- first = 0;
+ first = NULL;
for ( point = start; point < next; point++ )
if ( psh_point_is_fitted( point ) )
diff --git a/src/3rdparty/freetype/src/pshinter/pshalgo.h b/src/3rdparty/freetype/src/pshinter/pshalgo.h
index c70f31ea94..8373e5ec29 100644
--- a/src/3rdparty/freetype/src/pshinter/pshalgo.h
+++ b/src/3rdparty/freetype/src/pshinter/pshalgo.h
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm (specification). */
/* */
-/* Copyright 2001-2003, 2008, 2013 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -30,15 +30,12 @@ FT_BEGIN_HEADER
/* handle to Hint structure */
typedef struct PSH_HintRec_* PSH_Hint;
- /* hint bit-flags */
- typedef enum PSH_Hint_Flags_
- {
- PSH_HINT_GHOST = PS_HINT_FLAG_GHOST,
- PSH_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM,
- PSH_HINT_ACTIVE = 4,
- PSH_HINT_FITTED = 8
- } PSH_Hint_Flags;
+ /* hint bit-flags */
+#define PSH_HINT_GHOST PS_HINT_FLAG_GHOST
+#define PSH_HINT_BOTTOM PS_HINT_FLAG_BOTTOM
+#define PSH_HINT_ACTIVE 4U
+#define PSH_HINT_FITTED 8U
#define psh_hint_is_active( x ) ( ( (x)->flags & PSH_HINT_ACTIVE ) != 0 )
@@ -49,6 +46,7 @@ FT_BEGIN_HEADER
#define psh_hint_deactivate( x ) (x)->flags &= ~PSH_HINT_ACTIVE
#define psh_hint_set_fitted( x ) (x)->flags |= PSH_HINT_FITTED
+
/* hint structure */
typedef struct PSH_HintRec_
{
@@ -112,14 +110,12 @@ FT_BEGIN_HEADER
#define PSH_DIR_IS_VERTICAL( d ) PSH_DIR_COMPARE( d, PSH_DIR_VERTICAL )
- /* the following bit-flags are computed once by the glyph */
- /* analyzer, for both dimensions */
- enum
- {
- PSH_POINT_OFF = 1, /* point is off the curve */
- PSH_POINT_SMOOTH = 2, /* point is smooth */
- PSH_POINT_INFLEX = 4 /* point is inflection */
- };
+ /* the following bit-flags are computed once by the glyph */
+ /* analyzer, for both dimensions */
+#define PSH_POINT_OFF 1U /* point is off the curve */
+#define PSH_POINT_SMOOTH 2U /* point is smooth */
+#define PSH_POINT_INFLEX 4U /* point is inflection */
+
#define psh_point_is_smooth( p ) ( (p)->flags & PSH_POINT_SMOOTH )
#define psh_point_is_off( p ) ( (p)->flags & PSH_POINT_OFF )
@@ -129,17 +125,16 @@ FT_BEGIN_HEADER
#define psh_point_set_off( p ) (p)->flags |= PSH_POINT_OFF
#define psh_point_set_inflex( p ) (p)->flags |= PSH_POINT_INFLEX
+
/* the following bit-flags are re-computed for each dimension */
- enum
- {
- PSH_POINT_STRONG = 16, /* point is strong */
- PSH_POINT_FITTED = 32, /* point is already fitted */
- PSH_POINT_EXTREMUM = 64, /* point is local extremum */
- PSH_POINT_POSITIVE = 128, /* extremum has positive contour flow */
- PSH_POINT_NEGATIVE = 256, /* extremum has negative contour flow */
- PSH_POINT_EDGE_MIN = 512, /* point is aligned to left/bottom stem edge */
- PSH_POINT_EDGE_MAX = 1024 /* point is aligned to top/right stem edge */
- };
+#define PSH_POINT_STRONG 16U /* point is strong */
+#define PSH_POINT_FITTED 32U /* point is already fitted */
+#define PSH_POINT_EXTREMUM 64U /* point is local extremum */
+#define PSH_POINT_POSITIVE 128U /* extremum has positive contour flow */
+#define PSH_POINT_NEGATIVE 256U /* extremum has negative contour flow */
+#define PSH_POINT_EDGE_MIN 512U /* point is aligned to left/bottom stem edge */
+#define PSH_POINT_EDGE_MAX 1024U /* point is aligned to top/right stem edge */
+
#define psh_point_is_strong( p ) ( (p)->flags2 & PSH_POINT_STRONG )
#define psh_point_is_fitted( p ) ( (p)->flags2 & PSH_POINT_FITTED )
diff --git a/src/3rdparty/freetype/src/pshinter/pshglob.c b/src/3rdparty/freetype/src/pshinter/pshglob.c
index 1bcc481b9b..4616bdc6cf 100644
--- a/src/3rdparty/freetype/src/pshinter/pshglob.c
+++ b/src/3rdparty/freetype/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
/* PostScript hinter global hinting management (body). */
/* Inspired by the new auto-hinter module. */
/* */
-/* Copyright 2001-2004, 2006, 2010, 2012-2014 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@@ -23,7 +23,7 @@
#include "pshglob.h"
#ifdef DEBUG_HINTER
- PSH_Globals ps_debug_globals = 0;
+ PSH_Globals ps_debug_globals = NULL;
#endif
@@ -240,7 +240,7 @@
FT_Int family )
{
PSH_Blue_Table top_table, bot_table;
- FT_Int count_top, count_bot;
+ FT_UInt count_top, count_bot;
if ( family )
@@ -339,7 +339,7 @@
bot = zone[1].org_bottom;
delta = bot - top;
- if ( delta < 2 * fuzz )
+ if ( delta / 2 < fuzz )
zone[0].org_top = zone[1].org_bottom = top + delta / 2;
else
{
@@ -369,7 +369,7 @@
{
FT_UInt count;
FT_UInt num;
- PSH_Blue_Table table = 0;
+ PSH_Blue_Table table = NULL;
/* */
/* Determine whether we need to suppress overshoots or */
@@ -635,7 +635,7 @@
FT_FREE( globals );
#ifdef DEBUG_HINTER
- ps_debug_globals = 0;
+ ps_debug_globals = NULL;
#endif
}
}
diff --git a/src/3rdparty/freetype/src/pshinter/pshglob.h b/src/3rdparty/freetype/src/pshinter/pshglob.h
index 94d972a940..c376df7b9f 100644
--- a/src/3rdparty/freetype/src/pshinter/pshglob.h
+++ b/src/3rdparty/freetype/src/pshinter/pshglob.h
@@ -4,7 +4,7 @@
/* */
/* PostScript hinter global hinting management. */
/* */
-/* Copyright 2001, 2002, 2003, 2014 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/3rdparty/freetype/src/pshinter/pshinter.c b/src/3rdparty/freetype/src/pshinter/pshinter.c
index b35a2a91c5..9e65fe2a42 100644
--- a/src/3rdparty/freetype/src/pshinter/pshinter.c
+++ b/src/3rdparty/freetype/src/pshinter/pshinter.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PostScript Hinting module */
/* */
-/* Copyright 2001, 2003 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/3rdparty/freetype/src/pshinter/pshmod.c b/src/3rdparty/freetype/src/pshinter/pshmod.c
index cdeaca18c9..961b468506 100644
--- a/src/3rdparty/freetype/src/pshinter/pshmod.c
+++ b/src/3rdparty/freetype/src/pshinter/pshmod.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PostScript hinter module implementation (body). */
/* */
-/* Copyright 2001, 2002, 2007, 2009, 2012 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/3rdparty/freetype/src/pshinter/pshmod.h b/src/3rdparty/freetype/src/pshinter/pshmod.h
index 0ae7e96f54..a58d856533 100644
--- a/src/3rdparty/freetype/src/pshinter/pshmod.h
+++ b/src/3rdparty/freetype/src/pshinter/pshmod.h
@@ -4,7 +4,7 @@
/* */
/* PostScript hinter module interface (specification). */
/* */
-/* Copyright 2001 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/3rdparty/freetype/src/pshinter/pshnterr.h b/src/3rdparty/freetype/src/pshinter/pshnterr.h
index 7cc180f0ca..ce790a8ef5 100644
--- a/src/3rdparty/freetype/src/pshinter/pshnterr.h
+++ b/src/3rdparty/freetype/src/pshinter/pshnterr.h
@@ -4,7 +4,7 @@
/* */
/* PS Hinter error codes (specification only). */
/* */
-/* Copyright 2003, 2012 by */
+/* Copyright 2003-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/3rdparty/freetype/src/pshinter/pshpic.c b/src/3rdparty/freetype/src/pshinter/pshpic.c
index 568f4ac4b0..afd8fb9678 100644
--- a/src/3rdparty/freetype/src/pshinter/pshpic.c
+++ b/src/3rdparty/freetype/src/pshinter/pshpic.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for pshinter module. */
/* */
-/* Copyright 2009, 2010, 2012, 2013 by */
+/* Copyright 2009-2015 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/3rdparty/freetype/src/pshinter/pshpic.h b/src/3rdparty/freetype/src/pshinter/pshpic.h
index b46f853113..ca35cd6fa9 100644
--- a/src/3rdparty/freetype/src/pshinter/pshpic.h
+++ b/src/3rdparty/freetype/src/pshinter/pshpic.h
@@ -4,7 +4,7 @@
/* */
/* The FreeType position independent code services for pshinter module. */
/* */
-/* Copyright 2009, 2012, 2013 by */
+/* Copyright 2009-2015 by */
/* Oran Agra and Mickey Gabel. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,8 +20,6 @@
#define __PSHPIC_H__
-FT_BEGIN_HEADER
-
#include FT_INTERNAL_PIC_H
@@ -33,6 +31,8 @@ FT_BEGIN_HEADER
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+FT_BEGIN_HEADER
+
typedef struct PSHinterPIC_
{
PSHinter_Interface pshinter_interface;
@@ -51,12 +51,12 @@ FT_BEGIN_HEADER
FT_Error
pshinter_module_class_pic_init( FT_Library library );
+FT_END_HEADER
+
#endif /* FT_CONFIG_OPTION_PIC */
/* */
-FT_END_HEADER
-
#endif /* __PSHPIC_H__ */
diff --git a/src/3rdparty/freetype/src/pshinter/pshrec.c b/src/3rdparty/freetype/src/pshinter/pshrec.c
index 73a18ffd64..f8895fc8d6 100644
--- a/src/3rdparty/freetype/src/pshinter/pshrec.c
+++ b/src/3rdparty/freetype/src/pshinter/pshrec.c
@@ -4,7 +4,7 @@
/* */
/* FreeType PostScript hints recorder (body). */
/* */
-/* Copyright 2001-2004, 2007, 2009, 2013, 2014 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,7 +31,7 @@
#define FT_COMPONENT trace_pshrec
#ifdef DEBUG_HINTER
- PS_Hints ps_debug_hints = 0;
+ PS_Hints ps_debug_hints = NULL;
int ps_debug_no_horz_hints = 0;
int ps_debug_no_vert_hints = 0;
#endif
@@ -85,7 +85,7 @@
{
FT_Error error = FT_Err_Ok;
FT_UInt count;
- PS_Hint hint = 0;
+ PS_Hint hint = NULL;
count = table->num_hints;
@@ -167,12 +167,12 @@
/* clear a given bit */
static void
ps_mask_clear_bit( PS_Mask mask,
- FT_Int idx )
+ FT_UInt idx )
{
FT_Byte* p;
- if ( (FT_UInt)idx >= mask->num_bits )
+ if ( idx >= mask->num_bits )
return;
p = mask->bytes + ( idx >> 3 );
@@ -183,17 +183,14 @@
/* set a given bit, possibly grow the mask */
static FT_Error
ps_mask_set_bit( PS_Mask mask,
- FT_Int idx,
+ FT_UInt idx,
FT_Memory memory )
{
FT_Error error = FT_Err_Ok;
FT_Byte* p;
- if ( idx < 0 )
- goto Exit;
-
- if ( (FT_UInt)idx >= mask->num_bits )
+ if ( idx >= mask->num_bits )
{
error = ps_mask_ensure( mask, idx + 1, memory );
if ( error )
@@ -257,7 +254,7 @@
{
FT_UInt count;
FT_Error error = FT_Err_Ok;
- PS_Mask mask = 0;
+ PS_Mask mask = NULL;
count = table->num_masks;
@@ -372,8 +369,8 @@
/* test whether two masks in a table intersect */
static FT_Int
ps_mask_table_test_intersect( PS_Mask_Table table,
- FT_Int index1,
- FT_Int index2 )
+ FT_UInt index1,
+ FT_UInt index2 )
{
PS_Mask mask1 = table->masks + index1;
PS_Mask mask2 = table->masks + index2;
@@ -404,23 +401,25 @@
/* merge two masks, used by ps_mask_table_merge_all */
static FT_Error
ps_mask_table_merge( PS_Mask_Table table,
- FT_Int index1,
- FT_Int index2,
+ FT_UInt index1,
+ FT_UInt index2,
FT_Memory memory )
{
- FT_UInt temp;
FT_Error error = FT_Err_Ok;
/* swap index1 and index2 so that index1 < index2 */
if ( index1 > index2 )
{
+ FT_UInt temp;
+
+
temp = index1;
index1 = index2;
index2 = temp;
}
- if ( index1 < index2 && index1 >= 0 && index2 < (FT_Int)table->num_masks )
+ if ( index1 < index2 && index2 < table->num_masks )
{
/* we need to merge the bitsets of index1 and index2 with a */
/* simple union */
@@ -453,7 +452,7 @@
/* merge (unite) the bitsets */
read = mask2->bytes;
write = mask1->bytes;
- pos = (FT_UInt)( ( count2 + 7 ) >> 3 );
+ pos = ( count2 + 7 ) >> 3;
for ( ; pos > 0; pos-- )
{
@@ -468,14 +467,17 @@
mask2->num_bits = 0;
mask2->end_point = 0;
- delta = table->num_masks - 1 - index2; /* number of masks to move */
+ /* number of masks to move */
+ delta = (FT_Int)( table->num_masks - 1 - index2 );
if ( delta > 0 )
{
/* move to end of table for reuse */
PS_MaskRec dummy = *mask2;
- ft_memmove( mask2, mask2 + 1, delta * sizeof ( PS_MaskRec ) );
+ ft_memmove( mask2,
+ mask2 + 1,
+ (FT_UInt)delta * sizeof ( PS_MaskRec ) );
mask2[delta] = dummy;
}
@@ -502,13 +504,19 @@
FT_Error error = FT_Err_Ok;
- for ( index1 = table->num_masks - 1; index1 > 0; index1-- )
+ /* both loops go down to 0, thus FT_Int for index1 and index2 */
+ for ( index1 = (FT_Int)table->num_masks - 1; index1 > 0; index1-- )
{
for ( index2 = index1 - 1; index2 >= 0; index2-- )
{
- if ( ps_mask_table_test_intersect( table, index1, index2 ) )
+ if ( ps_mask_table_test_intersect( table,
+ (FT_UInt)index1,
+ (FT_UInt)index2 ) )
{
- error = ps_mask_table_merge( table, index2, index1, memory );
+ error = ps_mask_table_merge( table,
+ (FT_UInt)index2,
+ (FT_UInt)index1,
+ memory );
if ( error )
goto Exit;
@@ -670,8 +678,8 @@
{
PS_Mask mask;
FT_UInt idx;
- FT_UInt max = dim->hints.num_hints;
- PS_Hint hint = dim->hints.hints;
+ FT_UInt max = dim->hints.num_hints;
+ PS_Hint hint = dim->hints.hints;
for ( idx = 0; idx < max; idx++, hint++ )
@@ -742,17 +750,26 @@
}
/* now, set the bits for our hints in the counter mask */
- error = ps_mask_set_bit( counter, hint1, memory );
- if ( error )
- goto Exit;
+ if ( hint1 >= 0 )
+ {
+ error = ps_mask_set_bit( counter, (FT_UInt)hint1, memory );
+ if ( error )
+ goto Exit;
+ }
- error = ps_mask_set_bit( counter, hint2, memory );
- if ( error )
- goto Exit;
+ if ( hint2 >= 0 )
+ {
+ error = ps_mask_set_bit( counter, (FT_UInt)hint2, memory );
+ if ( error )
+ goto Exit;
+ }
- error = ps_mask_set_bit( counter, hint3, memory );
- if ( error )
- goto Exit;
+ if ( hint3 >= 0 )
+ {
+ error = ps_mask_set_bit( counter, (FT_UInt)hint3, memory );
+ if ( error )
+ goto Exit;
+ }
Exit:
return error;
@@ -793,7 +810,7 @@
ps_dimension_done( &hints->dimension[1], memory );
hints->error = FT_Err_Ok;
- hints->memory = 0;
+ hints->memory = NULL;
}
@@ -811,78 +828,57 @@
ps_hints_open( PS_Hints hints,
PS_Hint_Type hint_type )
{
- switch ( hint_type )
- {
- case PS_HINT_TYPE_1:
- case PS_HINT_TYPE_2:
- hints->error = FT_Err_Ok;
- hints->hint_type = hint_type;
+ hints->error = FT_Err_Ok;
+ hints->hint_type = hint_type;
- ps_dimension_init( &hints->dimension[0] );
- ps_dimension_init( &hints->dimension[1] );
- break;
-
- default:
- hints->error = FT_THROW( Invalid_Argument );
- hints->hint_type = hint_type;
-
- FT_TRACE0(( "ps_hints_open: invalid charstring type\n" ));
- break;
- }
+ ps_dimension_init( &hints->dimension[0] );
+ ps_dimension_init( &hints->dimension[1] );
}
/* add one or more stems to the current hints table */
static void
ps_hints_stem( PS_Hints hints,
- FT_Int dimension,
- FT_UInt count,
+ FT_UInt dimension,
+ FT_Int count,
FT_Long* stems )
{
- if ( !hints->error )
- {
- /* limit "dimension" to 0..1 */
- if ( dimension < 0 || dimension > 1 )
- {
- FT_TRACE0(( "ps_hints_stem: invalid dimension (%d) used\n",
- dimension ));
- dimension = ( dimension != 0 );
- }
+ PS_Dimension dim;
- /* record the stems in the current hints/masks table */
- switch ( hints->hint_type )
- {
- case PS_HINT_TYPE_1: /* Type 1 "hstem" or "vstem" operator */
- case PS_HINT_TYPE_2: /* Type 2 "hstem" or "vstem" operator */
- {
- PS_Dimension dim = &hints->dimension[dimension];
+ if ( hints->error )
+ return;
- for ( ; count > 0; count--, stems += 2 )
- {
- FT_Error error;
- FT_Memory memory = hints->memory;
+ /* limit "dimension" to 0..1 */
+ if ( dimension > 1 )
+ {
+ FT_TRACE0(( "ps_hints_stem: invalid dimension (%d) used\n",
+ dimension ));
+ dimension = ( dimension != 0 );
+ }
+ /* record the stems in the current hints/masks table */
+ /* (Type 1 & 2's `hstem' or `vstem' operators) */
+ dim = &hints->dimension[dimension];
- error = ps_dimension_add_t1stem(
- dim, (FT_Int)stems[0], (FT_Int)stems[1],
- memory, NULL );
- if ( error )
- {
- FT_ERROR(( "ps_hints_stem: could not add stem"
- " (%d,%d) to hints table\n", stems[0], stems[1] ));
+ for ( ; count > 0; count--, stems += 2 )
+ {
+ FT_Error error;
+ FT_Memory memory = hints->memory;
- hints->error = error;
- return;
- }
- }
- break;
- }
- default:
- FT_TRACE0(( "ps_hints_stem: called with invalid hint type (%d)\n",
- hints->hint_type ));
- break;
+ error = ps_dimension_add_t1stem( dim,
+ (FT_Int)stems[0],
+ (FT_Int)stems[1],
+ memory,
+ NULL );
+ if ( error )
+ {
+ FT_ERROR(( "ps_hints_stem: could not add stem"
+ " (%d,%d) to hints table\n", stems[0], stems[1] ));
+
+ hints->error = error;
+ return;
}
}
}
@@ -891,7 +887,7 @@
/* add one Type1 counter stem to the current hints table */
static void
ps_hints_t1stem3( PS_Hints hints,
- FT_Int dimension,
+ FT_UInt dimension,
FT_Fixed* stems )
{
FT_Error error = FT_Err_Ok;
@@ -906,7 +902,7 @@
/* limit "dimension" to 0..1 */
- if ( dimension < 0 || dimension > 1 )
+ if ( dimension > 1 )
{
FT_TRACE0(( "ps_hints_t1stem3: invalid dimension (%d) used\n",
dimension ));
@@ -1128,7 +1124,7 @@
static void
t1_hints_stem( T1_Hints hints,
- FT_Int dimension,
+ FT_UInt dimension,
FT_Fixed* coords )
{
FT_Pos stems[2];
@@ -1172,12 +1168,12 @@
static void
t2_hints_stems( T2_Hints hints,
- FT_Int dimension,
+ FT_UInt dimension,
FT_Int count,
FT_Fixed* coords )
{
- FT_Pos stems[32], y, n;
- FT_Int total = count;
+ FT_Pos stems[32], y;
+ FT_Int total = count, n;
y = 0;
diff --git a/src/3rdparty/freetype/src/pshinter/pshrec.h b/src/3rdparty/freetype/src/pshinter/pshrec.h
index a88fe6e834..2b1ad94936 100644
--- a/src/3rdparty/freetype/src/pshinter/pshrec.h
+++ b/src/3rdparty/freetype/src/pshinter/pshrec.h
@@ -4,7 +4,7 @@
/* */
/* Postscript (Type1/Type2) hints recorder (specification). */
/* */
-/* Copyright 2001, 2002, 2003, 2006, 2008, 2014 by */
+/* Copyright 2001-2015 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -61,12 +61,8 @@ FT_BEGIN_HEADER
/* hint flags */
- typedef enum PS_Hint_Flags_
- {
- PS_HINT_FLAG_GHOST = 1,
- PS_HINT_FLAG_BOTTOM = 2
-
- } PS_Hint_Flags;
+#define PS_HINT_FLAG_GHOST 1U
+#define PS_HINT_FLAG_BOTTOM 2U
/* hint descriptor */
diff --git a/src/3rdparty/freetype/src/pshinter/rules.mk b/src/3rdparty/freetype/src/pshinter/rules.mk
index 888ece1058..7838e676ec 100644
--- a/src/3rdparty/freetype/src/pshinter/rules.mk
+++ b/src/3rdparty/freetype/src/pshinter/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright 2001, 2003, 2011 by
+# Copyright 2001-2015 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -20,7 +20,10 @@ PSHINTER_DIR := $(SRC_DIR)/pshinter
# compilation flags for the driver
#
-PSHINTER_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(PSHINTER_DIR))
+PSHINTER_COMPILE := $(CC) $(ANSIFLAGS) \
+ $I$(subst /,$(COMPILER_SEP),$(PSHINTER_DIR)) \
+ $(INCLUDE_FLAGS) \
+ $(FT_CFLAGS)
# PSHINTER driver sources (i.e., C files)