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.
This commit is contained in:
parent
a345c0e1d5
commit
8c82ec5b17
19
ChangeLog
19
ChangeLog
|
@ -1,12 +1,29 @@
|
|||
2011-04-21 Behdad Esfahbod <behdad@behdad.org>
|
||||
|
||||
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 <rainy6144@gmail.com>
|
||||
|
||||
[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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue