Set point size, not just pixel size, when creating HarfBuzz fonts for shaping

Otherwise HarfBuzz will fall back to using default font sizes, e.g. 12.0
in the CoreText backend.

hb_coretext_font_create() already does the right thing, but we're not using
that function, we create the hb_font_t ourselves in _hb_qt_font_create().

The mismatch didn't matter for vector-based fonts as the metrics (presumably)
scale linearly, but for bitmap-based font such as Emojis they don't, and
we ended up with advances that were way too large (increasingly so the
larger the font point size).

Change-Id: I4781dda965c745853732026da91590d8506ec3f5
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
bb10
Tor Arne Vestbø 2018-12-14 12:55:04 +01:00
parent 1f30434356
commit ae825a48dc
1 changed files with 2 additions and 0 deletions

View File

@ -689,6 +689,8 @@ _hb_qt_font_create(QFontEngine *fe)
hb_font_set_scale(font, QFixed(x_ppem).value(), -QFixed(y_ppem).value());
hb_font_set_ppem(font, x_ppem, y_ppem);
hb_font_set_ptem(font, fe->fontDef.pointSize);
return font;
}