Commit 5efda13f60d5845d5df6437f2b8d3f55898393fe

Werner Lemberg 2017-05-15T21:26:01

[sfnt] Return proper scaling values for SBIX bitmaps. Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>. * src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it.

diff --git a/ChangeLog b/ChangeLog
index ad8ef95..c784122 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2017-05-15  Werner Lemberg  <wl@gnu.org>
 
+	[sfnt] Return proper scaling values for SBIX bitmaps.
+
+	Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.
+
+	* src/sfnt/ttsbit.c (tt_face_load_strike_metrics): Implement it.
+
+2017-05-15  Werner Lemberg  <wl@gnu.org>
+
 	[truetype] Fix error handling for embedded bitmaps.
 
 	Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 0c76a55..59b2168 100644
--- 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;
       }