summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qplatformfontdatabase.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-02-07 07:53:17 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-02-20 06:38:13 +0100
commit2f521438ebe5306d97b24a530ed4dc025b12052b (patch)
tree51d6e8ef46aa379f2d8a9beed5c277e92caf16fe /src/gui/text/qplatformfontdatabase.cpp
parent63a559845ce33b054d3f6d8b3c2b80f05eeffb16 (diff)
DirectWrite font db: Fix writing system detection
The implementation here was accidentally missing from the first commit. We use the OS/2 table for determining the writing system support as intended by the font designer, and fall back to actually checking the Unicode ranges if the table should be missing. Change-Id: Ibfdf76c27f3a94eda2142b3e269a1ca30d4bc045 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/text/qplatformfontdatabase.cpp')
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 48ba8987f3..4ff2ad3a41 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -534,6 +534,32 @@ enum CsbBits {
};
/*!
+ Helper function that determines the writing system support based on the contents of the OS/2 table
+ in the font.
+
+ \since 6.0
+*/
+QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromOS2Table(const char *os2Table, size_t length)
+{
+ if (length >= 86) {
+ quint32 unicodeRange[4] = {
+ qFromBigEndian<quint32>(os2Table + 42),
+ qFromBigEndian<quint32>(os2Table + 46),
+ qFromBigEndian<quint32>(os2Table + 50),
+ qFromBigEndian<quint32>(os2Table + 54)
+ };
+ quint32 codePageRange[2] = {
+ qFromBigEndian<quint32>(os2Table + 78),
+ qFromBigEndian<quint32>(os2Table + 82)
+ };
+
+ return writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
+ }
+
+ return QSupportedWritingSystems();
+}
+
+/*!
Helper function that determines the writing systems support by a given
\a unicodeRange and \a codePageRange.