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

Dominik Röttsches drott at google.com
Thu May 18 08:27:33 UTC 2017

Hi Behdad & others,

I am not sure whether my question is ill-posed due to what we discussed
regarding scaling and HarfBuzz running resolution unaware but let me
explain what I am trying to do.

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.

I am trying to reproduce this in HarfBuzz plus FreeType by linking HarfBuzz
against FreeType before and after this commit, using

$ FREETYPE_LIBS="-L$PWD/../freetype2/objs/.libs/ -lfreetype"
FREETYPE_CFLAGS="-I$PWD/../freetype2/include/"  ./configure
$ make

And then running hb-shape
$ util/hb-shape ../freetype2-demos/Roboto-Regular.ttf --font-size=40/3
 --show-extents "We'll email the promo code to you. Enter it in your cart
to apply"

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

I would expect the results of before and after the commit to differ if I
managed to reproduce this is in HarfBuzz, but the results are the same.

Hence my question: Which hinting mode in FreeType is hb-shape activating,
if any, and how can I control it?

Is my understanding correct that hb-shape would never output fractional
values due to the way the scaling works, and fractional values for subpixel
placement would only be calculated by division in the client using HarfBuzz

If I can't reproduce this way, it might be a difference in our Skia based
hb_font_funcs, I guess?

Thanks in advance for your help,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20170518/f486245e/attachment.html>

More information about the HarfBuzz mailing list