diff --git a/ChangeLog b/ChangeLog index bc1f49a22..201f1ebe5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-11-02 David Turner + + * 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 * src/cff/cffload.c (cff_encoding_load): Remove unused variable. diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index 6b3a31015..4539590a5 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 66078fd18..6e0e4154e 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 48c36b26a..48dc8131e 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 01b4f5730..3ff6e29c0 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 c94ee875b..892fb2a09 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 e5f4ea6a8..8f2170932 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 */