Get rid of qt_determine_writing_systems_from_truetype_bits()
Move this code to QPlatformFontDatabase and get rid of all dups of it. Change-Id: Idea6c84819039bf3b345b1305305951ade8d1ac4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>bb10
parent
3cd94fcaf8
commit
06a65b053e
|
|
@ -383,133 +383,6 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)
|
|||
return foundries[count++];
|
||||
}
|
||||
|
||||
// ### copied to tools/makeqpf/qpf2.cpp
|
||||
|
||||
// see the Unicode subset bitfields in the MSDN docs
|
||||
static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = {
|
||||
// Any,
|
||||
{ 127, 127 },
|
||||
// Latin,
|
||||
{ 0, 127 },
|
||||
// Greek,
|
||||
{ 7, 127 },
|
||||
// Cyrillic,
|
||||
{ 9, 127 },
|
||||
// Armenian,
|
||||
{ 10, 127 },
|
||||
// Hebrew,
|
||||
{ 11, 127 },
|
||||
// Arabic,
|
||||
{ 13, 127 },
|
||||
// Syriac,
|
||||
{ 71, 127 },
|
||||
//Thaana,
|
||||
{ 72, 127 },
|
||||
//Devanagari,
|
||||
{ 15, 127 },
|
||||
//Bengali,
|
||||
{ 16, 127 },
|
||||
//Gurmukhi,
|
||||
{ 17, 127 },
|
||||
//Gujarati,
|
||||
{ 18, 127 },
|
||||
//Oriya,
|
||||
{ 19, 127 },
|
||||
//Tamil,
|
||||
{ 20, 127 },
|
||||
//Telugu,
|
||||
{ 21, 127 },
|
||||
//Kannada,
|
||||
{ 22, 127 },
|
||||
//Malayalam,
|
||||
{ 23, 127 },
|
||||
//Sinhala,
|
||||
{ 73, 127 },
|
||||
//Thai,
|
||||
{ 24, 127 },
|
||||
//Lao,
|
||||
{ 25, 127 },
|
||||
//Tibetan,
|
||||
{ 70, 127 },
|
||||
//Myanmar,
|
||||
{ 74, 127 },
|
||||
// Georgian,
|
||||
{ 26, 127 },
|
||||
// Khmer,
|
||||
{ 80, 127 },
|
||||
// SimplifiedChinese,
|
||||
{ 126, 127 },
|
||||
// TraditionalChinese,
|
||||
{ 126, 127 },
|
||||
// Japanese,
|
||||
{ 126, 127 },
|
||||
// Korean,
|
||||
{ 56, 127 },
|
||||
// Vietnamese,
|
||||
{ 0, 127 }, // same as latin1
|
||||
// Other,
|
||||
{ 126, 127 },
|
||||
// Ogham,
|
||||
{ 78, 127 },
|
||||
// Runic,
|
||||
{ 79, 127 },
|
||||
// Nko,
|
||||
{ 14, 127 },
|
||||
};
|
||||
|
||||
#define SimplifiedChineseCsbBit 18
|
||||
#define TraditionalChineseCsbBit 20
|
||||
#define JapaneseCsbBit 17
|
||||
#define KoreanCsbBit 21
|
||||
|
||||
QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_truetype_bits(quint32 unicodeRange[4], quint32 codePageRange[2])
|
||||
{
|
||||
QList<QFontDatabase::WritingSystem> writingSystems;
|
||||
bool hasScript = false;
|
||||
|
||||
int i;
|
||||
for(i = 0; i < QFontDatabase::WritingSystemsCount; i++) {
|
||||
int bit = requiredUnicodeBits[i][0];
|
||||
int index = bit/32;
|
||||
int flag = 1 << (bit&31);
|
||||
if (bit != 126 && unicodeRange[index] & flag) {
|
||||
bit = requiredUnicodeBits[i][1];
|
||||
index = bit/32;
|
||||
|
||||
flag = 1 << (bit&31);
|
||||
if (bit == 127 || unicodeRange[index] & flag) {
|
||||
writingSystems.append(QFontDatabase::WritingSystem(i));
|
||||
hasScript = true;
|
||||
// qDebug("font %s: index=%d, flag=%8x supports script %d", familyName.latin1(), index, flag, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
|
||||
writingSystems.append(QFontDatabase::SimplifiedChinese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Simplified Chinese", familyName.latin1());
|
||||
}
|
||||
if(codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
|
||||
writingSystems.append(QFontDatabase::TraditionalChinese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Traditional Chinese", familyName.latin1());
|
||||
}
|
||||
if(codePageRange[0] & (1 << JapaneseCsbBit)) {
|
||||
writingSystems.append(QFontDatabase::Japanese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Japanese", familyName.latin1());
|
||||
}
|
||||
if(codePageRange[0] & (1 << KoreanCsbBit)) {
|
||||
writingSystems.append(QFontDatabase::Korean);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Korean", familyName.latin1());
|
||||
}
|
||||
if (!hasScript)
|
||||
writingSystems.append(QFontDatabase::Symbol);
|
||||
|
||||
return writingSystems;
|
||||
}
|
||||
|
||||
|
||||
class QFontDatabasePrivate
|
||||
{
|
||||
|
|
|
|||
|
|
@ -413,6 +413,107 @@ bool QPlatformFontDatabase::fontsAlwaysScalable() const
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// ### copied to tools/makeqpf/qpf2.cpp
|
||||
|
||||
// see the Unicode subset bitfields in the MSDN docs
|
||||
static const ushort requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = {
|
||||
{ 127, 127 }, // Any
|
||||
{ 0, 127 }, // Latin
|
||||
{ 7, 127 }, // Greek
|
||||
{ 9, 127 }, // Cyrillic
|
||||
{ 10, 127 }, // Armenian
|
||||
{ 11, 127 }, // Hebrew
|
||||
{ 13, 127 }, // Arabic
|
||||
{ 71, 127 }, // Syriac
|
||||
{ 72, 127 }, // Thaana
|
||||
{ 15, 127 }, // Devanagari
|
||||
{ 16, 127 }, // Bengali
|
||||
{ 17, 127 }, // Gurmukhi
|
||||
{ 18, 127 }, // Gujarati
|
||||
{ 19, 127 }, // Oriya
|
||||
{ 20, 127 }, // Tamil
|
||||
{ 21, 127 }, // Telugu
|
||||
{ 22, 127 }, // Kannada
|
||||
{ 23, 127 }, // Malayalam
|
||||
{ 73, 127 }, // Sinhala
|
||||
{ 24, 127 }, // Thai
|
||||
{ 25, 127 }, // Lao
|
||||
{ 70, 127 }, // Tibetan
|
||||
{ 74, 127 }, // Myanmar
|
||||
{ 26, 127 }, // Georgian
|
||||
{ 80, 127 }, // Khmer
|
||||
{ 126, 127 }, // SimplifiedChinese
|
||||
{ 126, 127 }, // TraditionalChinese
|
||||
{ 126, 127 }, // Japanese
|
||||
{ 56, 127 }, // Korean
|
||||
{ 0, 127 }, // Vietnamese (same as latin1)
|
||||
{ 126, 127 }, // Other
|
||||
{ 78, 127 }, // Ogham
|
||||
{ 79, 127 }, // Runic
|
||||
{ 14, 127 }, // Nko
|
||||
};
|
||||
|
||||
enum {
|
||||
SimplifiedChineseCsbBit = 18,
|
||||
TraditionalChineseCsbBit = 20,
|
||||
JapaneseCsbBit = 17,
|
||||
KoreanCsbBit = 21
|
||||
};
|
||||
|
||||
/*!
|
||||
Helper function that determines the writing systems support by a given
|
||||
\a unicodeRange and \a codePageRange.
|
||||
|
||||
\since 5.1
|
||||
*/
|
||||
QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2])
|
||||
{
|
||||
QSupportedWritingSystems writingSystems;
|
||||
|
||||
bool hasScript = false;
|
||||
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
|
||||
int bit = requiredUnicodeBits[i][0];
|
||||
int index = bit/32;
|
||||
int flag = 1 << (bit&31);
|
||||
if (bit != 126 && (unicodeRange[index] & flag)) {
|
||||
bit = requiredUnicodeBits[i][1];
|
||||
index = bit/32;
|
||||
|
||||
flag = 1 << (bit&31);
|
||||
if (bit == 127 || (unicodeRange[index] & flag)) {
|
||||
writingSystems.setSupported(QFontDatabase::WritingSystem(i));
|
||||
hasScript = true;
|
||||
// qDebug("font %s: index=%d, flag=%8x supports script %d", familyName.latin1(), index, flag, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
|
||||
writingSystems.setSupported(QFontDatabase::SimplifiedChinese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Simplified Chinese", familyName.latin1());
|
||||
}
|
||||
if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
|
||||
writingSystems.setSupported(QFontDatabase::TraditionalChinese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Traditional Chinese", familyName.latin1());
|
||||
}
|
||||
if (codePageRange[0] & (1 << JapaneseCsbBit)) {
|
||||
writingSystems.setSupported(QFontDatabase::Japanese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Japanese", familyName.latin1());
|
||||
}
|
||||
if (codePageRange[0] & (1 << KoreanCsbBit)) {
|
||||
writingSystems.setSupported(QFontDatabase::Korean);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Korean", familyName.latin1());
|
||||
}
|
||||
if (!hasScript)
|
||||
writingSystems.setSupported(QFontDatabase::Symbol);
|
||||
|
||||
return writingSystems;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QPlatformFontDatabase
|
||||
\since 5.0
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@ public:
|
|||
virtual bool fontsAlwaysScalable() const;
|
||||
virtual QList<int> standardSizes() const;
|
||||
|
||||
// helper
|
||||
static QSupportedWritingSystems writingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2]);
|
||||
|
||||
//callback
|
||||
static void registerQPF2Font(const QByteArray &dataArray, void *handle);
|
||||
static void registerFont(const QString &familyname, const QString &stylename,
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "qrawfont.h"
|
||||
#include "qrawfont_p.h"
|
||||
#include "qplatformfontdatabase.h"
|
||||
|
||||
#include <QtCore/qendian.h>
|
||||
|
||||
|
|
@ -574,9 +575,6 @@ QByteArray QRawFont::fontTable(const char *tagName) const
|
|||
return d->fontEngine->getSfntTable(qToBigEndian(*tagId));
|
||||
}
|
||||
|
||||
// From qfontdatabase.cpp
|
||||
extern QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_truetype_bits(quint32 unicodeRange[4], quint32 codePageRange[2]);
|
||||
|
||||
/*!
|
||||
Returns a list of writing systems supported by the font according to designer supplied
|
||||
information in the font file. Please note that this does not guarantee support for a
|
||||
|
|
@ -590,6 +588,7 @@ extern QList<QFontDatabase::WritingSystem> qt_determine_writing_systems_from_tru
|
|||
*/
|
||||
QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const
|
||||
{
|
||||
QList<QFontDatabase::WritingSystem> writingSystems;
|
||||
if (d->isValid()) {
|
||||
QByteArray os2Table = fontTable("OS/2");
|
||||
if (os2Table.size() > 86) {
|
||||
|
|
@ -606,11 +605,15 @@ QList<QFontDatabase::WritingSystem> QRawFont::supportedWritingSystems() const
|
|||
unicodeRanges[i] = qFromBigEndian(bigEndianUnicodeRanges[i]);
|
||||
}
|
||||
|
||||
return qt_determine_writing_systems_from_truetype_bits(unicodeRanges, codepageRanges);
|
||||
QSupportedWritingSystems ws = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRanges, codepageRanges);
|
||||
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
|
||||
if (ws.supported(QFontDatabase::WritingSystem(i)))
|
||||
writingSystems.append(QFontDatabase::WritingSystem(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return QList<QFontDatabase::WritingSystem>();
|
||||
return writingSystems;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -60,82 +60,6 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#define SimplifiedChineseCsbBit 18
|
||||
#define TraditionalChineseCsbBit 20
|
||||
#define JapaneseCsbBit 17
|
||||
#define KoreanCsbBit 21
|
||||
|
||||
static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = {
|
||||
// Any,
|
||||
{ 127, 127 },
|
||||
// Latin,
|
||||
{ 0, 127 },
|
||||
// Greek,
|
||||
{ 7, 127 },
|
||||
// Cyrillic,
|
||||
{ 9, 127 },
|
||||
// Armenian,
|
||||
{ 10, 127 },
|
||||
// Hebrew,
|
||||
{ 11, 127 },
|
||||
// Arabic,
|
||||
{ 13, 127 },
|
||||
// Syriac,
|
||||
{ 71, 127 },
|
||||
//Thaana,
|
||||
{ 72, 127 },
|
||||
//Devanagari,
|
||||
{ 15, 127 },
|
||||
//Bengali,
|
||||
{ 16, 127 },
|
||||
//Gurmukhi,
|
||||
{ 17, 127 },
|
||||
//Gujarati,
|
||||
{ 18, 127 },
|
||||
//Oriya,
|
||||
{ 19, 127 },
|
||||
//Tamil,
|
||||
{ 20, 127 },
|
||||
//Telugu,
|
||||
{ 21, 127 },
|
||||
//Kannada,
|
||||
{ 22, 127 },
|
||||
//Malayalam,
|
||||
{ 23, 127 },
|
||||
//Sinhala,
|
||||
{ 73, 127 },
|
||||
//Thai,
|
||||
{ 24, 127 },
|
||||
//Lao,
|
||||
{ 25, 127 },
|
||||
//Tibetan,
|
||||
{ 70, 127 },
|
||||
//Myanmar,
|
||||
{ 74, 127 },
|
||||
// Georgian,
|
||||
{ 26, 127 },
|
||||
// Khmer,
|
||||
{ 80, 127 },
|
||||
// SimplifiedChinese,
|
||||
{ 126, 127 },
|
||||
// TraditionalChinese,
|
||||
{ 126, 127 },
|
||||
// Japanese,
|
||||
{ 126, 127 },
|
||||
// Korean,
|
||||
{ 56, 127 },
|
||||
// Vietnamese,
|
||||
{ 0, 127 }, // same as latin1
|
||||
// Other,
|
||||
{ 126, 127 },
|
||||
// Ogham,
|
||||
{ 78, 127 },
|
||||
// Runic,
|
||||
{ 79, 127 },
|
||||
// Nko,
|
||||
{ 14, 127 },
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
quint16 majorVersion;
|
||||
quint16 minorVersion;
|
||||
|
|
@ -167,54 +91,6 @@ typedef struct {
|
|||
quint16 stringOffset;
|
||||
} NAME_RECORD;
|
||||
|
||||
QSupportedWritingSystems QBasicFontDatabase::determineWritingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2])
|
||||
{
|
||||
QSupportedWritingSystems writingSystems;
|
||||
bool hasScript = false;
|
||||
|
||||
int i;
|
||||
for(i = 0; i < QFontDatabase::WritingSystemsCount; i++) {
|
||||
int bit = requiredUnicodeBits[i][0];
|
||||
int index = bit/32;
|
||||
int flag = 1 << (bit&31);
|
||||
if (bit != 126 && unicodeRange[index] & flag) {
|
||||
bit = requiredUnicodeBits[i][1];
|
||||
index = bit/32;
|
||||
|
||||
flag = 1 << (bit&31);
|
||||
if (bit == 127 || unicodeRange[index] & flag) {
|
||||
writingSystems.setSupported(QFontDatabase::WritingSystem(i));
|
||||
hasScript = true;
|
||||
// qDebug("font %s: index=%d, flag=%8x supports script %d", familyName.latin1(), index, flag, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
|
||||
writingSystems.setSupported(QFontDatabase::SimplifiedChinese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Simplified Chinese", familyName.latin1());
|
||||
}
|
||||
if(codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
|
||||
writingSystems.setSupported(QFontDatabase::TraditionalChinese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Traditional Chinese", familyName.latin1());
|
||||
}
|
||||
if(codePageRange[0] & (1 << JapaneseCsbBit)) {
|
||||
writingSystems.setSupported(QFontDatabase::Japanese);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Japanese", familyName.latin1());
|
||||
}
|
||||
if(codePageRange[0] & (1 << KoreanCsbBit)) {
|
||||
writingSystems.setSupported(QFontDatabase::Korean);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Korean", familyName.latin1());
|
||||
}
|
||||
if (!hasScript)
|
||||
writingSystems.setSupported(QFontDatabase::Symbol);
|
||||
|
||||
return writingSystems;
|
||||
}
|
||||
|
||||
static inline bool scriptRequiresOpenType(int script)
|
||||
{
|
||||
return ((script >= QChar::Script_Syriac && script <= QChar::Script_Sinhala)
|
||||
|
|
@ -414,7 +290,7 @@ QStringList QBasicFontDatabase::addTTFile(const QByteArray &fontData, const QByt
|
|||
quint32(os2->ulCodePageRange2)
|
||||
};
|
||||
|
||||
writingSystems = determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
|
||||
writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
|
||||
|
||||
if (os2->usWeightClass == 0)
|
||||
;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ public:
|
|||
void releaseHandle(void *handle);
|
||||
|
||||
static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file);
|
||||
static QSupportedWritingSystems determineWritingSystemsFromTrueTypeBits(quint32 unicodeRange[4], quint32 codePageRange[2]);
|
||||
static QString fontNameFromTTFile(const QString &filename);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -606,130 +606,6 @@ QDebug operator<<(QDebug d, const QFontDef &def)
|
|||
return d;
|
||||
}
|
||||
|
||||
/* From QFontDatabase.cpp, qt_determine_writing_systems_from_truetype_bits().
|
||||
* Fixme: Make public? */
|
||||
|
||||
// see the Unicode subset bitfields in the MSDN docs
|
||||
static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = {
|
||||
// Any,
|
||||
{ 127, 127 },
|
||||
// Latin,
|
||||
{ 0, 127 },
|
||||
// Greek,
|
||||
{ 7, 127 },
|
||||
// Cyrillic,
|
||||
{ 9, 127 },
|
||||
// Armenian,
|
||||
{ 10, 127 },
|
||||
// Hebrew,
|
||||
{ 11, 127 },
|
||||
// Arabic,
|
||||
{ 13, 127 },
|
||||
// Syriac,
|
||||
{ 71, 127 },
|
||||
//Thaana,
|
||||
{ 72, 127 },
|
||||
//Devanagari,
|
||||
{ 15, 127 },
|
||||
//Bengali,
|
||||
{ 16, 127 },
|
||||
//Gurmukhi,
|
||||
{ 17, 127 },
|
||||
//Gujarati,
|
||||
{ 18, 127 },
|
||||
//Oriya,
|
||||
{ 19, 127 },
|
||||
//Tamil,
|
||||
{ 20, 127 },
|
||||
//Telugu,
|
||||
{ 21, 127 },
|
||||
//Kannada,
|
||||
{ 22, 127 },
|
||||
//Malayalam,
|
||||
{ 23, 127 },
|
||||
//Sinhala,
|
||||
{ 73, 127 },
|
||||
//Thai,
|
||||
{ 24, 127 },
|
||||
//Lao,
|
||||
{ 25, 127 },
|
||||
//Tibetan,
|
||||
{ 70, 127 },
|
||||
//Myanmar,
|
||||
{ 74, 127 },
|
||||
// Georgian,
|
||||
{ 26, 127 },
|
||||
// Khmer,
|
||||
{ 80, 127 },
|
||||
// SimplifiedChinese,
|
||||
{ 126, 127 },
|
||||
// TraditionalChinese,
|
||||
{ 126, 127 },
|
||||
// Japanese,
|
||||
{ 126, 127 },
|
||||
// Korean,
|
||||
{ 56, 127 },
|
||||
// Vietnamese,
|
||||
{ 0, 127 }, // same as latin1
|
||||
// Other,
|
||||
{ 126, 127 },
|
||||
// Ogham,
|
||||
{ 78, 127 },
|
||||
// Runic,
|
||||
{ 79, 127 },
|
||||
// Nko,
|
||||
{ 14, 127 },
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SimplifiedChineseCsbBit = 18,
|
||||
TraditionalChineseCsbBit = 20,
|
||||
JapaneseCsbBit = 17,
|
||||
KoreanCsbBit = 21
|
||||
};
|
||||
|
||||
static inline void writingSystemsFromTrueTypeBits(quint32 unicodeRange[4],
|
||||
quint32 codePageRange[2],
|
||||
QSupportedWritingSystems *ws)
|
||||
{
|
||||
bool hasScript = false;
|
||||
for(int i = 0; i < QFontDatabase::WritingSystemsCount; i++) {
|
||||
int bit = requiredUnicodeBits[i][0];
|
||||
int index = bit/32;
|
||||
int flag = 1 << (bit&31);
|
||||
if (bit != 126 && unicodeRange[index] & flag) {
|
||||
bit = requiredUnicodeBits[i][1];
|
||||
index = bit/32;
|
||||
|
||||
flag = 1 << (bit&31);
|
||||
if (bit == 127 || unicodeRange[index] & flag) {
|
||||
ws->setSupported(QFontDatabase::WritingSystem(i), true);
|
||||
hasScript = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(codePageRange[0] & (1 << SimplifiedChineseCsbBit)) {
|
||||
ws->setSupported(QFontDatabase::SimplifiedChinese, true);
|
||||
hasScript = true;
|
||||
}
|
||||
if(codePageRange[0] & (1 << TraditionalChineseCsbBit)) {
|
||||
ws->setSupported(QFontDatabase::TraditionalChinese, true);
|
||||
hasScript = true;
|
||||
}
|
||||
if(codePageRange[0] & (1 << JapaneseCsbBit)) {
|
||||
ws->setSupported(QFontDatabase::Japanese, true);
|
||||
hasScript = true;
|
||||
//qDebug("font %s supports Japanese", familyName.latin1());
|
||||
}
|
||||
if(codePageRange[0] & (1 << KoreanCsbBit)) {
|
||||
ws->setSupported(QFontDatabase::Korean, true);
|
||||
hasScript = true;
|
||||
}
|
||||
if (!hasScript)
|
||||
ws->setSupported(QFontDatabase::Symbol, true);
|
||||
}
|
||||
|
||||
// convert 0 ~ 1000 integer to QFont::Weight
|
||||
static inline QFont::Weight weightFromInteger(long weight)
|
||||
{
|
||||
|
|
@ -1019,7 +895,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
|
|||
unicodeRange[3] = 0xffffffff;
|
||||
}
|
||||
#endif
|
||||
writingSystemsFromTrueTypeBits(unicodeRange, codePageRange, &writingSystems);
|
||||
writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
|
||||
// ### Hack to work around problem with Thai text on Windows 7. Segoe UI contains
|
||||
// the symbol for Baht, and Windows thus reports that it supports the Thai script.
|
||||
// Since it's the default UI font on this platform, most widgets will be unable to
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
|
|||
quint32 codePageRange[2] = {
|
||||
signature->fsCsb[0], signature->fsCsb[1]
|
||||
};
|
||||
writingSystems = QBasicFontDatabase::determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
|
||||
writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
|
||||
// ### Hack to work around problem with Thai text on Windows 7. Segoe UI contains
|
||||
// the symbol for Baht, and Windows thus reports that it supports the Thai script.
|
||||
// Since it's the default UI font on this platform, most widgets will be unable to
|
||||
|
|
|
|||
Loading…
Reference in New Issue