shithub: freetype+ttf2subf

Download patch

ref: f45749b05b15062443008344a5c231da311c7b04
parent: ea0367fbfeee863ef635ac3d427738ba63864e2d
author: Werner Lemberg <[email protected]>
date: Fri Jan 3 13:09:36 EST 2014

[autofit] Fix scaling of HarfBuzz shaping.

* src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-01-03  Werner Lemberg  <[email protected]>
 
+	[autofit] Fix scaling of HarfBuzz shaping.
+
+	* src/autofit/hbshim.c (af_get_char_index): Scale to units per EM.
+
+2014-01-03  Werner Lemberg  <[email protected]>
+
 	[autofit] Better ftgrid support.
 
 	* src/autofit/afhints.c (af_glyph_hints_get_segment_offset): Add
--- 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();
 
@@ -378,6 +380,9 @@
       hb_glyph_position_t*  gpos;
       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 );