From 951e8a52aec860ad59bc15de534e1391bca4b923 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Tue, 24 Mar 2015 03:22:38 +0400 Subject: Detect Thai writing system support from the font's Code Page Bitfields https://msdn.microsoft.com/en-us/library/windows/desktop/dd317754(v=vs.85).aspx Change-Id: I893746210dc71b9de6f6c064fd9fcaf6340e3c71 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qplatformfontdatabase.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gui/text/qplatformfontdatabase.cpp') diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 3c3000da4d..eec9dd905e 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -522,6 +522,7 @@ enum { VietnameseCsbBit = 8, SimplifiedChineseCsbBit = 18, TraditionalChineseCsbBit = 20, + ThaiCsbBit = 16, JapaneseCsbBit = 17, KoreanCsbBit = 19, KoreanJohabCsbBit = 21 @@ -579,6 +580,11 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q hasScript = true; //qDebug("font %s supports Arabic", familyName.latin1()); } + if (codePageRange[0] & (1 << ThaiCsbBit)) { + writingSystems.setSupported(QFontDatabase::Thai); + hasScript = true; + //qDebug("font %s supports Thai", familyName.latin1()); + } if (codePageRange[0] & (1 << VietnameseCsbBit)) { writingSystems.setSupported(QFontDatabase::Vietnamese); hasScript = true; -- cgit v1.2.3 From a8e3245b50e1376aa3d3f2397ab10ecd5d6e6092 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Tue, 24 Mar 2015 04:42:03 +0400 Subject: Better detection of Symbol fonts > Symbol character sets have a special meaning. > If the symbol bit (31) is set, and the font file contains a 'cmap' > subtable for platform of 3 and encoding ID of 1, > then all of the characters in the Unicode range 0xF000 - 0xF0FF > (inclusive) will be used to enumerate the symbol character set. If we detected the font has a symbol character set, report no other writing systems support. Change-Id: I1030f3339c166ffd03c7caee1b1b26010dfdc314 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qplatformfontdatabase.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/gui/text/qplatformfontdatabase.cpp') diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index eec9dd905e..5fa43948aa 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -525,7 +525,8 @@ enum { ThaiCsbBit = 16, JapaneseCsbBit = 17, KoreanCsbBit = 19, - KoreanJohabCsbBit = 21 + KoreanJohabCsbBit = 21, + SymbolCsbBit = 31 }; /*! @@ -610,6 +611,11 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q hasScript = true; //qDebug("font %s supports Korean", familyName.latin1()); } + if (codePageRange[0] & (1 << SymbolCsbBit)) { + writingSystems = QSupportedWritingSystems(); + hasScript = false; + } + if (!hasScript) writingSystems.setSupported(QFontDatabase::Symbol); -- cgit v1.2.3