[autofit] Fix scaling of HarfBuzz shaping. * src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
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] );