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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
diff --git a/ChangeLog b/ChangeLog
index 8a2ac39..7074160 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/docs/CHANGES b/docs/CHANGES
index 4641bac..15ba669 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -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
diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c
index 2a30829..504f9d2 100644
--- 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 )
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 4b0aed8..89892df 100644
--- 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;
}
}
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 68b866a..a7f433a 100644
--- 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,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;