[ft] Don't set font ppem
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 29 Dec 2014 02:56:15 +0000 (18:56 -0800)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 29 Dec 2014 02:56:15 +0000 (18:56 -0800)
For discussion see:

  http://lists.freedesktop.org/archives/harfbuzz/2012-April/001905.html

Over time we have had added NO_HINTING all over the place in hb-ft.  Finish it off.
Not setting ppem on hb-font disables get_contour_point() calls which is good anyway.

See comments in the commit.

src/hb-ft.cc

index 9b2a908..883f26f 100644 (file)
  *     In particular, FT_Get_Advance() without the NO_HINTING flag seems to be
  *     buggy.
  *
+ *     FreeType works in 26.6 mode.  Clients can decide to use that mode, and everything
+ *     would work fine.  However, we also abuse this API for performing in font-space,
+ *     but don't pass the correct flags to FreeType.  We just abuse the no-hinting mode
+ *     for that, such that no rounding etc happens.  As such, we don't set ppem, and
+ *     pass NO_HINTING around.  This seems to work best, until we go ahead and add a full
+ *     load_flags API.
+ *
  *   - We don't handle / allow for emboldening / obliqueing.
  *
  *   - In the future, we should add constructors to create fonts in font space?
@@ -430,9 +437,11 @@ hb_ft_font_create (FT_Face           ft_face,
   hb_font_set_scale (font,
                     (int) (((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16),
                     (int) (((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16));
+#if 0 /* hb-ft works in no-hinting model */
   hb_font_set_ppem (font,
                    ft_face->size->metrics.x_ppem,
                    ft_face->size->metrics.y_ppem);
+#endif
 
   return font;
 }