Fix Savannah bug #25669.

* src/base/ftadvanc.h (FT_Get_Advances): Fix serious typo.

* src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): Fix
scaling factor for non-scalable fonts.

* src/cff/cffdrivr.c (cff_get_advances): Use correct advance width
value to prevent incorrect scaling.

* docs/CHANGES: Document it.
This commit is contained in:
Werner Lemberg 2009-02-24 21:34:51 +00:00
parent 1e8599240f
commit 14de111f72
5 changed files with 32 additions and 16 deletions

View File

@ -1,3 +1,17 @@
2009-02-23 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #25669.
* src/base/ftadvanc.h (FT_Get_Advances): Fix serious typo.
* src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): Fix
scaling factor for non-scalable fonts.
* src/cff/cffdrivr.c (cff_get_advances): Use correct advance width
value to prevent incorrect scaling.
* docs/CHANGES: Document it.
2009-02-15 Matt Godbolt <matt@godbolt.org> 2009-02-15 Matt Godbolt <matt@godbolt.org>
Fix Savannah bug #25588. Fix Savannah bug #25588.

View File

@ -7,6 +7,9 @@ CHANGES BETWEEN 2.3.9 and 2.3.8
FreeType2 is built without Carbon framework, these fonts are not FreeType2 is built without Carbon framework, these fonts are not
handled correctly. Version 2.3.7 didn't have this bug. handled correctly. Version 2.3.7 didn't have this bug.
- `FT_Get_Advance' (and `FT_Get_Advances') returned bad values for
almost all font formats except TrueType fonts.
II. IMPORTANT CHANGES II. IMPORTANT CHANGES

View File

@ -4,7 +4,7 @@
/* */ /* */
/* Quick computation of advance widths (body). */ /* Quick computation of advance widths (body). */
/* */ /* */
/* Copyright 2008 by */ /* Copyright 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -42,8 +42,8 @@
else else
scale = face->size->metrics.x_scale; scale = face->size->metrics.x_scale;
/* this must be the same computation as to get linearHori/VertAdvance */ /* this must be the same scaling as to get linear{Hori,Vert}Advance */
/* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c */ /* (see `FT_Load_Glyph' implementation in src/base/ftobjs.c) */
for ( nn = 0; nn < count; nn++ ) for ( nn = 0; nn < count; nn++ )
advances[nn] = FT_MulDiv( advances[nn], scale, 64 ); advances[nn] = FT_MulDiv( advances[nn], scale, 64 );
@ -148,8 +148,8 @@
break; break;
padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? face->glyph->advance.x ? face->glyph->advance.y
: face->glyph->advance.y; : face->glyph->advance.x;
} }
if ( error ) if ( error )

View File

@ -2454,8 +2454,8 @@
} }
else else
{ {
metrics->x_scale = 1L << 22; metrics->x_scale = 1L << 16;
metrics->y_scale = 1L << 22; metrics->y_scale = 1L << 16;
metrics->ascender = bsize->y_ppem; metrics->ascender = bsize->y_ppem;
metrics->descender = 0; metrics->descender = 0;
metrics->height = bsize->height << 6; metrics->height = bsize->height << 6;
@ -2566,8 +2566,8 @@
else else
{ {
FT_ZERO( metrics ); FT_ZERO( metrics );
metrics->x_scale = 1L << 22; metrics->x_scale = 1L << 16;
metrics->y_scale = 1L << 22; metrics->y_scale = 1L << 16;
} }
} }

View File

@ -4,7 +4,7 @@
/* */ /* */
/* OpenType font driver implementation (body). */ /* OpenType font driver implementation (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -188,29 +188,28 @@
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
cff_get_advances( FT_Face ftface, cff_get_advances( FT_Face face,
FT_UInt start, FT_UInt start,
FT_UInt count, FT_UInt count,
FT_Int32 flags, FT_Int32 flags,
FT_Fixed* advances ) FT_Fixed* advances )
{ {
CFF_Face face = (CFF_Face)ftface;
FT_UInt nn; FT_UInt nn;
FT_Error error = CFF_Err_Ok; FT_Error error = CFF_Err_Ok;
FT_GlyphSlot slot = face->root.glyph; FT_GlyphSlot slot = face->glyph;
flags |= FT_LOAD_ADVANCE_ONLY; flags |= FT_LOAD_ADVANCE_ONLY;
for ( nn = 0; nn < count; nn++ ) for ( nn = 0; nn < count; nn++ )
{ {
error = Load_Glyph( slot, face->root.size, start+nn, flags ); error = Load_Glyph( slot, face->size, start + nn, flags );
if ( error ) if ( error )
break; break;
advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? slot->advance.y ? slot->linearVertAdvance
: slot->advance.x; : slot->linearHoriAdvance;
} }
return error; return error;