freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 53059f9: [sfnt] Fix `FT_Get_Advance' for bitmap strik


From: Werner LEMBERG
Subject: [freetype2] master 53059f9: [sfnt] Fix `FT_Get_Advance' for bitmap strikes.
Date: Sun, 7 Aug 2016 07:02:00 +0000 (UTC)

branch: master
commit 53059f92d6109cd427903ded1914bc2057ec78ae
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [sfnt] Fix `FT_Get_Advance' for bitmap strikes.
    
    `FT_Get_Advance' returns 0 for bitmap fonts.  It first gets the
    advance value from the font table and then scales it by the
    `font->size->metrics->x_scale' field.  But `FT_Select_Size' doesn't
    set that value for bitmap fonts and the advance gets scaled to zero.
    
    Taken from
    
      https://github.com/behdad/harfbuzz/issues/252
    
    * src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
    <TT_SBIT_TABLE_TYPE_EBLC>: Set scale values.
---
 ChangeLog         |   18 +++++++++++++++++-
 src/sfnt/ttsbit.c |   10 ++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 130c1ee..690fa29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,20 @@
-2016-07-16  Behdad Esfahbod  <address@hidden>
+2016-08-06  Jon Spencer  <address@hidden>
+
+       [sfnt] Fix `FT_Get_Advance' for bitmap strikes.
+
+       `FT_Get_Advance' returns 0 for bitmap fonts.  It first gets the
+       advance value from the font table and then scales it by the
+       `font->size->metrics->x_scale' field.  But `FT_Select_Size' doesn't
+       set that value for bitmap fonts and the advance gets scaled to zero.
+
+       Taken from
+
+         https://github.com/behdad/harfbuzz/issues/252
+
+       * src/sfnt/ttsbit.c (tt_face_load_strike_metrics)
+       <TT_SBIT_TABLE_TYPE_EBLC>: Set scale values.
+
+2016-08-06  Behdad Esfahbod  <address@hidden>
 
        [truetype] Fix GX variation handling of composites.
 
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index e24e7d6..82c8544 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -323,6 +323,16 @@
                                           strike[18] + /* max_width      */
                                  (FT_Char)strike[23]   /* min_advance_SB */
                                                      ) * 64;
+
+        /* 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 FT_Err_Ok;
       }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]