- fixed a bug in af_compute_direction which generated ugly glyphs - added more debug/log messages to help improve the auto-fitter
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
diff --git a/ChangeLog b/ChangeLog
index bc1f49a..201f1eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-02 David Turner <david@freetype.org>
+
+ * src/autofit/afhints.c, src/autofit/afmodule.c,
+ src/autofit/aftypes.h: adding more debug messages and fixing a small
+ bug in af_compute_direction which produced garbage by missing lots of
+ segments
+
2006-10-24 Werner Lemberg <wl@gnu.org>
* src/cff/cffload.c (cff_encoding_load): Remove unused variable.
diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c
index 6b3a310..4539590 100644
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -311,7 +311,7 @@
}
ss *= 12;
- if ( ll <= FT_ABS( ss ) )
+ if ( FT_ABS(ll) <= FT_ABS(ss) )
dir = AF_DIR_NONE;
return dir;
diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h
index 66078fd..6e0e415 100644
--- a/src/autofit/afhints.h
+++ b/src/autofit/afhints.h
@@ -227,6 +227,8 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_ADVANCE( h ) \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
+#define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints )
+
#else /* !AF_DEBUG */
#define AF_HINTS_DO_HORIZONTAL( h ) \
@@ -238,6 +240,8 @@ FT_BEGIN_HEADER
#define AF_HINTS_DO_ADVANCE( h ) \
!AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE )
+#define AF_HINTS_DO_BLUES( h ) 1
+
#endif /* !AF_DEBUG */
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 48c36b2..48dc813 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1586,8 +1586,11 @@
(AF_Edge_Flags)base_edge->flags,
(AF_Edge_Flags)stem_edge->flags );
-
stem_edge->pos = base_edge->pos + fitted_width;
+
+ AF_LOG(( "LINK: edge %d (opos=%.2f) linked to (%.2f), dist was %.2f now %.2f\n",
+ stem_edge-hints->axis[dim].edges, stem_edge->opos/64.0,
+ stem_edge->pos/64.0, dist/64., fitted_width/64. ));
}
@@ -1629,7 +1632,7 @@
/* we begin by aligning all stems relative to the blue zone */
/* if needed -- that's only for horizontal edges */
- if ( dim == AF_DIMENSION_VERT )
+ if ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_BLUES(hints) )
{
for ( edge = edges; edge < edge_limit; edge++ )
{
@@ -1658,6 +1661,8 @@
if ( !edge1 )
continue;
+ AF_LOG(( "BLUE: edge %d (opos=%.2f) snapped to (%.2f) was (%.2f)\n",
+ edge1-edges, edge1->opos/64., blue->fit/64., edge1->pos/64.0 ));
edge1->pos = blue->fit;
edge1->flags |= AF_EDGE_DONE;
@@ -1695,6 +1700,7 @@
/* this should not happen, but it's better to be safe */
if ( edge2->blue_edge || edge2 < edge )
{
+ AF_LOG(( "BLUE: ASSERT FAILED for edge %d\n", edge2-edges ));
af_latin_align_linked_edge( hints, dim, edge2, edge );
edge->flags |= AF_EDGE_DONE;
continue;
@@ -1745,6 +1751,8 @@
else
edge->pos = FT_PIX_ROUND( edge->opos );
+ AF_LOG(( "ANCHOR: edge %d (opos=%.2f) snapped to (%.2f)\n",
+ edge-edges, edge->opos/64., edge->pos/64. ));
anchor = edge;
edge->flags |= AF_EDGE_DONE;
@@ -1796,6 +1804,9 @@
edge->pos = cur_pos1 - cur_len / 2;
edge2->pos = cur_pos1 + cur_len / 2;
+ AF_LOG(( "STEM: %d (opos=%.2f) to %d (opos=%.2f) snapped to (%.2f) and (%.2f)\n",
+ edge-edges, edge->opos/64., edge2-edges, edge2->opos/64.,
+ edge->pos/64., edge2->pos/64. ));
}
else
{
@@ -1820,13 +1831,21 @@
edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
edge2->pos = edge->pos + cur_len;
+
+ AF_LOG(( "STEM: %d (opos=%.2f) to %d (opos=%.2f) snapped to (%.2f) and (%.2f)\n",
+ edge-edges, edge->opos/64., edge2-edges, edge2->opos/64.,
+ edge->pos/64., edge2->pos/64. ));
}
edge->flags |= AF_EDGE_DONE;
edge2->flags |= AF_EDGE_DONE;
if ( edge > edges && edge->pos < edge[-1].pos )
+ {
+ AF_LOG(( "BOUND: %d (pos=%.2f) to (%.2f)\n", edge-edges,
+ edge->pos/64., edge[-1].pos/64. ));
edge->pos = edge[-1].pos;
+ }
}
}
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index 01b4f57..3ff6e29 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -30,7 +30,9 @@
FT_ZERO( loader );
af_glyph_hints_init( &loader->hints, memory );
-
+#ifdef AF_DEBUG
+ _af_debug_hints = &loader->hints;
+#endif
return FT_GlyphLoader_New( memory, &loader->gloader );
}
@@ -71,6 +73,9 @@
loader->face = NULL;
loader->globals = NULL;
+#ifdef AF_DEBUG
+ _af_debug_hints = NULL;
+#endif
FT_GlyphLoader_Done( loader->gloader );
loader->gloader = NULL;
}
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index c94ee87..892fb2a 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -22,6 +22,8 @@
#ifdef AF_DEBUG
int _af_debug_disable_horz_hints;
int _af_debug_disable_vert_hints;
+ int _af_debug_disable_blue_hints;
+ void* _af_debug_hints;
#endif
#include FT_INTERNAL_OBJECTS_H
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index e5f4ea6..8f21709 100644
--- a/src/autofit/aftypes.h
+++ b/src/autofit/aftypes.h
@@ -63,6 +63,8 @@ FT_BEGIN_HEADER
extern int _af_debug_disable_horz_hints;
extern int _af_debug_disable_vert_hints;
+extern int _af_debug_disable_blue_hints;
+extern void* _af_debug_hints;
#else /* !AF_DEBUG */