shithub: freetype+ttf2subf

Download patch

ref: 5efda13f60d5845d5df6437f2b8d3f55898393fe
parent: 6e5445a232cbdbf18a45629cf2f12a81c043607f
author: Werner Lemberg <[email protected]>
date: Mon May 15 17:26:01 EDT 2017

[sfnt] Return proper scaling values for SBIX bitmaps.

Problem reported by Hin-Tak Leung <[email protected]>.

* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2017-05-15  Werner Lemberg  <[email protected]>
 
+	[sfnt] Return proper scaling values for SBIX bitmaps.
+
+	Problem reported by Hin-Tak Leung <[email protected]>.
+
+	* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it.
+
+2017-05-15  Werner Lemberg  <[email protected]>
+
 	[truetype] Fix error handling for embedded bitmaps.
 
 	Problem reported by Hin-Tak Leung <[email protected]>.
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -448,6 +448,15 @@
         metrics->max_advance =
           FT_MulDiv( hori->advance_Width_Max, ppem_ * 64, upem );
 
+        /* set the scale values (in 16.16 units) so advances */
+        /* from the hmtx and vmtx table are scaled correctly */
+        metrics->x_scale = FT_MulDiv( metrics->x_ppem,
+                                      64 * 0x10000,
+                                      face->header.Units_Per_EM );
+        metrics->y_scale = FT_MulDiv( metrics->y_ppem,
+                                      64 * 0x10000,
+                                      face->header.Units_Per_EM );
+
         return error;
       }