Add QChar::Script enum
...where the values are not aliased to Common script. The old QUnicodeTables::Script enum was retained for compatibility reasons until Qt internals are updated to use QChar::script(). Using QChar::Script instead of QUnicodeTables::Script would improve both the text analysis (itemization, boundary finding) and the text shaping quality. This also a required step for switching to Hurfbuzz-NG. /* This adds 6668 more .rodata bytes */ Change-Id: I5aa3d12c550528d0052542436990f8d0779ea8e5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
e307d60749
commit
f7639c0a6d
@ -262,6 +262,132 @@ QT_BEGIN_NAMESPACE
|
||||
\sa category()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QChar::Script
|
||||
\since 5.1
|
||||
|
||||
This enum type defines the Unicode script property values.
|
||||
|
||||
For details about the Unicode script property values see
|
||||
\l{http://www.unicode.org/reports/tr24/}{Unicode Standard Annex #24}.
|
||||
|
||||
In order to conform to C/C++ naming conventions "Script_" is prepended
|
||||
to the codes used in the Unicode Standard.
|
||||
|
||||
\value Script_Unknown For unassigned, private-use, noncharacter, and surrogate code points.
|
||||
\value Script_Inherited For characters that may be used with multiple scripts
|
||||
and that inherit their script from the preceding characters.
|
||||
These include nonspacing marks, enclosing marks,
|
||||
and zero width joiner/non-joiner characters.
|
||||
\value Script_Common For characters that may be used with multiple scripts
|
||||
and that do not inherit their script from the preceding characters.
|
||||
|
||||
\value Script_Latin
|
||||
\value Script_Greek
|
||||
\value Script_Cyrillic
|
||||
\value Script_Armenian
|
||||
\value Script_Hebrew
|
||||
\value Script_Arabic
|
||||
\value Script_Syriac
|
||||
\value Script_Thaana
|
||||
\value Script_Devanagari
|
||||
\value Script_Bengali
|
||||
\value Script_Gurmukhi
|
||||
\value Script_Gujarati
|
||||
\value Script_Oriya
|
||||
\value Script_Tamil
|
||||
\value Script_Telugu
|
||||
\value Script_Kannada
|
||||
\value Script_Malayalam
|
||||
\value Script_Sinhala
|
||||
\value Script_Thai
|
||||
\value Script_Lao
|
||||
\value Script_Tibetan
|
||||
\value Script_Myanmar
|
||||
\value Script_Georgian
|
||||
\value Script_Hangul
|
||||
\value Script_Ethiopic
|
||||
\value Script_Cherokee
|
||||
\value Script_CanadianAboriginal
|
||||
\value Script_Ogham
|
||||
\value Script_Runic
|
||||
\value Script_Khmer
|
||||
\value Script_Mongolian
|
||||
\value Script_Hiragana
|
||||
\value Script_Katakana
|
||||
\value Script_Bopomofo
|
||||
\value Script_Han
|
||||
\value Script_Yi
|
||||
\value Script_OldItalic
|
||||
\value Script_Gothic
|
||||
\value Script_Deseret
|
||||
\value Script_Tagalog
|
||||
\value Script_Hanunoo
|
||||
\value Script_Buhid
|
||||
\value Script_Tagbanwa
|
||||
\value Script_Coptic
|
||||
\value Script_Limbu
|
||||
\value Script_TaiLe
|
||||
\value Script_LinearB
|
||||
\value Script_Ugaritic
|
||||
\value Script_Shavian
|
||||
\value Script_Osmanya
|
||||
\value Script_Cypriot
|
||||
\value Script_Braille
|
||||
\value Script_Buginese
|
||||
\value Script_NewTaiLue
|
||||
\value Script_Glagolitic
|
||||
\value Script_Tifinagh
|
||||
\value Script_SylotiNagri
|
||||
\value Script_OldPersian
|
||||
\value Script_Kharoshthi
|
||||
\value Script_Balinese
|
||||
\value Script_Cuneiform
|
||||
\value Script_Phoenician
|
||||
\value Script_PhagsPa
|
||||
\value Script_Nko
|
||||
\value Script_Sundanese
|
||||
\value Script_Lepcha
|
||||
\value Script_OlChiki
|
||||
\value Script_Vai
|
||||
\value Script_Saurashtra
|
||||
\value Script_KayahLi
|
||||
\value Script_Rejang
|
||||
\value Script_Lycian
|
||||
\value Script_Carian
|
||||
\value Script_Lydian
|
||||
\value Script_Cham
|
||||
\value Script_TaiTham
|
||||
\value Script_TaiViet
|
||||
\value Script_Avestan
|
||||
\value Script_EgyptianHieroglyphs
|
||||
\value Script_Samaritan
|
||||
\value Script_Lisu
|
||||
\value Script_Bamum
|
||||
\value Script_Javanese
|
||||
\value Script_MeeteiMayek
|
||||
\value Script_ImperialAramaic
|
||||
\value Script_OldSouthArabian
|
||||
\value Script_InscriptionalParthian
|
||||
\value Script_InscriptionalPahlavi
|
||||
\value Script_OldTurkic
|
||||
\value Script_Kaithi
|
||||
\value Script_Batak
|
||||
\value Script_Brahmi
|
||||
\value Script_Mandaic
|
||||
\value Script_Chakma
|
||||
\value Script_MeroiticCursive
|
||||
\value Script_MeroiticHieroglyphs
|
||||
\value Script_Miao
|
||||
\value Script_Sharada
|
||||
\value Script_SoraSompeng
|
||||
\value Script_Takri
|
||||
|
||||
\omitvalue ScriptCount
|
||||
|
||||
\sa script()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QChar::Direction
|
||||
|
||||
@ -1158,6 +1284,27 @@ unsigned char QChar::combiningClass(uint ucs4)
|
||||
return (unsigned char) qGetProp(ucs4)->combiningClass;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QChar::Script QChar::script() const
|
||||
\since 5.1
|
||||
|
||||
Returns the Unicode script property value for this character.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\overload
|
||||
\since 5.1
|
||||
|
||||
Returns the Unicode script property value for the character specified in
|
||||
its UCS-4-encoded form as \a ucs4.
|
||||
*/
|
||||
QChar::Script QChar::script(uint ucs4)
|
||||
{
|
||||
if (ucs4 > LastValidCodePoint)
|
||||
return QChar::Script_Unknown;
|
||||
return (QChar::Script) qGetProp(ucs4)->script;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn QChar::UnicodeVersion QChar::unicodeVersion() const
|
||||
|
||||
|
@ -137,6 +137,130 @@ public:
|
||||
Symbol_Other // So
|
||||
};
|
||||
|
||||
enum Script
|
||||
{
|
||||
Script_Unknown,
|
||||
Script_Inherited,
|
||||
Script_Common,
|
||||
|
||||
Script_Latin,
|
||||
Script_Greek,
|
||||
Script_Cyrillic,
|
||||
Script_Armenian,
|
||||
Script_Hebrew,
|
||||
Script_Arabic,
|
||||
Script_Syriac,
|
||||
Script_Thaana,
|
||||
Script_Devanagari,
|
||||
Script_Bengali,
|
||||
Script_Gurmukhi,
|
||||
Script_Gujarati,
|
||||
Script_Oriya,
|
||||
Script_Tamil,
|
||||
Script_Telugu,
|
||||
Script_Kannada,
|
||||
Script_Malayalam,
|
||||
Script_Sinhala,
|
||||
Script_Thai,
|
||||
Script_Lao,
|
||||
Script_Tibetan,
|
||||
Script_Myanmar,
|
||||
Script_Georgian,
|
||||
Script_Hangul,
|
||||
Script_Ethiopic,
|
||||
Script_Cherokee,
|
||||
Script_CanadianAboriginal,
|
||||
Script_Ogham,
|
||||
Script_Runic,
|
||||
Script_Khmer,
|
||||
Script_Mongolian,
|
||||
Script_Hiragana,
|
||||
Script_Katakana,
|
||||
Script_Bopomofo,
|
||||
Script_Han,
|
||||
Script_Yi,
|
||||
Script_OldItalic,
|
||||
Script_Gothic,
|
||||
Script_Deseret,
|
||||
Script_Tagalog,
|
||||
Script_Hanunoo,
|
||||
Script_Buhid,
|
||||
Script_Tagbanwa,
|
||||
Script_Coptic,
|
||||
|
||||
// Unicode 4.0 additions
|
||||
Script_Limbu,
|
||||
Script_TaiLe,
|
||||
Script_LinearB,
|
||||
Script_Ugaritic,
|
||||
Script_Shavian,
|
||||
Script_Osmanya,
|
||||
Script_Cypriot,
|
||||
Script_Braille,
|
||||
|
||||
// Unicode 4.1 additions
|
||||
Script_Buginese,
|
||||
Script_NewTaiLue,
|
||||
Script_Glagolitic,
|
||||
Script_Tifinagh,
|
||||
Script_SylotiNagri,
|
||||
Script_OldPersian,
|
||||
Script_Kharoshthi,
|
||||
|
||||
// Unicode 5.0 additions
|
||||
Script_Balinese,
|
||||
Script_Cuneiform,
|
||||
Script_Phoenician,
|
||||
Script_PhagsPa,
|
||||
Script_Nko,
|
||||
|
||||
// Unicode 5.1 additions
|
||||
Script_Sundanese,
|
||||
Script_Lepcha,
|
||||
Script_OlChiki,
|
||||
Script_Vai,
|
||||
Script_Saurashtra,
|
||||
Script_KayahLi,
|
||||
Script_Rejang,
|
||||
Script_Lycian,
|
||||
Script_Carian,
|
||||
Script_Lydian,
|
||||
Script_Cham,
|
||||
|
||||
// Unicode 5.2 additions
|
||||
Script_TaiTham,
|
||||
Script_TaiViet,
|
||||
Script_Avestan,
|
||||
Script_EgyptianHieroglyphs,
|
||||
Script_Samaritan,
|
||||
Script_Lisu,
|
||||
Script_Bamum,
|
||||
Script_Javanese,
|
||||
Script_MeeteiMayek,
|
||||
Script_ImperialAramaic,
|
||||
Script_OldSouthArabian,
|
||||
Script_InscriptionalParthian,
|
||||
Script_InscriptionalPahlavi,
|
||||
Script_OldTurkic,
|
||||
Script_Kaithi,
|
||||
|
||||
// Unicode 6.0 additions
|
||||
Script_Batak,
|
||||
Script_Brahmi,
|
||||
Script_Mandaic,
|
||||
|
||||
// Unicode 6.1 additions
|
||||
Script_Chakma,
|
||||
Script_MeroiticCursive,
|
||||
Script_MeroiticHieroglyphs,
|
||||
Script_Miao,
|
||||
Script_Sharada,
|
||||
Script_SoraSompeng,
|
||||
Script_Takri,
|
||||
|
||||
ScriptCount
|
||||
};
|
||||
|
||||
enum Direction
|
||||
{
|
||||
DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
|
||||
@ -231,6 +355,8 @@ public:
|
||||
inline QChar toTitleCase() const { return QChar::toTitleCase(ucs); }
|
||||
inline QChar toCaseFolded() const { return QChar::toCaseFolded(ucs); }
|
||||
|
||||
inline Script script() const { return QChar::script(ucs); }
|
||||
|
||||
inline UnicodeVersion unicodeVersion() const { return QChar::unicodeVersion(ucs); }
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
@ -316,6 +442,8 @@ public:
|
||||
static uint QT_FASTCALL toTitleCase(uint ucs4);
|
||||
static uint QT_FASTCALL toCaseFolded(uint ucs4);
|
||||
|
||||
static Script QT_FASTCALL script(uint ucs4);
|
||||
|
||||
static UnicodeVersion QT_FASTCALL unicodeVersion(uint ucs4);
|
||||
|
||||
static UnicodeVersion QT_FASTCALL currentUnicodeVersion();
|
||||
|
@ -884,6 +884,8 @@ public:
|
||||
QChar::Decomposition decompositionTag() const { return QChar(*this).decompositionTag(); }
|
||||
uchar combiningClass() const { return QChar(*this).combiningClass(); }
|
||||
|
||||
inline QChar::Script script() const { return QChar(*this).script(); }
|
||||
|
||||
QChar::UnicodeVersion unicodeVersion() const { return QChar(*this).unicodeVersion(); }
|
||||
|
||||
inline uchar cell() const { return QChar(*this).cell(); }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -83,7 +83,7 @@ struct Properties {
|
||||
ushort wordBreakClass : 8; /* 4 used */
|
||||
ushort sentenceBreakClass : 8; /* 4 used */
|
||||
ushort lineBreakClass : 8; /* 6 used */
|
||||
ushort script : 8; /* 5 used */
|
||||
ushort script : 8; /* 7 used */
|
||||
};
|
||||
|
||||
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4);
|
||||
|
@ -743,6 +743,41 @@ void tst_QChar::script()
|
||||
QVERIFY(QUnicodeTables::script(0x1018au) == QUnicodeTables::Greek);
|
||||
QVERIFY(QUnicodeTables::script(0x1f130u) == QUnicodeTables::Common);
|
||||
QVERIFY(QUnicodeTables::script(0xe0100u) == QUnicodeTables::Inherited);
|
||||
|
||||
QVERIFY(QChar::script(0x0020u) == QChar::Script_Common);
|
||||
QVERIFY(QChar::script(0x0041u) == QChar::Script_Latin);
|
||||
QVERIFY(QChar::script(0x0375u) == QChar::Script_Greek);
|
||||
QVERIFY(QChar::script(0x0400u) == QChar::Script_Cyrillic);
|
||||
QVERIFY(QChar::script(0x0531u) == QChar::Script_Armenian);
|
||||
QVERIFY(QChar::script(0x0591u) == QChar::Script_Hebrew);
|
||||
QVERIFY(QChar::script(0x0600u) == QChar::Script_Arabic);
|
||||
QVERIFY(QChar::script(0x0700u) == QChar::Script_Syriac);
|
||||
QVERIFY(QChar::script(0x0780u) == QChar::Script_Thaana);
|
||||
QVERIFY(QChar::script(0x07c0u) == QChar::Script_Nko);
|
||||
QVERIFY(QChar::script(0x0900u) == QChar::Script_Devanagari);
|
||||
QVERIFY(QChar::script(0x0981u) == QChar::Script_Bengali);
|
||||
QVERIFY(QChar::script(0x0a01u) == QChar::Script_Gurmukhi);
|
||||
QVERIFY(QChar::script(0x0a81u) == QChar::Script_Gujarati);
|
||||
QVERIFY(QChar::script(0x0b01u) == QChar::Script_Oriya);
|
||||
QVERIFY(QChar::script(0x0b82u) == QChar::Script_Tamil);
|
||||
QVERIFY(QChar::script(0x0c01u) == QChar::Script_Telugu);
|
||||
QVERIFY(QChar::script(0x0c82u) == QChar::Script_Kannada);
|
||||
QVERIFY(QChar::script(0x0d02u) == QChar::Script_Malayalam);
|
||||
QVERIFY(QChar::script(0x0d82u) == QChar::Script_Sinhala);
|
||||
QVERIFY(QChar::script(0x0e01u) == QChar::Script_Thai);
|
||||
QVERIFY(QChar::script(0x0e81u) == QChar::Script_Lao);
|
||||
QVERIFY(QChar::script(0x0f00u) == QChar::Script_Tibetan);
|
||||
QVERIFY(QChar::script(0x1000u) == QChar::Script_Myanmar);
|
||||
QVERIFY(QChar::script(0x10a0u) == QChar::Script_Georgian);
|
||||
QVERIFY(QChar::script(0x1100u) == QChar::Script_Hangul);
|
||||
QVERIFY(QChar::script(0x1680u) == QChar::Script_Ogham);
|
||||
QVERIFY(QChar::script(0x16a0u) == QChar::Script_Runic);
|
||||
QVERIFY(QChar::script(0x1780u) == QChar::Script_Khmer);
|
||||
QVERIFY(QChar::script(0x200cu) == QChar::Script_Inherited);
|
||||
QVERIFY(QChar::script(0x200du) == QChar::Script_Inherited);
|
||||
QVERIFY(QChar::script(0x1018au) == QChar::Script_Greek);
|
||||
QVERIFY(QChar::script(0x1f130u) == QChar::Script_Common);
|
||||
QVERIFY(QChar::script(0xe0100u) == QChar::Script_Inherited);
|
||||
}
|
||||
|
||||
void tst_QChar::normalization_data()
|
||||
|
@ -540,6 +540,137 @@ static void initLineBreak()
|
||||
}
|
||||
|
||||
|
||||
static QHash<QByteArray, QChar::Script> scriptMap;
|
||||
|
||||
static void initScriptMap()
|
||||
{
|
||||
struct Scrpt {
|
||||
QChar::Script script;
|
||||
const char *name;
|
||||
} scripts[] = {
|
||||
// general
|
||||
{ QChar::Script_Unknown, "Unknown" },
|
||||
{ QChar::Script_Inherited, "Inherited" },
|
||||
{ QChar::Script_Common, "Common" },
|
||||
// pre-4.0
|
||||
{ QChar::Script_Latin, "Latin" },
|
||||
{ QChar::Script_Greek, "Greek" },
|
||||
{ QChar::Script_Cyrillic, "Cyrillic" },
|
||||
{ QChar::Script_Armenian, "Armenian" },
|
||||
{ QChar::Script_Hebrew, "Hebrew" },
|
||||
{ QChar::Script_Arabic, "Arabic" },
|
||||
{ QChar::Script_Syriac, "Syriac" },
|
||||
{ QChar::Script_Thaana, "Thaana" },
|
||||
{ QChar::Script_Devanagari, "Devanagari" },
|
||||
{ QChar::Script_Bengali, "Bengali" },
|
||||
{ QChar::Script_Gurmukhi, "Gurmukhi" },
|
||||
{ QChar::Script_Gujarati, "Gujarati" },
|
||||
{ QChar::Script_Oriya, "Oriya" },
|
||||
{ QChar::Script_Tamil, "Tamil" },
|
||||
{ QChar::Script_Telugu, "Telugu" },
|
||||
{ QChar::Script_Kannada, "Kannada" },
|
||||
{ QChar::Script_Malayalam, "Malayalam" },
|
||||
{ QChar::Script_Sinhala, "Sinhala" },
|
||||
{ QChar::Script_Thai, "Thai" },
|
||||
{ QChar::Script_Lao, "Lao" },
|
||||
{ QChar::Script_Tibetan, "Tibetan" },
|
||||
{ QChar::Script_Myanmar, "Myanmar" },
|
||||
{ QChar::Script_Georgian, "Georgian" },
|
||||
{ QChar::Script_Hangul, "Hangul" },
|
||||
{ QChar::Script_Ethiopic, "Ethiopic" },
|
||||
{ QChar::Script_Cherokee, "Cherokee" },
|
||||
{ QChar::Script_CanadianAboriginal, "CanadianAboriginal" },
|
||||
{ QChar::Script_Ogham, "Ogham" },
|
||||
{ QChar::Script_Runic, "Runic" },
|
||||
{ QChar::Script_Khmer, "Khmer" },
|
||||
{ QChar::Script_Mongolian, "Mongolian" },
|
||||
{ QChar::Script_Hiragana, "Hiragana" },
|
||||
{ QChar::Script_Katakana, "Katakana" },
|
||||
{ QChar::Script_Bopomofo, "Bopomofo" },
|
||||
{ QChar::Script_Han, "Han" },
|
||||
{ QChar::Script_Yi, "Yi" },
|
||||
{ QChar::Script_OldItalic, "OldItalic" },
|
||||
{ QChar::Script_Gothic, "Gothic" },
|
||||
{ QChar::Script_Deseret, "Deseret" },
|
||||
{ QChar::Script_Tagalog, "Tagalog" },
|
||||
{ QChar::Script_Hanunoo, "Hanunoo" },
|
||||
{ QChar::Script_Buhid, "Buhid" },
|
||||
{ QChar::Script_Tagbanwa, "Tagbanwa" },
|
||||
{ QChar::Script_Coptic, "Coptic" },
|
||||
// 4.0
|
||||
{ QChar::Script_Limbu, "Limbu" },
|
||||
{ QChar::Script_TaiLe, "TaiLe" },
|
||||
{ QChar::Script_LinearB, "LinearB" },
|
||||
{ QChar::Script_Ugaritic, "Ugaritic" },
|
||||
{ QChar::Script_Shavian, "Shavian" },
|
||||
{ QChar::Script_Osmanya, "Osmanya" },
|
||||
{ QChar::Script_Cypriot, "Cypriot" },
|
||||
{ QChar::Script_Braille, "Braille" },
|
||||
// 4.1
|
||||
{ QChar::Script_Buginese, "Buginese" },
|
||||
{ QChar::Script_NewTaiLue, "NewTaiLue" },
|
||||
{ QChar::Script_Glagolitic, "Glagolitic" },
|
||||
{ QChar::Script_Tifinagh, "Tifinagh" },
|
||||
{ QChar::Script_SylotiNagri, "SylotiNagri" },
|
||||
{ QChar::Script_OldPersian, "OldPersian" },
|
||||
{ QChar::Script_Kharoshthi, "Kharoshthi" },
|
||||
// 5.0
|
||||
{ QChar::Script_Balinese, "Balinese" },
|
||||
{ QChar::Script_Cuneiform, "Cuneiform" },
|
||||
{ QChar::Script_Phoenician, "Phoenician" },
|
||||
{ QChar::Script_PhagsPa, "PhagsPa" },
|
||||
{ QChar::Script_Nko, "Nko" },
|
||||
// 5.1
|
||||
{ QChar::Script_Sundanese, "Sundanese" },
|
||||
{ QChar::Script_Lepcha, "Lepcha" },
|
||||
{ QChar::Script_OlChiki, "OlChiki" },
|
||||
{ QChar::Script_Vai, "Vai" },
|
||||
{ QChar::Script_Saurashtra, "Saurashtra" },
|
||||
{ QChar::Script_KayahLi, "KayahLi" },
|
||||
{ QChar::Script_Rejang, "Rejang" },
|
||||
{ QChar::Script_Lycian, "Lycian" },
|
||||
{ QChar::Script_Carian, "Carian" },
|
||||
{ QChar::Script_Lydian, "Lydian" },
|
||||
{ QChar::Script_Cham, "Cham" },
|
||||
// 5.2
|
||||
{ QChar::Script_TaiTham, "TaiTham" },
|
||||
{ QChar::Script_TaiViet, "TaiViet" },
|
||||
{ QChar::Script_Avestan, "Avestan" },
|
||||
{ QChar::Script_EgyptianHieroglyphs, "EgyptianHieroglyphs" },
|
||||
{ QChar::Script_Samaritan, "Samaritan" },
|
||||
{ QChar::Script_Lisu, "Lisu" },
|
||||
{ QChar::Script_Bamum, "Bamum" },
|
||||
{ QChar::Script_Javanese, "Javanese" },
|
||||
{ QChar::Script_MeeteiMayek, "MeeteiMayek" },
|
||||
{ QChar::Script_ImperialAramaic, "ImperialAramaic" },
|
||||
{ QChar::Script_OldSouthArabian, "OldSouthArabian" },
|
||||
{ QChar::Script_InscriptionalParthian, "InscriptionalParthian" },
|
||||
{ QChar::Script_InscriptionalPahlavi, "InscriptionalPahlavi" },
|
||||
{ QChar::Script_OldTurkic, "OldTurkic" },
|
||||
{ QChar::Script_Kaithi, "Kaithi" },
|
||||
// 6.0
|
||||
{ QChar::Script_Batak, "Batak" },
|
||||
{ QChar::Script_Brahmi, "Brahmi" },
|
||||
{ QChar::Script_Mandaic, "Mandaic" },
|
||||
// 6.1
|
||||
{ QChar::Script_Chakma, "Chakma" },
|
||||
{ QChar::Script_MeroiticCursive, "MeroiticCursive" },
|
||||
{ QChar::Script_MeroiticHieroglyphs, "MeroiticHieroglyphs" },
|
||||
{ QChar::Script_Miao, "Miao" },
|
||||
{ QChar::Script_Sharada, "Sharada" },
|
||||
{ QChar::Script_SoraSompeng, "SoraSompeng" },
|
||||
{ QChar::Script_Takri, "Takri" },
|
||||
// unhandled
|
||||
{ QChar::Script_Unknown, 0 }
|
||||
};
|
||||
Scrpt *p = scripts;
|
||||
while (p->name) {
|
||||
scriptMap.insert(p->name, p->script);
|
||||
++p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Keep this one in sync with the code in createPropertyInfo
|
||||
static const char *property_string =
|
||||
"struct Properties {\n"
|
||||
@ -562,7 +693,7 @@ static const char *property_string =
|
||||
" ushort wordBreakClass : 8; /* 4 used */\n"
|
||||
" ushort sentenceBreakClass : 8; /* 4 used */\n"
|
||||
" ushort lineBreakClass : 8; /* 6 used */\n"
|
||||
" ushort script : 8; /* 5 used */\n"
|
||||
" ushort script : 8; /* 7 used */\n"
|
||||
"};\n\n"
|
||||
"Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4);\n"
|
||||
"Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2);\n"
|
||||
@ -745,7 +876,7 @@ struct UnicodeData {
|
||||
p.graphemeBreakClass = GraphemeBreak_Other;
|
||||
p.wordBreakClass = WordBreak_Other;
|
||||
p.sentenceBreakClass = SentenceBreak_Other;
|
||||
p.script = 0; // Common
|
||||
p.script = QChar::Script_Unknown;
|
||||
propertyIndex = -1;
|
||||
excludedComposition = false;
|
||||
}
|
||||
@ -1831,7 +1962,7 @@ static void readBlocks()
|
||||
#endif
|
||||
|
||||
static QList<QByteArray> scriptNames;
|
||||
static QList<int> scriptMap;
|
||||
static QList<int> scriptList;
|
||||
|
||||
static const char *specialScripts[] = {
|
||||
"Common",
|
||||
@ -1880,7 +2011,7 @@ static void readScripts()
|
||||
// ### preserve the old ordering (temporary)
|
||||
for (int i = 0; i < specialScriptsCount; ++i) {
|
||||
scriptNames.append(specialScripts[i]);
|
||||
scriptMap.append(i);
|
||||
scriptList.append(i);
|
||||
}
|
||||
|
||||
while (!f.atEnd()) {
|
||||
@ -1914,6 +2045,10 @@ static void readScripts()
|
||||
Q_ASSERT(ok);
|
||||
}
|
||||
|
||||
if (!scriptMap.contains(scriptName))
|
||||
qFatal("Unhandled script property value: %s", scriptName.constData());
|
||||
QChar::Script script = scriptMap.value(scriptName, QChar::Script_Unknown);
|
||||
|
||||
int scriptIndex = scriptNames.indexOf(scriptName);
|
||||
if (scriptIndex == -1) {
|
||||
scriptIndex = scriptNames.size();
|
||||
@ -1925,12 +2060,12 @@ static void readScripts()
|
||||
if (scriptName == specialScripts[s])
|
||||
break;
|
||||
}
|
||||
scriptMap.append(s > 0 ? scriptsCount++ : 0);
|
||||
scriptList.append(s > 0 ? scriptsCount++ : 0);
|
||||
}
|
||||
|
||||
for (int codepoint = first; codepoint <= last; ++codepoint) {
|
||||
UnicodeData &ud = UnicodeData::valueRef(codepoint);
|
||||
ud.p.script = scriptMap.at(scriptIndex);
|
||||
ud.p.script = script;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1944,7 +2079,7 @@ static QByteArray createScriptEnumDeclaration()
|
||||
|
||||
// output the ones with special processing first
|
||||
for (int i = 1; i < scriptNames.size(); ++i) {
|
||||
if (scriptMap.at(i) == 0)
|
||||
if (scriptList.at(i) == 0)
|
||||
continue;
|
||||
declaration += ",\n ";
|
||||
declaration += scriptNames.at(i);
|
||||
@ -1953,7 +2088,7 @@ static QByteArray createScriptEnumDeclaration()
|
||||
|
||||
// output the ones that are an alias for 'Common'
|
||||
for (int i = 1; i < scriptNames.size(); ++i) {
|
||||
if (scriptMap.at(i) != 0)
|
||||
if (scriptList.at(i) != 0)
|
||||
continue;
|
||||
declaration += ",\n ";
|
||||
declaration += scriptNames.at(i);
|
||||
@ -2214,7 +2349,7 @@ static QByteArray createPropertyInfo()
|
||||
out += ", ";
|
||||
out += QByteArray::number( p.lineBreakClass );
|
||||
out += ", ";
|
||||
// " ushort script : 8; /* 5 used */\n"
|
||||
// " ushort script : 8; /* 7 used */\n"
|
||||
out += QByteArray::number( p.script );
|
||||
out += " },";
|
||||
}
|
||||
@ -2266,8 +2401,41 @@ static QByteArray createPropertyInfo()
|
||||
"\n"
|
||||
"Q_CORE_EXPORT Script QT_FASTCALL script(uint ucs4)\n"
|
||||
"{\n"
|
||||
" return (Script)qGetProp(ucs4)->script;\n"
|
||||
"}\n\n";
|
||||
" switch (qGetProp(ucs4)->script) {\n"
|
||||
" case QChar::Script_Inherited: return Inherited;\n"
|
||||
" case QChar::Script_Common: return Common;\n"
|
||||
" case QChar::Script_Arabic: return Arabic;\n"
|
||||
" case QChar::Script_Armenian: return Armenian;\n"
|
||||
" case QChar::Script_Bengali: return Bengali;\n"
|
||||
" case QChar::Script_Cyrillic: return Cyrillic;\n"
|
||||
" case QChar::Script_Devanagari: return Devanagari;\n"
|
||||
" case QChar::Script_Georgian: return Georgian;\n"
|
||||
" case QChar::Script_Greek: return Greek;\n"
|
||||
" case QChar::Script_Gujarati: return Gujarati;\n"
|
||||
" case QChar::Script_Gurmukhi: return Gurmukhi;\n"
|
||||
" case QChar::Script_Hangul: return Hangul;\n"
|
||||
" case QChar::Script_Hebrew: return Hebrew;\n"
|
||||
" case QChar::Script_Kannada: return Kannada;\n"
|
||||
" case QChar::Script_Khmer: return Khmer;\n"
|
||||
" case QChar::Script_Lao: return Lao;\n"
|
||||
" case QChar::Script_Malayalam: return Malayalam;\n"
|
||||
" case QChar::Script_Myanmar: return Myanmar;\n"
|
||||
" case QChar::Script_Ogham: return Ogham;\n"
|
||||
" case QChar::Script_Oriya: return Oriya;\n"
|
||||
" case QChar::Script_Runic: return Runic;\n"
|
||||
" case QChar::Script_Sinhala: return Sinhala;\n"
|
||||
" case QChar::Script_Syriac: return Syriac;\n"
|
||||
" case QChar::Script_Tamil: return Tamil;\n"
|
||||
" case QChar::Script_Telugu: return Telugu;\n"
|
||||
" case QChar::Script_Thaana: return Thaana;\n"
|
||||
" case QChar::Script_Thai: return Thai;\n"
|
||||
" case QChar::Script_Tibetan: return Tibetan;\n"
|
||||
" case QChar::Script_Nko: return Nko;\n"
|
||||
" default: break;\n"
|
||||
" };\n"
|
||||
" return Common;\n"
|
||||
"}\n"
|
||||
"\n";
|
||||
|
||||
return out;
|
||||
}
|
||||
@ -2725,6 +2893,7 @@ int main(int, char **)
|
||||
initWordBreak();
|
||||
initSentenceBreak();
|
||||
initLineBreak();
|
||||
initScriptMap();
|
||||
|
||||
readUnicodeData();
|
||||
readBidiMirroring();
|
||||
|
Loading…
Reference in New Issue
Block a user