summaryrefslogtreecommitdiffstats
path: root/src/pshinter/pshalgo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pshinter/pshalgo.c')
-rw-r--r--src/pshinter/pshalgo.c49
1 files changed, 18 insertions, 31 deletions
diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c
index 644c76d..bfdb3ed 100644
--- a/src/pshinter/pshalgo.c
+++ b/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 */
@@ -1149,7 +1140,7 @@
glyph->num_points = 0;
glyph->num_contours = 0;
- glyph->memory = 0;
+ glyph->memory = NULL;
}
@@ -1274,8 +1265,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 +1276,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 +1687,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 +2035,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 ) )