[autofit] Beautify blue zone tracing.

* src/autofit/aflatin.c (af_latin_metrics_init_blues),
src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Implement it.
This commit is contained in:
Werner Lemberg 2012-07-04 13:00:06 +02:00
parent 2a9c4552f6
commit 09e9b59605
3 changed files with 37 additions and 23 deletions

View File

@ -1,3 +1,10 @@
2012-07-04 Werner Lemberg <wl@gnu.org>
[autofit] Beautify blue zone tracing.
* src/autofit/aflatin.c (af_latin_metrics_init_blues),
src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Implement it.
2012-07-03 Werner Lemberg <wl@gnu.org>
[autofit] Quantize stem widths.

View File

@ -205,8 +205,8 @@
/* `af_latin_blue_chars[blues]' string, then finding its top-most or */
/* bottom-most points (depending on `AF_IS_TOP_BLUE') */
FT_TRACE5(( "blue zones computation\n" ));
FT_TRACE5(( "------------------------------------------------\n" ));
FT_TRACE5(( "blue zones computation\n"
"======================\n\n" ));
for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ )
{
@ -216,7 +216,7 @@
FT_Pos* blue_shoot;
FT_TRACE5(( "blue %3d: ", bb ));
FT_TRACE5(( "blue zone %d:\n", bb ));
num_flats = 0;
num_rounds = 0;
@ -230,8 +230,6 @@
FT_Bool round = 0;
FT_TRACE5(( "'%c'", *p ));
/* load the character in the face -- skip unknown or empty ones */
glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p );
if ( glyph_index == 0 )
@ -295,7 +293,7 @@
best_last = last;
}
}
FT_TRACE5(( "%5d", best_y ));
FT_TRACE5(( " %c %d", *p, best_y ));
}
/* now check whether the point belongs to a straight or round */
@ -343,7 +341,7 @@
FT_CURVE_TAG( glyph->outline.tags[prev] ) != FT_CURVE_TAG_ON ||
FT_CURVE_TAG( glyph->outline.tags[next] ) != FT_CURVE_TAG_ON );
FT_TRACE5(( "%c ", round ? 'r' : 'f' ));
FT_TRACE5(( " (%s)\n", round ? "round" : "flat" ));
}
if ( round )
@ -352,15 +350,13 @@
flats[num_flats++] = best_y;
}
FT_TRACE5(( "\n" ));
if ( num_flats == 0 && num_rounds == 0 )
{
/*
* we couldn't find a single glyph to compute this blue zone,
* we will simply ignore it then
*/
FT_TRACE5(( "empty\n" ));
FT_TRACE5(( " empty\n" ));
continue;
}
@ -403,8 +399,13 @@
if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref )
{
*blue_ref =
*blue_shoot = ( shoot + ref ) / 2;
FT_TRACE5(( " [overshoot smaller than reference,"
" taking mean value]\n" ));
}
}
blue->flags = 0;
@ -419,7 +420,9 @@
if ( bb == AF_LATIN_BLUE_SMALL_TOP )
blue->flags |= AF_LATIN_BLUE_ADJUSTMENT;
FT_TRACE5(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot ));
FT_TRACE5(( " -> reference = %ld\n"
" overshoot = %ld\n",
*blue_ref, *blue_shoot ));
}
FT_TRACE5(( "\n" ));

View File

@ -198,8 +198,8 @@
/* 'af_latin2_blue_chars[blues]' string, then compute its top-most or */
/* bottom-most points (depending on `AF_IS_TOP_BLUE') */
FT_TRACE5(( "blue zones computation\n" ));
FT_TRACE5(( "------------------------------------------------\n" ));
FT_TRACE5(( "blue zones computation\n"
"======================\n\n" ));
for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ )
{
@ -209,7 +209,7 @@
FT_Pos* blue_shoot;
FT_TRACE5(( "blue %3d: ", bb ));
FT_TRACE5(( "blue zone %d:\n", bb ));
num_flats = 0;
num_rounds = 0;
@ -222,8 +222,6 @@
FT_Bool round;
FT_TRACE5(( "'%c'", *p ));
/* load the character in the face -- skip unknown or empty ones */
glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p );
if ( glyph_index == 0 )
@ -285,7 +283,7 @@
best_last = last;
}
}
FT_TRACE5(( "%5d", best_y ));
FT_TRACE5(( " %c %d", *p, best_y ));
}
/* now check whether the point belongs to a straight or round */
@ -333,7 +331,7 @@
FT_CURVE_TAG( glyph->outline.tags[start] ) != FT_CURVE_TAG_ON ||
FT_CURVE_TAG( glyph->outline.tags[ end ] ) != FT_CURVE_TAG_ON );
FT_TRACE5(( "%c ", round ? 'r' : 'f' ));
FT_TRACE5(( " (%s)\n", round ? "round" : "flat" ));
}
if ( round )
@ -342,15 +340,13 @@
flats[num_flats++] = best_y;
}
FT_TRACE5(( "\n" ));
if ( num_flats == 0 && num_rounds == 0 )
{
/*
* we couldn't find a single glyph to compute this blue zone,
* we will simply ignore it then
*/
FT_TRACE5(( "empty\n" ));
FT_TRACE5(( " empty\n" ));
continue;
}
@ -393,7 +389,13 @@
if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref )
*blue_shoot = *blue_ref = ( shoot + ref ) / 2;
{
*blue_ref =
*blue_shoot = ( shoot + ref ) / 2;
FT_TRACE5(( " [overshoot smaller than reference,"
" taking mean value]\n" ));
}
}
blue->flags = 0;
@ -408,7 +410,9 @@
if ( bb == AF_LATIN_BLUE_SMALL_TOP )
blue->flags |= AF_LATIN_BLUE_ADJUSTMENT;
FT_TRACE5(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot ));
FT_TRACE5(( " -> reference = %ld\n"
" overshoot = %ld\n",
*blue_ref, *blue_shoot ));
}
return;