[autofit] Improve tracing messages. * src/autofit/afcjk.c (af_cjk_metrics_init_widths): Mention script ID in tracing message. (af_cjk_metrics_init_blues): Initialize `axis' outside of the inner loop. Improve tracing messages. (af_cjk_hint_edges) [FT_DEBUG_LEVEL_TRACE]: New variable `num_actions' to count hinting actions. Improve tracing messages. * src/autofit/aflatin.c (af_latin_metrics_init_widths): Mention script ID in tracing message. (af_latin_metrics_init_blues, af_latin_hint_edges): Improve tracing messages.
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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
diff --git a/ChangeLog b/ChangeLog
index e462c91..3fb8c79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2013-08-26 Werner Lemberg <wl@gnu.org>
+ [autofit] Improve tracing messages.
+
+ * src/autofit/afcjk.c (af_cjk_metrics_init_widths): Mention script
+ ID in tracing message.
+ (af_cjk_metrics_init_blues): Initialize `axis' outside of the inner
+ loop.
+ Improve tracing messages.
+ (af_cjk_hint_edges) [FT_DEBUG_LEVEL_TRACE]: New variable
+ `num_actions' to count hinting actions.
+ Improve tracing messages.
+
+ * src/autofit/aflatin.c (af_latin_metrics_init_widths): Mention
+ script ID in tracing message.
+ (af_latin_metrics_init_blues, af_latin_hint_edges): Improve tracing
+ messages.
+
+2013-08-26 Werner Lemberg <wl@gnu.org>
+
Better tracing of loaded glyphs.
Previously, the loading of a glyph was traced at level 4, if at all.
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index 5a5aa47..740a384 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -73,9 +73,11 @@
AF_GlyphHintsRec hints[1];
- FT_TRACE5(( "cjk standard widths computation\n"
- "===============================\n"
- "\n" ));
+ FT_TRACE5(( "\n"
+ "cjk standard widths computation (script %d)\n"
+ "===========================================\n"
+ "\n",
+ metrics->root.script_class->script ));
af_glyph_hints_init( hints, face->memory );
@@ -259,6 +261,11 @@
FT_Pos* blue_shoot;
+ if ( AF_CJK_IS_HORIZ_BLUE( bs ) )
+ axis = &metrics->axis[AF_DIMENSION_HORZ];
+ else
+ axis = &metrics->axis[AF_DIMENSION_VERT];
+
FT_TRACE5(( "blue zone %d:\n", axis->blue_count ));
num_fills = 0;
@@ -280,13 +287,11 @@
GET_UTF8_CHAR( ch, p );
- FT_TRACE5(( " U+%lX... ", ch ));
-
/* load the character in the face -- skip unknown or empty ones */
glyph_index = FT_Get_Char_Index( face, ch );
if ( glyph_index == 0 )
{
- FT_TRACE5(( "unavailable\n" ));
+ FT_TRACE5(( " U+%04lX unavailable\n", ch ));
continue;
}
@@ -294,7 +299,7 @@
outline = face->glyph->outline;
if ( error || outline.n_points <= 0 )
{
- FT_TRACE5(( "no outline\n" ));
+ FT_TRACE5(( " U+%04lX contains no outlines\n", ch ));
continue;
}
@@ -366,7 +371,7 @@
}
}
- FT_TRACE5(( "best_pos = %5ld\n", best_pos ));
+ FT_TRACE5(( " U+%04lX: best_pos = %5ld\n", ch, best_pos ));
}
if ( AF_CJK_IS_FILLED_BLUE( bs ) )
@@ -391,11 +396,6 @@
af_sort_pos( num_flats, flats );
af_sort_pos( num_fills, fills );
- if ( AF_CJK_IS_HORIZ_BLUE( bs ) )
- axis = &metrics->axis[AF_DIMENSION_HORZ];
- else
- axis = &metrics->axis[AF_DIMENSION_VERT];
-
blue = &axis->blues[axis->blue_count];
blue_ref = &blue->ref.org;
blue_shoot = &blue->shoot.org;
@@ -1660,9 +1660,13 @@
FT_Bool has_last_stem = FALSE;
FT_Pos last_stem_pos = 0;
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_UInt num_actions = 0;
+#endif
+
/* we begin by aligning all stems relative to the blue zone */
- FT_TRACE5(( "==== cjk hinting %s edges =====\n",
+ FT_TRACE5(( "cjk %s edge hinting\n",
dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" ));
if ( AF_HINTS_DO_BLUES( hints ) )
@@ -1694,10 +1698,14 @@
if ( !edge1 )
continue;
- FT_TRACE5(( "CJKBLUE: edge %d @%d (opos=%.2f) snapped to (%.2f), "
- "was (%.2f)\n",
- edge1-edges, edge1->fpos, edge1->opos / 64.0, blue->fit / 64.0,
- edge1->pos / 64.0 ));
+#ifdef FT_DEBUG_LEVEL_TRACE
+ FT_TRACE5(( " CJKBLUE: edge %d @%d (opos=%.2f) snapped to %.2f,"
+ " was %.2f\n",
+ edge1 - edges, edge1->fpos, edge1->opos / 64.0,
+ blue->fit / 64.0, edge1->pos / 64.0 ));
+
+ num_actions++;
+#endif
edge1->pos = blue->fit;
edge1->flags |= AF_EDGE_DONE;
@@ -1706,6 +1714,10 @@
{
af_cjk_align_linked_edge( hints, dim, edge1, edge2 );
edge2->flags |= AF_EDGE_DONE;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ num_actions++;
+#endif
}
if ( !anchor )
@@ -1747,6 +1759,7 @@
}
/* now align the stem */
+
/* this should not happen, but it's better to be safe */
if ( edge2->blue_edge )
{
@@ -1754,6 +1767,11 @@
af_cjk_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ num_actions++;
+#endif
+
continue;
}
@@ -1761,6 +1779,11 @@
{
af_cjk_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ num_actions++;
+#endif
+
/* We rarely reaches here it seems;
* usually the two edges belonging
* to one stem are marked as DONE together
@@ -1928,7 +1951,7 @@
}
if ( !skipped )
- return;
+ goto Exit;
/*
* now hint the remaining edges (serifs and single) in order
@@ -1948,7 +1971,7 @@
}
if ( !skipped )
- return;
+ goto Exit;
for ( edge = edges; edge < edge_limit; edge++ )
{
@@ -1986,6 +2009,16 @@
}
}
}
+
+ Exit:
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+ if ( !num_actions )
+ FT_TRACE5(( " (none)\n" ));
+ FT_TRACE5(( "\n" ));
+#endif
+
+ return;
}
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 9cc1d18..51a1bd0 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -60,9 +60,11 @@
AF_GlyphHintsRec hints[1];
- FT_TRACE5(( "latin standard widths computation\n"
- "=================================\n"
- "\n" ));
+ FT_TRACE5(( "\n"
+ "latin standard widths computation (script %d)\n"
+ "=============================================\n"
+ "\n",
+ metrics->root.script_class->script ));
af_glyph_hints_init( hints, face->memory );
@@ -249,13 +251,11 @@
GET_UTF8_CHAR( ch, p );
- FT_TRACE5(( " U+%lX... ", ch ));
-
/* load the character in the face -- skip unknown or empty ones */
glyph_index = FT_Get_Char_Index( face, ch );
if ( glyph_index == 0 )
{
- FT_TRACE5(( "unavailable\n" ));
+ FT_TRACE5(( " U+%04lX unavailable\n", ch ));
continue;
}
@@ -263,7 +263,7 @@
outline = face->glyph->outline;
if ( error || outline.n_points <= 0 )
{
- FT_TRACE5(( "no outline\n" ));
+ FT_TRACE5(( " U+%04lX contains no outlines\n", ch ));
continue;
}
@@ -320,7 +320,7 @@
}
}
- FT_TRACE5(( "best_y = %5ld\n", best_y ));
+ FT_TRACE5(( " U+%04lX: best_y = %5ld", ch, best_y ));
}
/* now check whether the point belongs to a straight or round */
@@ -1897,7 +1897,7 @@
#endif
- FT_TRACE5(( "%s edge hinting\n",
+ FT_TRACE5(( "latin %s edge hinting\n",
dim == AF_DIMENSION_VERT ? "horizontal" : "vertical" ));
/* we begin by aligning all stems relative to the blue zone */