From dd410b4407bf0256d21dad8b82449f226e2321f4 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 31 Aug 2018 07:16:58 +0200 Subject: [PATCH] Synchronize with FreeType. This corresponds to commits 0d4ca138 * src/autofit/afhints.c (af_glyph_hints_reload): Add initialization. c0ccf750 [autofit] Trace `before' and `after' edges of strong points. --- lib/tahints.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- lib/tahints.h | 6 ++++++ 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/lib/tahints.c b/lib/tahints.c index 411642e..d1de562 100644 --- a/lib/tahints.c +++ b/lib/tahints.c @@ -313,6 +313,19 @@ ta_get_edge_index(TA_GlyphHints hints, } +static int +ta_get_strong_edge_index(TA_GlyphHints hints, + TA_Edge* strong_edges, + int dimension) +{ + TA_AxisHints axis = &hints->axis[dimension]; + TA_Edge edges = axis->edges; + + + return TA_INDEX_NUM(strong_edges[dimension], edges); +} + + void ta_glyph_hints_dump_points(TA_GlyphHints hints) { @@ -329,8 +342,10 @@ ta_glyph_hints_dump_points(TA_GlyphHints hints) { TA_LOG((" index hedge hseg flags" /* " XXXXX XXXXX XXXXX XXXX" */ - " xorg yorg xscale yscale xfit yfit")); + " xorg yorg xscale yscale xfit yfit " /* " XXXXX XXXXX XXXX.XX XXXX.XX XXXX.XX XXXX.XX" */ + " hbef haft")); + /* " XXXXX XXXXX" */ } else TA_LOG((" (none)\n")); @@ -341,6 +356,7 @@ ta_glyph_hints_dump_points(TA_GlyphHints hints) int segment_idx_1 = ta_get_segment_index(hints, point_idx, 1); char buf1[16], buf2[16]; + char buf5[16], buf6[16]; /* insert extra newline at the beginning of a contour */ @@ -352,7 +368,8 @@ ta_glyph_hints_dump_points(TA_GlyphHints hints) /* we don't show vertical edges since they are never used */ TA_LOG((" %5d %5s %5s %4s" - " %5d %5d %7.2f %7.2f %7.2f %7.2f\n", + " %5d %5d %7.2f %7.2f %7.2f %7.2f" + " %5s %5s\n", point_idx, ta_print_idx(buf1, ta_get_edge_index(hints, segment_idx_1, 1)), @@ -364,7 +381,14 @@ ta_glyph_hints_dump_points(TA_GlyphHints hints) point->ox / 64.0, point->oy / 64.0, point->x / 64.0, - point->y / 64.0)); + point->y / 64.0, + + ta_print_idx(buf5, ta_get_strong_edge_index(hints, + point->before, + 1)), + ta_print_idx(buf6, ta_get_strong_edge_index(hints, + point->after, + 1)))); } TA_LOG(("\n")); } @@ -848,6 +872,13 @@ ta_glyph_hints_reload(TA_GlyphHints hints, prev = end; } } + +#ifdef TA_DEBUG + point->before[0] = NULL; + point->before[1] = NULL; + point->after[0] = NULL; + point->after[1] = NULL; +#endif } } @@ -1301,6 +1332,11 @@ ta_glyph_hints_align_strong_points(TA_GlyphHints hints, { u = edge->pos - (edge->opos - ou); +#ifdef TA_DEBUG + point->before[dim] = edge; + point->after[dim] = NULL; +#endif + if (hints->recorder) hints->recorder(ta_ip_before, hints, dim, point, NULL, NULL, NULL, NULL); @@ -1315,6 +1351,11 @@ ta_glyph_hints_align_strong_points(TA_GlyphHints hints, { u = edge->pos + (ou - edge->opos); +#ifdef TA_DEBUG + point->before[dim] = NULL; + point->after[dim] = edge; +#endif + if (hints->recorder) hints->recorder(ta_ip_after, hints, dim, point, NULL, NULL, NULL, NULL); @@ -1369,6 +1410,11 @@ ta_glyph_hints_align_strong_points(TA_GlyphHints hints, /* we are on the edge */ u = edge->pos; +#ifdef TA_DEBUG + point->before[dim] = NULL; + point->after[dim] = NULL; +#endif + if (hints->recorder) hints->recorder(ta_ip_on, hints, dim, point, edge, NULL, NULL, NULL); @@ -1383,6 +1429,11 @@ ta_glyph_hints_align_strong_points(TA_GlyphHints hints, TA_Edge after = edges + min + 0; +#ifdef TA_DEBUG + point->before[dim] = before; + point->after[dim] = after; +#endif + /* assert(before && after && before != after) */ if (before->scale == 0) before->scale = FT_DivFix(after->pos - before->pos, diff --git a/lib/tahints.h b/lib/tahints.h index 01ba02d..c767003 100644 --- a/lib/tahints.h +++ b/lib/tahints.h @@ -249,6 +249,12 @@ typedef struct TA_PointRec_ TA_Point next; /* next point in contour */ TA_Point prev; /* previous point in contour */ + +#ifdef TA_DEBUG + /* track `before' and `after' edges for strong points */ + TA_Edge before[2]; + TA_Edge after[2]; +#endif } TA_PointRec; -- 2.11.4.GIT