[autofit] Minor clean-ups.

* src/autofit/afhints.c (AF_FLAGS): Remove obsolete values.

* src/autofit/afhints.c (af_glyph_hints_dump_points,
af_glyph_hints_align_strong_points): Updated.

* src/autofit/aflatin.c (af_latin_hints_link_segments,
af_latin_hints_compute_segments), src/autofit/afcjk.c
(af_cjk_hints_link_segments), src/autofit/aflatin2.c
(af_latin2_hints_link_segments, af_latin2_hints_compute_segments):
There are no longer fake segments since more than 10 years...
This commit is contained in:
Werner Lemberg 2014-09-24 19:06:13 +02:00
parent 0753c0c35e
commit 5b68e4fb60
6 changed files with 34 additions and 54 deletions

View File

@ -1,3 +1,18 @@
2014-09-24 Werner Lemberg <wl@gnu.org>
[autofit] Minor clean-ups.
* src/autofit/afhints.c (AF_FLAGS): Remove obsolete values.
* src/autofit/afhints.c (af_glyph_hints_dump_points,
af_glyph_hints_align_strong_points): Updated.
* src/autofit/aflatin.c (af_latin_hints_link_segments,
af_latin_hints_compute_segments), src/autofit/afcjk.c
(af_cjk_hints_link_segments), src/autofit/aflatin2.c
(af_latin2_hints_link_segments, af_latin2_hints_compute_segments):
There are no longer fake segments since more than 10 years...
2014-09-22 Werner Lemberg <wl@gnu.org> 2014-09-22 Werner Lemberg <wl@gnu.org>
[autofit] Minor code streamlining. [autofit] Minor code streamlining.

View File

@ -765,10 +765,6 @@
/* now compare each segment to the others */ /* now compare each segment to the others */
for ( seg1 = segments; seg1 < segment_limit; seg1++ ) for ( seg1 = segments; seg1 < segment_limit; seg1++ )
{ {
/* the fake segments are for metrics hinting only */
if ( seg1->first == seg1->last )
continue;
if ( seg1->dir != major_dir ) if ( seg1->dir != major_dir )
continue; continue;

View File

@ -201,7 +201,7 @@
for ( point = points; point < limit; point++ ) for ( point = points; point < limit; point++ )
AF_DUMP(( " [ %5d | %5d | %5d | %6.2f | %6.2f" AF_DUMP(( " [ %5d | %5d | %5d | %6.2f | %6.2f"
" | %5.2f | %5.2f | %c%c%c%c%c%c ]\n", " | %5.2f | %5.2f | %c ]\n",
point - points, point - points,
point->fx, point->fx,
point->fy, point->fy,
@ -209,12 +209,7 @@
point->oy / 64.0, point->oy / 64.0,
point->x / 64.0, point->x / 64.0,
point->y / 64.0, point->y / 64.0,
( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' ', ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' '));
( point->flags & AF_FLAG_INFLECTION ) ? 'i' : ' ',
( point->flags & AF_FLAG_EXTREMA_X ) ? '<' : ' ',
( point->flags & AF_FLAG_EXTREMA_Y ) ? 'v' : ' ',
( point->flags & AF_FLAG_ROUND_X ) ? '(' : ' ',
( point->flags & AF_FLAG_ROUND_Y ) ? 'u' : ' '));
AF_DUMP(( "\n" )); AF_DUMP(( "\n" ));
} }
#ifdef __cplusplus #ifdef __cplusplus
@ -1076,8 +1071,7 @@
/* if this point is candidate to weak interpolation, we */ /* if this point is candidate to weak interpolation, we */
/* interpolate it after all strong points have been processed */ /* interpolate it after all strong points have been processed */
if ( ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) && if ( ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) )
!( point->flags & AF_FLAG_INFLECTION ) )
continue; continue;
if ( dim == AF_DIMENSION_VERT ) if ( dim == AF_DIMENSION_VERT )

View File

@ -72,13 +72,9 @@ FT_BEGIN_HEADER
* `af_{cjk,latin,...}_hints_compute_segments' are the functions to * `af_{cjk,latin,...}_hints_compute_segments' are the functions to
* find segments in an outline. * find segments in an outline.
* *
* A segment is a series of consecutive points that are approximately * A segment is a series of at least two consecutive points that are
* aligned along a coordinate axis. The analysis to do so is specific * approximately aligned along a coordinate axis. The analysis to do
* to a writing system. * so is specific to a writing system.
*
* A segment must have at least two points, except in the case of
* `fake' segments that are generated to hint metrics appropriately,
* and which consist of a single point.
* *
* *
* Edges * Edges
@ -148,7 +144,7 @@ FT_BEGIN_HEADER
* Serifs are detected by `af_{cjk,latin,...}_hint_edges'. * Serifs are detected by `af_{cjk,latin,...}_hint_edges'.
* *
* In comparison to a stem, a serif (as handled by the auto-hinter * In comparison to a stem, a serif (as handled by the auto-hinter
* module which takes care of the `latin' writing system) has * module that takes care of the `latin' writing system) has
* *
* best segment_1 = segment_2 && best segment_2 != segment_1 * best segment_1 = segment_2 && best segment_2 != segment_1
* *
@ -178,19 +174,19 @@ FT_BEGIN_HEADER
* *
* Strong Points * Strong Points
* *
* Experience has shown that points which are not part of an edge need * Experience has shown that points not part of an edge need to be
* to be interpolated linearly between their two closest edges, even if * interpolated linearly between their two closest edges, even if these
* these are not part of the contour of those particular points. * are not part of the contour of those particular points. Typical
* Typical candidates for this are * candidates for this are
* *
* - angle points (i.e., points where the `in' and `out' direction * - angle points (i.e., points where the `in' and `out' direction
* differ greatly) * differ greatly)
* *
* - inflection points (i.e., where the `in' and `out' angles are the * - inflection points (i.e., where the `in' and `out' angles are the
* same, but the curvature changes sign) [currently, such points * same, but the curvature changes sign) [currently, such points
* aren't handled in the auto-hinter] * aren't handled specially in the auto-hinter]
* *
* `af_glyph_hints_align_strong_points' is the function which takes * `af_glyph_hints_align_strong_points' is the function that takes
* care of such situations; it is equivalent to the TrueType `IP' * care of such situations; it is equivalent to the TrueType `IP'
* hinting instruction. * hinting instruction.
* *
@ -220,23 +216,12 @@ FT_BEGIN_HEADER
AF_FLAG_CUBIC = 1 << 1, AF_FLAG_CUBIC = 1 << 1,
AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC, AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC,
/* point extremum flags */
AF_FLAG_EXTREMA_X = 1 << 2,
AF_FLAG_EXTREMA_Y = 1 << 3,
/* point roundness flags */
AF_FLAG_ROUND_X = 1 << 4,
AF_FLAG_ROUND_Y = 1 << 5,
/* point touch flags */ /* point touch flags */
AF_FLAG_TOUCH_X = 1 << 6, AF_FLAG_TOUCH_X = 1 << 2,
AF_FLAG_TOUCH_Y = 1 << 7, AF_FLAG_TOUCH_Y = 1 << 3,
/* candidates for weak interpolation have this flag set */ /* candidates for weak interpolation have this flag set */
AF_FLAG_WEAK_INTERPOLATION = 1 << 8, AF_FLAG_WEAK_INTERPOLATION = 1 << 4
/* all inflection points in the outline have this flag set */
AF_FLAG_INFLECTION = 1 << 9
} AF_Flags; } AF_Flags;

View File

@ -1329,9 +1329,6 @@
FT_Pos last_v = last->v; FT_Pos last_v = last->v;
if ( first == last )
continue;
if ( first_v < last_v ) if ( first_v < last_v )
{ {
AF_Point p; AF_Point p;
@ -1407,9 +1404,7 @@
/* now compare each segment to the others */ /* now compare each segment to the others */
for ( seg1 = segments; seg1 < segment_limit; seg1++ ) for ( seg1 = segments; seg1 < segment_limit; seg1++ )
{ {
/* the fake segments are introduced to hint the metrics -- */ if ( seg1->dir != axis->major_dir )
/* we must never link them to anything */
if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )
continue; continue;
/* search for stems having opposite directions, */ /* search for stems having opposite directions, */

View File

@ -890,9 +890,6 @@
FT_Pos last_v = last->v; FT_Pos last_v = last->v;
if ( first == last )
continue;
if ( first_v < last_v ) if ( first_v < last_v )
{ {
p = first->prev; p = first->prev;
@ -984,7 +981,7 @@
#ifdef AF_SORT_SEGMENTS #ifdef AF_SORT_SEGMENTS
for ( seg1 = segments; seg1 < segment_mid; seg1++ ) for ( seg1 = segments; seg1 < segment_mid; seg1++ )
{ {
if ( seg1->dir != axis->major_dir || seg1->first == seg1->last ) if ( seg1->dir != axis->major_dir )
continue; continue;
for ( seg2 = segment_mid; seg2 < segment_limit; seg2++ ) for ( seg2 = segment_mid; seg2 < segment_limit; seg2++ )
@ -992,9 +989,7 @@
/* now compare each segment to the others */ /* now compare each segment to the others */
for ( seg1 = segments; seg1 < segment_limit; seg1++ ) for ( seg1 = segments; seg1 < segment_limit; seg1++ )
{ {
/* the fake segments are introduced to hint the metrics -- */ if ( seg1->dir != axis->major_dir )
/* we must never link them to anything */
if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )
continue; continue;
for ( seg2 = segments; seg2 < segment_limit; seg2++ ) for ( seg2 = segments; seg2 < segment_limit; seg2++ )