Fix kerning with fractional pixel size
Since most of our APIs for pixel size are integer-based, we would assume it was when passing it to Harfbuzz. But QRawFont (and the internal APIs in Qt and Harfbuzz) support floating point pixel sizes. The result would be that setting e.g. pixel size 20.25 would give the same glyph positions as 20.75, but the glyphs would be some fraction of a pixel larger. Using floats instead should have no impact on the common case where the pixel size is an integer, but it should also enable the other case, where QRawFont is used (or potentially future APIs that do not have the integer limitation.) [ChangeLog][QtGui][Text] Fixed a problem where pixel sizes would be truncated before calculating glyph positions. Fixes: QTBUG-67091 Change-Id: Ib066b1330ddcf52d4b344412e350aa9a60c847ff Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
8e8b50b061
commit
e193459877
@ -695,12 +695,12 @@ _hb_qt_font_create(QFontEngine *fe)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const int y_ppem = fe->fontDef.pixelSize;
|
||||
const int x_ppem = (fe->fontDef.pixelSize * fe->fontDef.stretch) / 100;
|
||||
const qreal y_ppem = fe->fontDef.pixelSize;
|
||||
const qreal x_ppem = (fe->fontDef.pixelSize * fe->fontDef.stretch) / 100.0;
|
||||
|
||||
hb_font_set_funcs(font, hb_qt_get_font_funcs(), (void *)fe, NULL);
|
||||
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_scale(font, QFixed::fromReal(x_ppem).value(), -QFixed::fromReal(y_ppem).value());
|
||||
hb_font_set_ppem(font, int(x_ppem), int(y_ppem));
|
||||
|
||||
hb_font_set_ptem(font, fe->fontDef.pointSize);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user