- fixed a bug in af_compute_direction which generated ugly glyphs

- added more debug/log messages to help improve the auto-fitter
This commit is contained in:
David Turner 2006-11-02 16:37:35 +00:00
parent 950c5d2f07
commit 4060474815
7 changed files with 43 additions and 4 deletions

View File

@ -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.

View File

@ -311,7 +311,7 @@
}
ss *= 12;
if ( ll <= FT_ABS( ss ) )
if ( FT_ABS(ll) <= FT_ABS(ss) )
dir = AF_DIR_NONE;
return dir;

View File

@ -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 */

View File

@ -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;
}
}
}

View File

@ -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;
}

View File

@ -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

View File

@ -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 */