diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-11-06 11:03:10 (GMT) |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2009-11-06 11:05:43 (GMT) |
commit | 2e429e40eeed266c7062502c4f7b43092340f264 (patch) | |
tree | 5c3e7d40a20973837891e0f98666469e4e4b2df3 /src | |
parent | b8a8110ead6fe5d4a985fe9d486dd8f470aa24eb (diff) | |
download | Qt-2e429e40eeed266c7062502c4f7b43092340f264.zip Qt-2e429e40eeed266c7062502c4f7b43092340f264.tar.gz Qt-2e429e40eeed266c7062502c4f7b43092340f264.tar.bz2 |
add support for the N'Ko writing system to Qt
Enables N'Ko support in Qt, after having now a harfbuzz version
that supports it.
Task-number: QTBUG-1042
Reviewed-by: Gunnar
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qunicodetables_p.h | 4 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 23 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.h | 1 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_x11.cpp | 93 |
4 files changed, 72 insertions, 49 deletions
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h index e4041b4..4e9ce4d 100644 --- a/src/corelib/tools/qunicodetables_p.h +++ b/src/corelib/tools/qunicodetables_p.h @@ -114,6 +114,7 @@ namespace QUnicodeTables { Ogham, Runic, Khmer, + Nko, Inherited, ScriptCount = Inherited, Latin = Common, @@ -152,8 +153,7 @@ namespace QUnicodeTables { Balinese = Common, Cuneiform = Common, Phoenician = Common, - PhagsPa = Common, - Nko = Common + PhagsPa = Common }; enum { ScriptSentinel = 32 }; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index fb8444e..7d17e49 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -534,6 +534,12 @@ static int requiredUnicodeBits[QFontDatabase::WritingSystemsCount][2] = { { 0, 127 }, // same as latin1 // Other, { 126, 127 } + // Ogham, + { 78, 127 }, + // Runic, + { 79, 127 }, + // Nko, + { 14, 127 }, }; #define SimplifiedChineseCsbBit 18 @@ -873,7 +879,8 @@ static const int scriptForWritingSystem[] = { QUnicodeTables::Common, // Braille QUnicodeTables::Common, // Symbol QUnicodeTables::Ogham, // Ogham - QUnicodeTables::Runic // Runic + QUnicodeTables::Runic, // Runic + QUnicodeTables::Nko // Nko }; @@ -881,12 +888,12 @@ static const int scriptForWritingSystem[] = { static inline bool requiresOpenType(int writingSystem) { return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) - || writingSystem == QFontDatabase::Khmer); + || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko); } static inline bool scriptRequiresOpenType(int script) { return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala) - || script == QUnicodeTables::Khmer); + || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko); } #endif @@ -1558,6 +1565,7 @@ QFontDatabase::QFontDatabase() \value Other (the same as Symbol) \value Ogham \value Runic + \value Nko \omitvalue WritingSystemsCount */ @@ -2232,6 +2240,9 @@ QString QFontDatabase::writingSystemName(WritingSystem writingSystem) case Runic: name = QT_TRANSLATE_NOOP("QFontDatabase", "Runic"); break; + case Nko: + name = QT_TRANSLATE_NOOP("QFontDatabase", "N'Ko"); + break; default: Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter"); break; @@ -2445,6 +2456,12 @@ QString QFontDatabase::writingSystemSample(WritingSystem writingSystem) sample += QChar(0x16a2); sample += QChar(0x16a3); break; + case Nko: + sample += QChar(0x7ca); + sample += QChar(0x7cb); + sample += QChar(0x7cc); + sample += QChar(0x7cd); + break; default: break; } diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index e6dcfc9..37b5860 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -108,6 +108,7 @@ public: Ogham, Runic, + Nko, WritingSystemsCount }; diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index f184811..dd575f9 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -155,187 +155,187 @@ static const char writingSystems_for_xlfd_encoding[sizeof(xlfd_encoding)][QFontD { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-2 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-3 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-4 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-9 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-10 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-13 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0 }, + 0, 0 }, // iso8859-14 { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 }, + 1, 0 }, // *-fontspecific { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 }, + 1, 0 }, // fontspecific-* { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1 } + 1, 0 } }; @@ -835,7 +835,8 @@ static const char *specialLanguages[] = { "ko", // Hangul "", // Ogham "", // Runic - "km" // Khmer + "km", // Khmer + "" // N'Ko }; enum { SpecialLanguageCount = sizeof(specialLanguages) / sizeof(const char *) }; @@ -866,7 +867,8 @@ static const ushort specialChars[] = { 0, // Hangul 0x1681, // Ogham 0x16a0, // Runic - 0 // Khmer + 0, // Khmer + 0x7ca // N'Ko }; enum { SpecialCharCount = sizeof(specialChars) / sizeof(ushort) }; @@ -905,7 +907,8 @@ static const char *languageForWritingSystem[] = { "vi", // Vietnamese 0, // Symbol 0, // Ogham - 0 // Runic + 0, // Runic + 0 // N'Ko }; enum { LanguageCount = sizeof(languageForWritingSystem) / sizeof(const char *) }; @@ -944,7 +947,8 @@ static const ushort sampleCharForWritingSystem[] = { 0, // Vietnamese 0, // Symbol 0x1681, // Ogham - 0x16a0 // Runic + 0x16a0, // Runic + 0x7ca // N'Ko }; enum { SampleCharCount = sizeof(sampleCharForWritingSystem) / sizeof(ushort) }; @@ -984,7 +988,8 @@ static const char *openType[] = { 0, // Vietnamese 0, // Symbol 0, // Ogham - 0 // Runic + 0, // Runic + "nko " // N'Ko }; enum { OpenTypeCount = sizeof(openType) / sizeof(const char *) }; @@ -1472,7 +1477,7 @@ void qt_addPatternProps(FcPattern *pattern, int screen, int script, const QFontD !(request.styleStrategy & QFont::NoAntialias)); } - if (script != QUnicodeTables::Common) { + if (script != QUnicodeTables::Common && *specialLanguages[script] != '\0') { Q_ASSERT(script < QUnicodeTables::ScriptCount); FcLangSet *ls = FcLangSetCreate(); FcLangSetAdd(ls, (const FcChar8*)specialLanguages[script]); @@ -1615,7 +1620,7 @@ static QFontEngine *tryPatternLoad(FcPattern *p, int screen, goto done; if (!FcCharSetHasChar(cs, specialChars[script])) goto done; - } else { + } else if (*specialLanguages[script] != '\0'){ FcLangSet *langSet = 0; if (FcPatternGetLangSet(match, FC_LANG, 0, &langSet) != FcResultMatch) goto done; |