[autofit] Improve tracing. * src/autofit/aflatin.c (af_latin_hint_edges) [FT_DEBUG_LEVEL_TRACE]: Count number of actions and emit something if there weren't any.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
diff --git a/ChangeLog b/ChangeLog
index 8fa12b5..9fa0821 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-11-10 Werner Lemberg <wl@gnu.org>
+
+ [autofit] Improve tracing.
+
+ * src/autofit/aflatin.c (af_latin_hint_edges)
+ [FT_DEBUG_LEVEL_TRACE]: Count number of actions and emit something
+ if there weren't any.
+
2012-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Fortify emboldening code against egregious distortions.
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index fb4e20b..ee92947 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1848,9 +1848,13 @@
AF_Edge anchor = NULL;
FT_Int has_serifs = 0;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_UInt num_actions = 0;
+#endif
+
- FT_TRACE5(("%s edge hinting\n", dim == AF_DIMENSION_VERT ? "horizontal"
- : "vertical"));
+ FT_TRACE5(( "%s edge hinting\n",
+ dim == AF_DIMENSION_VERT ? "horizontal" : "vertical" ));
/* we begin by aligning all stems relative to the blue zone */
/* if needed -- that's only for horizontal edges */
@@ -1884,6 +1888,7 @@
if ( !edge1 )
continue;
+#ifdef FT_DEBUG_LEVEL_TRACE
if (!anchor)
FT_TRACE5(( " BLUE_ANCHOR: edge %d (opos=%.2f) snapped to %.2f,"
" was %.2f (anchor=edge %d)\n",
@@ -1895,6 +1900,9 @@
edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
edge1->pos / 64.0 ));
+ num_actions++;
+#endif
+
edge1->pos = blue->fit;
edge1->flags |= AF_EDGE_DONE;
@@ -1902,6 +1910,10 @@
{
af_latin_align_linked_edge( hints, dim, edge1, edge2 );
edge2->flags |= AF_EDGE_DONE;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ num_actions++;
+#endif
}
if ( !anchor )
@@ -1936,6 +1948,10 @@
af_latin_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ num_actions++;
+#endif
continue;
}
@@ -2003,6 +2019,10 @@
edge->pos / 64.0, edge2->pos / 64.0 ));
af_latin_align_linked_edge( hints, dim, edge, edge2 );
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ num_actions += 2;
+#endif
}
else
{
@@ -2068,6 +2088,7 @@
edge2 - edges, edge2->opos / 64.0,
edge->pos / 64.0, edge2->pos / 64.0 ));
}
+
else
{
org_pos = anchor->pos + ( edge->opos - anchor->opos );
@@ -2099,14 +2120,22 @@
edge->pos / 64.0, edge2->pos / 64.0 ));
}
+#ifdef FT_DEBUG_LEVEL_TRACE
+ num_actions++;
+#endif
+
edge->flags |= AF_EDGE_DONE;
edge2->flags |= AF_EDGE_DONE;
if ( edge > edges && edge->pos < edge[-1].pos )
{
+#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 ));
+ num_actions++;
+#endif
+
edge->pos = edge[-1].pos;
}
}
@@ -2248,20 +2277,25 @@
{
edge->pos = anchor->pos +
( ( edge->opos - anchor->opos + 16 ) & ~31 );
-
FT_TRACE5(( " SERIF_LINK2: edge %d (opos=%.2f)"
" snapped to %.2f\n",
edge - edges, edge->opos / 64.0, edge->pos / 64.0 ));
}
}
+#ifdef FT_DEBUG_LEVEL_TRACE
+ num_actions++;
+#endif
edge->flags |= AF_EDGE_DONE;
if ( edge > edges && edge->pos < edge[-1].pos )
{
+#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 ));
+ num_actions++;
+#endif
edge->pos = edge[-1].pos;
}
@@ -2269,15 +2303,23 @@
edge[1].flags & AF_EDGE_DONE &&
edge->pos > edge[1].pos )
{
+#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 ));
+ num_actions++;
+#endif
+
edge->pos = edge[1].pos;
}
}
}
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( !num_actions )
+ FT_TRACE5(( " (none)\n" ));
FT_TRACE5(( "\n" ));
+#endif
}