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 Pick-to: 6.2 5.15 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>bb10
parent
022891bcd8
commit
0062f5a208
|
|
@ -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…
Reference in New Issue