Add an envvar restoring Qt 5 behavior for vertical font metrics
As a last resort for users who have existing Qt 5 applications and see differences in line metrics when porting to Qt 6, we introduce an environment variable which lets them restore the old behavior as a last resort. This is primarily meant as a porting tool, since we do have other tools, such as QFont::PreferTypoLineMetrics to work around issues with fonts that by mistake do not explicitly set the use-typo-metrics flag even if these are valid. Pick-to: 6.8 Fixes: QTBUG-134602 Change-Id: Id1d7829888d55247d2f07ee0a49b91ff34f26889 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 9a950b1ecb901cc885995d128768cc04cb55cfb1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 488e21860409b1f09b187c94e6e318f4ff8ff0a7)
This commit is contained in:
parent
df7d38d7e1
commit
0e371a39ea
@ -421,7 +421,14 @@ void QFontEngine::initializeHeightMetrics() const
|
||||
!getSfntTable(QFont::Tag("EBLC").value()).isEmpty()
|
||||
|| !getSfntTable(QFont::Tag("CBLC").value()).isEmpty()
|
||||
|| !getSfntTable(QFont::Tag("bdat").value()).isEmpty();
|
||||
if (!hasEmbeddedBitmaps) {
|
||||
|
||||
// When porting applications from Qt 5 to Qt 6, users have noticed differences in line
|
||||
// metrics due to the effort to consolidate these across platforms instead of using the
|
||||
// system values directly. This environment variable gives a "last resort" for those users
|
||||
// to tell Qt to prefer the metrics we get from the system, despite the fact these being
|
||||
// inconsistent across platforms.
|
||||
static bool useSystemLineMetrics = qEnvironmentVariableIntValue("QT_USE_SYSTEM_LINE_METRICS") > 0;
|
||||
if (!hasEmbeddedBitmaps && !useSystemLineMetrics) {
|
||||
// Get HHEA table values if available
|
||||
processHheaTable();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user