Freetype: adjust underlinePosition to match our expectations
We expect underlinePosition() to be the topleft corner of where we start drawing the underline but freetype reports the _center_ of the underline: "underline_position: [...]. It is the center of the underlining stem." - https://freetype.org/freetype2/docs/reference/ft2-base_interface.html Fixes: QTBUG-62602 Change-Id: I96808816f50f3f37b18f579adf285502c88e6ea5 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 0062f5a2089f9654c8880087ac6fb0b46a90bef2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2a36dbce7d
commit
86a89417ab
@ -758,7 +758,8 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format,
|
||||
}
|
||||
// underline metrics
|
||||
line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));
|
||||
underline_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale));
|
||||
QFixed center_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale));
|
||||
underline_position = center_position - line_thickness / 2;
|
||||
} else {
|
||||
// ad hoc algorithm
|
||||
int score = fontDef.weight * fontDef.pixelSize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user