Commit f45749b05b15062443008344a5c231da311c7b04

Werner Lemberg 2014-01-03T18:09:36

[autofit] Fix scaling of HarfBuzz shaping. * src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.

diff --git a/ChangeLog b/ChangeLog
index 1511c76..b5352e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-01-03  Werner Lemberg  <wl@gnu.org>
 
+	[autofit] Fix scaling of HarfBuzz shaping.
+
+	* src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.
+
+2014-01-03  Werner Lemberg  <wl@gnu.org>
+
 	[autofit] Better ftgrid support.
 
 	* src/autofit/afhints.c (af_glyph_hints_get_segment_offset): Add
diff --git a/src/autofit/hbshim.c b/src/autofit/hbshim.c
index aec545b..b352545 100644
--- a/src/autofit/hbshim.c
+++ b/src/autofit/hbshim.c
@@ -369,6 +369,8 @@
 
     if ( feature )
     {
+      FT_UInt  upem = metrics->globals->face->units_per_EM;
+
       hb_font_t*    font = metrics->globals->hb_font;
       hb_buffer_t*  buf  = hb_buffer_create();
 
@@ -379,6 +381,9 @@
       unsigned int          gcount;
 
 
+      /* we shape at a size of units per EM; this means font units */
+      hb_font_set_scale( font, upem, upem );
+
       /* XXX: is this sufficient for a single character of any script? */
       hb_buffer_set_direction( buf, HB_DIRECTION_LTR );
       hb_buffer_set_script( buf, scripts[style_class->script] );