diff --git a/ChangeLog b/ChangeLog index 24d0e5fd..2a7dc8b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,29 @@ +2011-04-21 Behdad Esfahbod + + Always ignore global advance. + + This makes FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH redundant, + deprecated, and ignored. The new behavior is what every major user + of FreeType has been requesting. Global advance is broken in many + CJK fonts. Just ignoring it by default makes most sense. + + * src/truetype/ttdriver.c (tt_get_advances), + src/truetype/ttgload.c (TT_Get_HMetrics, TT_Get_VMetrics, + tt_get_metrics, compute_glyph_metrics, TT_Load_Glyph), + src/truetype/ttgload.h: Implement it. + + * docs/CHANGES: Updated. + 2011-04-21 rainy6144 [autofit] Blur CJK stems if too many to preserve their gaps. + When there are too many stems to preserve their gaps in the rasterization of CJK Ideographs at a low resolution, blur the stems instead of showing clumped stems. See http://lists.gnu.org/archive/html/freetype-devel/2011-02/msg00011.html http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00046.html - for detail. + for details. * src/autofit/afcjk.c (af_cjk_hint_edges): Store the position of the previous stem by `has_last_stem' and `last_stem_pos', and skip diff --git a/builds/unix/install-sh b/builds/unix/install-sh old mode 100644 new mode 100755 index a5897de6..6781b987 --- a/builds/unix/install-sh +++ b/builds/unix/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2006-12-25.00 +scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -515,5 +515,6 @@ done # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" # End: diff --git a/docs/CHANGES b/docs/CHANGES index 61442ecc..3303a174 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -12,6 +12,10 @@ CHANGES BETWEEN 2.4.4 and 2.4.5 the autohinter if a TrueType based font doesn't contain native hints. + - The load flag FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH has been made + redundant and is simply ignored; this means that FreeType now + ignores the global advance width value in TrueType fonts. + III. MISCELLANEOUS diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index b9e34e25..39566762 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2444,13 +2444,7 @@ FT_BEGIN_HEADER * in fonts. By default, FreeType tries to handle broken fonts also. * * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: - * Indicates that the font driver should ignore the global advance - * width defined in the font. By default, that value is used as the - * advance width for all glyphs when the face has - * @FT_FACE_FLAG_FIXED_WIDTH set. - * - * This flag exists for historical reasons (to support buggy CJK - * fonts). + * Ignored. Deprecated. * * FT_LOAD_NO_RECURSE :: * This flag is only used internally. It merely indicates that the diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index d723b57a..66061fd3 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -4,8 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 */ -/* 2010 by */ +/* Copyright 1996-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -135,8 +134,6 @@ { FT_UInt nn; TT_Face face = (TT_Face) ttface; - FT_Bool check = FT_BOOL( - !( flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) ); /* XXX: TODO: check for sbits */ @@ -149,7 +146,7 @@ FT_UShort ah; - TT_Get_VMetrics( face, start + nn, check, &tsb, &ah ); + TT_Get_VMetrics( face, start + nn, &tsb, &ah ); advances[nn] = ah; } } @@ -161,7 +158,7 @@ FT_UShort aw; - TT_Get_HMetrics( face, start + nn, check, &lsb, &aw ); + TT_Get_HMetrics( face, start + nn, &lsb, &aw ); advances[nn] = aw; } } diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index b2cab012..f35521e1 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -65,22 +65,16 @@ /*************************************************************************/ /* */ - /* Returns the horizontal metrics in font units for a given glyph. If */ - /* `check' is true, take care of monospaced fonts by returning the */ - /* advance width maximum. */ + /* Return the horizontal metrics in font units for a given glyph. */ /* */ FT_LOCAL_DEF( void ) TT_Get_HMetrics( TT_Face face, FT_UInt idx, - FT_Bool check, FT_Short* lsb, FT_UShort* aw ) { ( (SFNT_Service)face->sfnt )->get_metrics( face, 0, idx, lsb, aw ); - if ( check && face->postscript.isFixedPitch ) - *aw = face->horizontal.advance_Width_Max; - FT_TRACE5(( " advance width (font units): %d\n", *aw )); FT_TRACE5(( " left side bearing (font units): %d\n", *lsb )); } @@ -88,7 +82,7 @@ /*************************************************************************/ /* */ - /* Returns the vertical metrics in font units for a given glyph. */ + /* Return the vertical metrics in font units for a given glyph. */ /* Greg Hitchcock from Microsoft told us that if there were no `vmtx' */ /* table, typoAscender/Descender from the `OS/2' table would be used */ /* instead, and if there were no `OS/2' table, use ascender/descender */ @@ -96,18 +90,12 @@ /* apparently does: It uses the ppem value as the advance height, and */ /* sets the top side bearing to be zero. */ /* */ - /* The monospace `check' is probably not meaningful here, but we leave */ - /* it in for a consistent interface. */ - /* */ FT_LOCAL_DEF( void ) TT_Get_VMetrics( TT_Face face, FT_UInt idx, - FT_Bool check, FT_Short* tsb, FT_UShort* ah ) { - FT_UNUSED( check ); - if ( face->vertical_info ) ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, idx, tsb, ah ); @@ -150,13 +138,9 @@ TT_Get_HMetrics( face, glyph_index, - (FT_Bool)!( loader->load_flags & - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ), &left_bearing, &advance_width ); TT_Get_VMetrics( face, glyph_index, - (FT_Bool)!( loader->load_flags & - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ), &top_bearing, &advance_height ); @@ -1655,23 +1639,7 @@ /* get the device-independent horizontal advance; it is scaled later */ /* by the base layer. */ - { - FT_Pos advance = loader->linear; - - - /* the flag FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH was introduced to */ - /* correctly support DynaLab fonts, which have an incorrect */ - /* `advance_Width_Max' field! It is used, to my knowledge, */ - /* exclusively in the X-TrueType font server. */ - /* */ - if ( face->postscript.isFixedPitch && - ( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 ) - advance = face->horizontal.advance_Width_Max; - - /* we need to return the advance in font units in linearHoriAdvance, */ - /* it will be scaled later by the base layer. */ - glyph->linearHoriAdvance = advance; - } + glyph->linearHoriAdvance = loader->linear; glyph->metrics.horiBearingX = bbox.xMin; glyph->metrics.horiBearingY = bbox.yMax; @@ -2049,9 +2017,6 @@ glyph->linearHoriAdvance = loader.linear; glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax - loader.vadvance; - if ( face->postscript.isFixedPitch && - ( load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 ) - glyph->linearHoriAdvance = face->horizontal.advance_Width_Max; } return TT_Err_Ok; diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h index 958d67d2..05f75882 100644 --- a/src/truetype/ttgload.h +++ b/src/truetype/ttgload.h @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ +/* Copyright 1996-2006, 2008, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -37,14 +37,12 @@ FT_BEGIN_HEADER FT_LOCAL( void ) TT_Get_HMetrics( TT_Face face, FT_UInt idx, - FT_Bool check, FT_Short* lsb, FT_UShort* aw ); FT_LOCAL( void ) TT_Get_VMetrics( TT_Face face, FT_UInt idx, - FT_Bool check, FT_Short* tsb, FT_UShort* ah );