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>
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
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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
/* */
/* 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. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -188,29 +188,28 @@
FT_CALLBACK_DEF( FT_Error )
cff_get_advances( FT_Face ftface,
cff_get_advances( FT_Face face,
FT_UInt start,
FT_UInt count,
FT_Int32 flags,
FT_Fixed* advances )
{
CFF_Face face = (CFF_Face)ftface;
FT_UInt nn;
FT_Error error = CFF_Err_Ok;
FT_GlyphSlot slot = face->root.glyph;
FT_GlyphSlot slot = face->glyph;
flags |= FT_LOAD_ADVANCE_ONLY;
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 )
break;
advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? slot->advance.y
: slot->advance.x;
? slot->linearVertAdvance
: slot->linearHoriAdvance;
}
return error;