[psaux] Fix CFF advance widths. (#52466) Glyph advance widths were being written to the new `PS_Decoder' but not saved to the underlying format specific decoder. This caused pure CFF fonts to have bad advance width. * include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width' field to pointer. Remove unused fields. * src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy to reference. Remove unused. * src/psaux/psft.c (cf2_setGlyphWidth): Update code.
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
diff --git a/ChangeLog b/ChangeLog
index cb8bd8a..d5fc9c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2017-11-22 Ewald Hew <ewaldhew@gmail.com>
+
+ [psaux] Fix CFF advance widths. (#52466)
+
+ Glyph advance widths were being written to the new `PS_Decoder' but not
+ saved to the underlying format specific decoder. This caused pure CFF
+ fonts to have bad advance width.
+
+ * include/freetype/internal/psaux.h (PS_Decoder): Change `glyph_width'
+ field to pointer.
+ Remove unused fields.
+ * src/psaux/psobjs.c (ps_decoder_init): Change `glyph_width' from copy
+ to reference.
+ Remove unused.
+ * src/psaux/psft.c (cf2_setGlyphWidth): Update code.
+
2017-11-15 Vlad Tsyrklevich <vtsyrklevich@google.com>
* include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type.
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index 26652f8..80c4465 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -614,10 +614,7 @@ FT_BEGIN_HEADER
CFF_SubFont current_subfont; /* for current glyph_index */
FT_Generic* cf2_instance;
- FT_Pos glyph_width;
- FT_Pos nominal_width;
-
- FT_Bool read_width;
+ FT_Pos* glyph_width;
FT_Bool width_only;
FT_Int num_hints;
diff --git a/src/psaux/psft.c b/src/psaux/psft.c
index 6c67276..0f9bdd9 100644
--- a/src/psaux/psft.c
+++ b/src/psaux/psft.c
@@ -95,7 +95,7 @@
FT_ASSERT( decoder );
- decoder->glyph_width = cf2_fixedToInt( width );
+ *decoder->glyph_width = cf2_fixedToInt( width );
}
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index a88bcb7..ee58199 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -2407,8 +2407,7 @@
ps_decoder->locals = cff_decoder->locals;
ps_decoder->locals_bias = cff_decoder->locals_bias;
- ps_decoder->glyph_width = cff_decoder->glyph_width;
- ps_decoder->nominal_width = cff_decoder->nominal_width;
+ ps_decoder->glyph_width = &cff_decoder->glyph_width;
ps_decoder->width_only = cff_decoder->width_only;
ps_decoder->hint_mode = cff_decoder->hint_mode;