shithub: freetype+ttf2subf

Download patch

ref: b9bd2d14e2836122028b4f41eee937fc31e6b93c
parent: 954710ddd756733b851c0d2e472b93cbb9a6a44a
author: Ewald Hew <[email protected]>
date: Wed Nov 22 07:32:47 EST 2017

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

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2017-11-22  Ewald Hew  <[email protected]>
+
+	[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  <[email protected]>
 
 	* include/freetype/ftrender.h: Fix `FT_Renderer_RenderFunc' type.
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -614,10 +614,7 @@
     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;
 
--- 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 );
   }
 
 
--- 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;