[HarfBuzz] hb-shape and FreeType hinting mode, subpixel results?

Werner LEMBERG wl at gnu.org
Thu May 18 10:05:16 UTC 2017


Hello Dominik!


> We have a Chromium issue where the text "We'll email the promo code
> to you. Enter it in your cart to apply" renders wider after FreeType
> commit bcc74f4dafee25e [truetype] Allow linear scaling for unhinted
> rendering (#50470). - I have not exactly identified in which way it
> is wider, whether it's changes in glyph advances or actually also
> changes in glyph rendering width due to hinting.

You could set

  FT2_DEBUG=any:7

in the environment and compare the log output (provided you've
activated debugging output).

> The font size in the original page is 13.3px - is 40/3 a valid way
> to specify this font size?

I don't know whether HarfBuzz allows fractional pixel values.  In
FreeType it doesn't work.  Instead, you have to specify an (integer)
resolution and a (fractional) point size to a fractional PPEM value.
Mainly for historical reasons, FreeType always reports integer PPEM
values, even if the current scaling would corresponds to a fractional
PPEM value.

Note that native TrueType hinting *only* works for integer PPEM
values!  If necessary, FreeType adjust scaling values to get an
integer PPEM value.


    Werner


More information about the HarfBuzz mailing list