[autofit] Improve BOUND action.

In complex glyph shapes, the original logic was too simple to cater
for situations that would actually need something similar to PS Hint
masks.  This fix should alleviate the worst cases.

* src/autofit/aflatin.c (af_latin_hint_edges): Don't allow
complete disappearance of stems.
This commit is contained in:
Werner Lemberg 2016-02-26 08:10:41 +01:00
parent 44324b3746
commit ebfd7ce52f
2 changed files with 44 additions and 12 deletions

View File

@ -1,3 +1,14 @@
2016-02-26 Werner Lemberg <wl@gnu.org>
[autofit] Improve BOUND action.
In complex glyph shapes, the original logic was too simple to cater
for situations that would actually need something similar to PS Hint
masks. This fix should alleviate the worst cases.
* src/autofit/aflatin.c (af_latin_hint_edges): Don't allow
complete disappearance of stems.
2016-02-25 Werner Lemberg <wl@gnu.org>
[autofit] Add blue-zone support for Tamil script.

View File

@ -2885,14 +2885,21 @@
( top_to_bottom_hinting ? ( edge->pos > edge[-1].pos )
: ( edge->pos < edge[-1].pos ) ) )
{
/* don't move if stem would (almost) disappear otherwise; */
/* the ad-hoc value 16 corresponds to 1/4px */
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
{
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 ));
FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[-1].pos / 64.0 ));
num_actions++;
num_actions++;
#endif
edge->pos = edge[-1].pos;
edge->pos = edge[-1].pos;
}
}
}
}
@ -3048,13 +3055,20 @@
( top_to_bottom_hinting ? ( edge->pos > edge[-1].pos )
: ( edge->pos < edge[-1].pos ) ) )
{
/* don't move if stem would (almost) disappear otherwise; */
/* the ad-hoc value 16 corresponds to 1/4px */
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
{
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 ));
FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[-1].pos / 64.0 ));
num_actions++;
num_actions++;
#endif
edge->pos = edge[-1].pos;
edge->pos = edge[-1].pos;
}
}
if ( edge + 1 < edge_limit &&
@ -3062,14 +3076,21 @@
( top_to_bottom_hinting ? ( edge->pos < edge[1].pos )
: ( edge->pos > edge[1].pos ) ) )
{
/* don't move if stem would (almost) disappear otherwise; */
/* the ad-hoc value 16 corresponds to 1/4px */
if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
{
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
edge - edges, edge->pos / 64.0, edge[1].pos / 64.0 ));
FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n",
edge - edges,
edge->pos / 64.0,
edge[1].pos / 64.0 ));
num_actions++;
num_actions++;
#endif
edge->pos = edge[1].pos;
edge->pos = edge[1].pos;
}
}
}
}