summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/autofit/aflatin2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/autofit/aflatin2.c')
-rw-r--r--src/3rdparty/freetype/src/autofit/aflatin2.c80
1 files changed, 43 insertions, 37 deletions
diff --git a/src/3rdparty/freetype/src/autofit/aflatin2.c b/src/3rdparty/freetype/src/autofit/aflatin2.c
index 07590b380c..0380ffc04c 100644
--- a/src/3rdparty/freetype/src/autofit/aflatin2.c
+++ b/src/3rdparty/freetype/src/autofit/aflatin2.c
@@ -4,7 +4,7 @@
/* */
/* Auto-fitter hinting routines for latin writing system (body). */
/* */
-/* Copyright 2003-2014 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, */
@@ -835,8 +835,8 @@
{
AF_Point pt = first;
AF_Point last = point;
- AF_Flags f0 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL );
- AF_Flags f1;
+ FT_UInt f0 = pt->flags & AF_FLAG_CONTROL;
+ FT_UInt f1;
segment->flags &= ~AF_EDGE_ROUND;
@@ -844,7 +844,7 @@
for ( ; pt != last; f0 = f1 )
{
pt = pt->next;
- f1 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL );
+ f1 = pt->flags & AF_FLAG_CONTROL;
if ( !f0 && !f1 )
break;
@@ -1048,7 +1048,7 @@
{
if ( seg2->link != seg1 )
{
- seg1->link = 0;
+ seg1->link = NULL;
seg1->serif = seg2->link;
}
}
@@ -1128,7 +1128,7 @@
for ( seg = segments; seg < segment_limit; seg++ )
{
- AF_Edge found = 0;
+ AF_Edge found = NULL;
FT_Int ee;
@@ -1355,7 +1355,7 @@
/* Example: the `c' in cour.pfa at size 13 */
if ( edge->serif && edge->link )
- edge->serif = 0;
+ edge->serif = NULL;
}
}
@@ -1382,7 +1382,7 @@
}
- FT_LOCAL_DEF( void )
+ static void
af_latin2_hints_compute_blue_edges( AF_GlyphHints hints,
AF_LatinMetrics metrics )
{
@@ -1513,9 +1513,7 @@
#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */
if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V )
- {
metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL;
- }
#endif
scaler_flags = hints->scaler_flags;
@@ -1552,6 +1550,12 @@
( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 )
scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
+#ifdef AF_CONFIG_OPTION_USE_WARPER
+ /* get (global) warper flag */
+ if ( !metrics->root.globals->module->warping )
+ scaler_flags |= AF_SCALER_FLAG_NO_WARPER;
+#endif
+
hints->scaler_flags = scaler_flags;
hints->other_flags = other_flags;
@@ -1572,13 +1576,13 @@
static FT_Pos
af_latin2_snap_width( AF_Width widths,
- FT_Int count,
+ FT_UInt count,
FT_Pos width )
{
- int n;
- FT_Pos best = 64 + 32 + 2;
- FT_Pos reference = width;
- FT_Pos scaled;
+ FT_UInt n;
+ FT_Pos best = 64 + 32 + 2;
+ FT_Pos reference = width;
+ FT_Pos scaled;
for ( n = 0; n < count; n++ )
@@ -1621,8 +1625,8 @@
af_latin2_compute_stem_width( AF_GlyphHints hints,
AF_Dimension dim,
FT_Pos width,
- AF_Edge_Flags base_flags,
- AF_Edge_Flags stem_flags )
+ FT_UInt base_flags,
+ FT_UInt stem_flags )
{
AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics;
AF_LatinAxis axis = & metrics->axis[dim];
@@ -1793,10 +1797,9 @@
{
FT_Pos dist = stem_edge->opos - base_edge->opos;
- FT_Pos fitted_width = af_latin2_compute_stem_width(
- hints, dim, dist,
- (AF_Edge_Flags)base_edge->flags,
- (AF_Edge_Flags)stem_edge->flags );
+ FT_Pos fitted_width = af_latin2_compute_stem_width( hints, dim, dist,
+ base_edge->flags,
+ stem_edge->flags );
stem_edge->pos = base_edge->pos + fitted_width;
@@ -1830,7 +1833,7 @@
/*************************************************************************/
- FT_LOCAL_DEF( void )
+ static void
af_latin2_hint_edges( AF_GlyphHints hints,
AF_Dimension dim )
{
@@ -1838,7 +1841,7 @@
AF_Edge edges = axis->edges;
AF_Edge edge_limit = edges + axis->num_edges;
AF_Edge edge;
- AF_Edge anchor = 0;
+ AF_Edge anchor = NULL;
FT_Int has_serifs = 0;
FT_Pos anchor_drift = 0;
@@ -1942,10 +1945,9 @@
org_len = edge2->opos - edge->opos;
- cur_len = af_latin2_compute_stem_width(
- hints, dim, org_len,
- (AF_Edge_Flags)edge->flags,
- (AF_Edge_Flags)edge2->flags );
+ cur_len = af_latin2_compute_stem_width( hints, dim, org_len,
+ edge->flags,
+ edge2->flags );
if ( cur_len <= 64 )
u_off = d_off = 32;
else
@@ -2007,10 +2009,9 @@
org_len = edge2->opos - edge->opos;
org_center = org_pos + ( org_len >> 1 );
- cur_len = af_latin2_compute_stem_width(
- hints, dim, org_len,
- (AF_Edge_Flags)edge->flags,
- (AF_Edge_Flags)edge2->flags );
+ cur_len = af_latin2_compute_stem_width( hints, dim, org_len,
+ edge->flags,
+ edge2->flags );
org_left = org_pos + ( ( org_len - cur_len ) >> 1 );
org_right = org_pos + ( ( org_len + cur_len ) >> 1 );
@@ -2299,13 +2300,16 @@
static FT_Error
- af_latin2_hints_apply( AF_GlyphHints hints,
+ af_latin2_hints_apply( FT_UInt glyph_index,
+ AF_GlyphHints hints,
FT_Outline* outline,
AF_LatinMetrics metrics )
{
FT_Error error;
int dim;
+ FT_UNUSED( glyph_index );
+
error = af_glyph_hints_reload( hints, outline );
if ( error )
@@ -2313,8 +2317,9 @@
/* analyze glyph outline */
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ||
- AF_HINTS_DO_HORIZONTAL( hints ) )
+ if ( ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
+ AF_HINTS_DO_WARP( hints ) ) ||
+ AF_HINTS_DO_HORIZONTAL( hints ) )
#else
if ( AF_HINTS_DO_HORIZONTAL( hints ) )
#endif
@@ -2337,8 +2342,9 @@
for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
{
#ifdef AF_CONFIG_OPTION_USE_WARPER
- if ( ( dim == AF_DIMENSION_HORZ &&
- metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) )
+ if ( dim == AF_DIMENSION_HORZ &&
+ metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT &&
+ AF_HINTS_DO_WARP( hints ) )
{
AF_WarperRec warper;
FT_Fixed scale;
@@ -2349,7 +2355,7 @@
af_glyph_hints_scale_dim( hints, dim, scale, delta );
continue;
}
-#endif
+#endif /* AF_CONFIG_OPTION_USE_WARPER */
if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) ||
( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) )