ref: 14de111f72119fb19de8e88f79116578adb97df0
parent: 1e8599240fd07cbba9c87f90e40f7914893abc6e
author: Werner Lemberg <[email protected]>
date: Tue Feb 24 16:34:51 EST 2009
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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2009-02-23 Werner Lemberg <[email protected]>
+
+ 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 <[email protected]>
Fix Savannah bug #25588.
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -7,6 +7,9 @@
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
--- a/src/base/ftadvanc.c
+++ b/src/base/ftadvanc.c
@@ -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 )
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -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;
}
}
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -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,16 +188,15 @@
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;
@@ -204,13 +203,13 @@
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;