windows: Fix vertical metrics with GDI engine
In Qt 6 we consolidated vertical font metrics across all platforms (see f761ad3cd9ad1252f24b76ae413298dc7bed8af3 and follow-ups). However, a couple mistakes were made. First of all, when we use the winAscent/winDescent values from the OS/2 table, we would also set the leading to the line gap value from the HHEA table. However, the line gap is actually built into the winAscent/winDescent, so we ended up adding this twice to the line spacing, increasing it with some older fonts. When using the Windows legacy metrics, we now set the line gap to 0 instead to reflect that this is baked into the height. In addition, since we now calculate the values ourselves, we would not round them to nearest integer like the GDI engine does. We now round these values to make it clear that the GDI engine does not support any fractional metrics. [ChangeLog][Windows][Text] Fixed an issue where the line gap of some fonts would be included twice in the font's leading. Fixes: QTBUG-109400 Change-Id: I02ab7447b5e82d9f4474f9bca581f82acee85ff3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 8892819d0c89d0434c94f0c0951458719cba5c2e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
7f5c5eb9c0
commit
81f1611cc8
@ -416,6 +416,12 @@ void QFontEngine::initializeHeightMetrics() const
|
||||
|
||||
// Allow OS/2 metrics to override if present
|
||||
processOS2Table();
|
||||
|
||||
if (!supportsSubPixelPositions()) {
|
||||
m_ascent = m_ascent.round();
|
||||
m_descent = m_descent.round();
|
||||
m_leading = m_leading.round();
|
||||
}
|
||||
}
|
||||
|
||||
m_heightMetricsQueried = true;
|
||||
@ -448,6 +454,7 @@ bool QFontEngine::processOS2Table() const
|
||||
return false;
|
||||
m_ascent = QFixed::fromReal(winAscent * fontDef.pixelSize) / unitsPerEm;
|
||||
m_descent = QFixed::fromReal(winDescent * fontDef.pixelSize) / unitsPerEm;
|
||||
m_leading = QFixed{};
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user