better handling of serif segments in the Latin auto-fitter, gets rid of

broken "9" in Arial 9pt/96dpi
This commit is contained in:
David Turner 2007-02-12 22:33:48 +00:00
parent c6a14086d2
commit a6bdb667d9
2 changed files with 32 additions and 7 deletions

View File

@ -8,7 +8,25 @@
2007-02-12 David Turner <david@freetype.org> 2007-02-12 David Turner <david@freetype.org>
Simplify projection and dual-projection code interface. * src/autofit/aflatin.c: slight optimization of the segment linker
and better handling of serif segments to get rid of broken "9" in
Arial 9 pts (96dpi)
* src/autofit/afloader.c: improve spacing adjustments for the
non-light auto-hinted modes. Gets rid of "inter-letter spacing
is too wide"
* src/truetype/ttinterp.h, src/truetype/ttinterp.c: simplify
projection and dual-projection code interface
* include/freetype/internal/ftmemory.h, src/base/ftutils.c,
src/bfd/bfddrivr.c, src/bdf/bdflib.c, src/pcf/pcfread.c,
src/cff/cffdrivr.c, src/cff/cffload.c, src/cff/cffobjs.c,
src/sfnt/sfdriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:
introduce ft_mem_strdup, ft_mem_dup, ft_mem_strcpyn and the
corresponding macros, and modify code to use them. This is to
get rid of various uses of strcpy and other "evil" functions,
as well as simplify a few things
* src/truetype/ttinterp.h (TT_Project_Func): Use `FT_Pos', not * src/truetype/ttinterp.h (TT_Project_Func): Use `FT_Pos', not
FT_Vector' as argument type. FT_Vector' as argument type.
@ -44,6 +62,7 @@
src/sfnt/sfdriver.c (sfnt_get_glyph_name), src/type1/t1driver.c src/sfnt/sfdriver.c (sfnt_get_glyph_name), src/type1/t1driver.c
(t1_get_glyph_name), src/type42/t42drivr.c (t42_get_glyph_name, (t1_get_glyph_name), src/type42/t42drivr.c (t42_get_glyph_name,
t42_get_name_index): Use new functions and simplify code. t42_get_name_index): Use new functions and simplify code.
>>>>>>> 1.1522
* builds/mac/ftmac.c (FT_FSPathMakeSpec): Don't use FT_MIN. * builds/mac/ftmac.c (FT_FSPathMakeSpec): Don't use FT_MIN.

View File

@ -923,11 +923,11 @@
{ {
/* the fake segments are introduced to hint the metrics -- */ /* the fake segments are introduced to hint the metrics -- */
/* we must never link them to anything */ /* we must never link them to anything */
if ( seg1->first == seg1->last || seg1->dir != major_dir ) if ( seg1->first == seg1->last )
continue; continue;
for ( seg2 = segments; seg2 < segment_limit; seg2++ ) for ( seg2 = seg1+1; seg2 < segment_limit; seg2++ )
if ( seg2 != seg1 && seg1->dir + seg2->dir == 0 ) if ( seg1->dir + seg2->dir == 0 )
{ {
FT_Pos pos1 = seg1->pos; FT_Pos pos1 = seg1->pos;
FT_Pos pos2 = seg2->pos; FT_Pos pos2 = seg2->pos;
@ -935,7 +935,7 @@
if ( dist < 0 ) if ( dist < 0 )
continue; dist = -dist;
{ {
FT_Pos min = seg1->min_coord; FT_Pos min = seg1->min_coord;
@ -1020,7 +1020,7 @@
* corresponding threshold in font units. * corresponding threshold in font units.
*/ */
if ( dim == AF_DIMENSION_HORZ ) if ( dim == AF_DIMENSION_HORZ )
segment_length_threshold = FT_DivFix( 96, hints->y_scale ); segment_length_threshold = FT_DivFix( 64, hints->y_scale );
else else
segment_length_threshold = 0; segment_length_threshold = 0;
@ -1057,6 +1057,12 @@
if ( seg->height < segment_length_threshold ) if ( seg->height < segment_length_threshold )
continue; continue;
/* a special case for serif edges, if they're smaller than 1.5
* pixels, we ignore them
*/
if ( seg->serif && 2*seg->height < 3*segment_length_threshold )
continue;
/* look for an edge corresponding to the segment */ /* look for an edge corresponding to the segment */
for ( ee = 0; ee < axis->num_edges; ee++ ) for ( ee = 0; ee < axis->num_edges; ee++ )
{ {
@ -2139,7 +2145,7 @@
for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ )
{ {
#ifdef AF_USE_WARPER #ifdef AF_USE_WARPER
if ( ( dim == AF_DIMENSION_HORZ && if ( ( dim == AF_DIMENSION_HORZ &&
metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) ) metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) )
{ {
AF_WarperRec warper; AF_WarperRec warper;