summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-05-05 12:08:22 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-05-22 19:47:19 +0200
commit9e8f580d76e65632a999450fa8e0ab9a20285ff7 (patch)
treef4660970ba8e61f17ddbdfbb9ae0a5096ba79ef9 /src
parent810efdd2694e580b03ed97c097ae26563e3f5b2e (diff)
Windows: Work-around misreporting of Script and Roman
Two legacy bitmap fonts are misreported as TMPF_VECTOR on Windows: Roman and Script. This causes them to be marked as scalable, and the automatic fallback to NativeRendering in Qt Quick does not kick in - causing the text elements to look empty instead. To work around this, we exploit the peculiarity that the type of these two fonts is reported as "0" in the enumeration, which is not a valid value. No other fonts on the system is reported as type 0, so we simply detect this error case and mark the fonts as non-scalable, which is the safer choice. [ChangeLog][Windows] Fixed text in "Roman" and "Script" bitmap fonts not showing in Qt Quick applications. Fixes: QTBUG-85826 Change-Id: Id889f0dedb1d529e6dd64c6da9e17e303f4a9d04 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit a1e405ce11eb6760ccca13cf1b4e5d20fa3916e9)
Diffstat (limited to 'src')
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
index 6785578ee1..21f4f7d879 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
@@ -1038,7 +1038,9 @@ static bool addFontToDatabase(QString familyName,
const QString foundryName; // No such concept.
const bool fixed = !(textmetric->tmPitchAndFamily & TMPF_FIXED_PITCH);
const bool ttf = (textmetric->tmPitchAndFamily & TMPF_TRUETYPE);
- const bool scalable = textmetric->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE);
+ const bool unreliableTextMetrics = type == 0;
+ const bool scalable = (textmetric->tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE))
+ && !unreliableTextMetrics;
const int size = scalable ? SMOOTH_SCALABLE : textmetric->tmHeight;
const QFont::Style style = textmetric->tmItalic ? QFont::StyleItalic : QFont::StyleNormal;
const bool antialias = false;