summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qharfbuzz_p.h77
-rw-r--r--src/corelib/tools/qtextboundaryfinder.cpp11
-rw-r--r--src/corelib/tools/qunicodetables.cpp37
-rw-r--r--src/corelib/tools/qunicodetables_p.h111
-rw-r--r--src/corelib/tools/qunicodetools.cpp6
5 files changed, 84 insertions, 158 deletions
diff --git a/src/corelib/tools/qharfbuzz_p.h b/src/corelib/tools/qharfbuzz_p.h
index 8330921323..9efbdcb692 100644
--- a/src/corelib/tools/qharfbuzz_p.h
+++ b/src/corelib/tools/qharfbuzz_p.h
@@ -53,11 +53,86 @@
#ifndef QHARFBUZZ_P_H
#define QHARFBUZZ_P_H
-#include <QtCore/qglobal.h>
+#include <QtCore/qchar.h>
+
#include <harfbuzz-shaper.h>
QT_BEGIN_NAMESPACE
+static inline HB_Script script_to_hbscript(uchar script)
+{
+ switch (script) {
+ case QChar::Script_Inherited: return HB_Script_Inherited;
+ case QChar::Script_Common: return HB_Script_Common;
+ case QChar::Script_Arabic: return HB_Script_Arabic;
+ case QChar::Script_Armenian: return HB_Script_Armenian;
+ case QChar::Script_Bengali: return HB_Script_Bengali;
+ case QChar::Script_Cyrillic: return HB_Script_Cyrillic;
+ case QChar::Script_Devanagari: return HB_Script_Devanagari;
+ case QChar::Script_Georgian: return HB_Script_Georgian;
+ case QChar::Script_Greek: return HB_Script_Greek;
+ case QChar::Script_Gujarati: return HB_Script_Gujarati;
+ case QChar::Script_Gurmukhi: return HB_Script_Gurmukhi;
+ case QChar::Script_Hangul: return HB_Script_Hangul;
+ case QChar::Script_Hebrew: return HB_Script_Hebrew;
+ case QChar::Script_Kannada: return HB_Script_Kannada;
+ case QChar::Script_Khmer: return HB_Script_Khmer;
+ case QChar::Script_Lao: return HB_Script_Lao;
+ case QChar::Script_Malayalam: return HB_Script_Malayalam;
+ case QChar::Script_Myanmar: return HB_Script_Myanmar;
+ case QChar::Script_Ogham: return HB_Script_Ogham;
+ case QChar::Script_Oriya: return HB_Script_Oriya;
+ case QChar::Script_Runic: return HB_Script_Runic;
+ case QChar::Script_Sinhala: return HB_Script_Sinhala;
+ case QChar::Script_Syriac: return HB_Script_Syriac;
+ case QChar::Script_Tamil: return HB_Script_Tamil;
+ case QChar::Script_Telugu: return HB_Script_Telugu;
+ case QChar::Script_Thaana: return HB_Script_Thaana;
+ case QChar::Script_Thai: return HB_Script_Thai;
+ case QChar::Script_Tibetan: return HB_Script_Tibetan;
+ case QChar::Script_Nko: return HB_Script_Nko;
+ default: break;
+ };
+ return HB_Script_Common;
+}
+
+static inline uchar hbscript_to_script(uchar script)
+{
+ switch (script) {
+ case HB_Script_Inherited: return QChar::Script_Inherited;
+ case HB_Script_Common: return QChar::Script_Common;
+ case HB_Script_Arabic: return QChar::Script_Arabic;
+ case HB_Script_Armenian: return QChar::Script_Armenian;
+ case HB_Script_Bengali: return QChar::Script_Bengali;
+ case HB_Script_Cyrillic: return QChar::Script_Cyrillic;
+ case HB_Script_Devanagari: return QChar::Script_Devanagari;
+ case HB_Script_Georgian: return QChar::Script_Georgian;
+ case HB_Script_Greek: return QChar::Script_Greek;
+ case HB_Script_Gujarati: return QChar::Script_Gujarati;
+ case HB_Script_Gurmukhi: return QChar::Script_Gurmukhi;
+ case HB_Script_Hangul: return QChar::Script_Hangul;
+ case HB_Script_Hebrew: return QChar::Script_Hebrew;
+ case HB_Script_Kannada: return QChar::Script_Kannada;
+ case HB_Script_Khmer: return QChar::Script_Khmer;
+ case HB_Script_Lao: return QChar::Script_Lao;
+ case HB_Script_Malayalam: return QChar::Script_Malayalam;
+ case HB_Script_Myanmar: return QChar::Script_Myanmar;
+ case HB_Script_Ogham: return QChar::Script_Ogham;
+ case HB_Script_Oriya: return QChar::Script_Oriya;
+ case HB_Script_Runic: return QChar::Script_Runic;
+ case HB_Script_Sinhala: return QChar::Script_Sinhala;
+ case HB_Script_Syriac: return QChar::Script_Syriac;
+ case HB_Script_Tamil: return QChar::Script_Tamil;
+ case HB_Script_Telugu: return QChar::Script_Telugu;
+ case HB_Script_Thaana: return QChar::Script_Thaana;
+ case HB_Script_Thai: return QChar::Script_Thai;
+ case HB_Script_Tibetan: return QChar::Script_Tibetan;
+ case HB_Script_Nko: return QChar::Script_Nko;
+ default: break;
+ };
+ return QChar::Script_Common;
+}
+
Q_CORE_EXPORT HB_Bool qShapeItem(HB_ShaperItem *item);
// ### temporary
diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp
index 968a580725..3ffb59b3df 100644
--- a/src/corelib/tools/qtextboundaryfinder.cpp
+++ b/src/corelib/tools/qtextboundaryfinder.cpp
@@ -41,7 +41,6 @@
#include <QtCore/qtextboundaryfinder.h>
#include <QtCore/qvarlengtharray.h>
-#include <private/qunicodetables_p.h>
#include <private/qunicodetools_p.h>
QT_BEGIN_NAMESPACE
@@ -61,15 +60,15 @@ static void init(QTextBoundaryFinder::BoundaryType type, const QChar *chars, int
// correctly assign script, isTab and isObject to the script analysis
const ushort *uc = unicode;
const ushort *e = uc + length;
- int script = QUnicodeTables::Common;
- int lastScript = QUnicodeTables::Common;
+ uchar script = QChar::Script_Common;
+ uchar lastScript = QChar::Script_Common;
const ushort *start = uc;
while (uc < e) {
- int s = QUnicodeTables::script(*uc);
- if (s != QUnicodeTables::Inherited)
+ int s = QChar::script(*uc);
+ if (s != QChar::Script_Inherited)
script = s;
if (*uc == QChar::ObjectReplacementCharacter || *uc == QChar::LineSeparator || *uc == 9)
- script = QUnicodeTables::Common;
+ script = QChar::Script_Common;
if (script != lastScript) {
if (uc != start) {
QUnicodeTools::ScriptItem item;
diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp
index 927fb7462b..8b85ff7565 100644
--- a/src/corelib/tools/qunicodetables.cpp
+++ b/src/corelib/tools/qunicodetables.cpp
@@ -6724,43 +6724,6 @@ Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4)
return (LineBreakClass)qGetProp(ucs4)->lineBreakClass;
}
-Q_CORE_EXPORT Script QT_FASTCALL script(uint ucs4)
-{
- switch (qGetProp(ucs4)->script) {
- case QChar::Script_Inherited: return Inherited;
- case QChar::Script_Common: return Common;
- case QChar::Script_Arabic: return Arabic;
- case QChar::Script_Armenian: return Armenian;
- case QChar::Script_Bengali: return Bengali;
- case QChar::Script_Cyrillic: return Cyrillic;
- case QChar::Script_Devanagari: return Devanagari;
- case QChar::Script_Georgian: return Georgian;
- case QChar::Script_Greek: return Greek;
- case QChar::Script_Gujarati: return Gujarati;
- case QChar::Script_Gurmukhi: return Gurmukhi;
- case QChar::Script_Hangul: return Hangul;
- case QChar::Script_Hebrew: return Hebrew;
- case QChar::Script_Kannada: return Kannada;
- case QChar::Script_Khmer: return Khmer;
- case QChar::Script_Lao: return Lao;
- case QChar::Script_Malayalam: return Malayalam;
- case QChar::Script_Myanmar: return Myanmar;
- case QChar::Script_Ogham: return Ogham;
- case QChar::Script_Oriya: return Oriya;
- case QChar::Script_Runic: return Runic;
- case QChar::Script_Sinhala: return Sinhala;
- case QChar::Script_Syriac: return Syriac;
- case QChar::Script_Tamil: return Tamil;
- case QChar::Script_Telugu: return Telugu;
- case QChar::Script_Thaana: return Thaana;
- case QChar::Script_Thai: return Thai;
- case QChar::Script_Tibetan: return Tibetan;
- case QChar::Script_Nko: return Nko;
- default: break;
- };
- return Common;
-}
-
static const ushort specialCaseMap[] = {
0x0, // placeholder
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h
index 0aa8c1f784..bcad1d5fe3 100644
--- a/src/corelib/tools/qunicodetables_p.h
+++ b/src/corelib/tools/qunicodetables_p.h
@@ -89,113 +89,6 @@ struct Properties {
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4);
Q_CORE_EXPORT const Properties * QT_FASTCALL properties(ushort ucs2);
-// See http://www.unicode.org/reports/tr24/tr24-5.html
-enum Script {
- Common,
- Greek,
- Cyrillic,
- Armenian,
- Hebrew,
- Arabic,
- Syriac,
- Thaana,
- Devanagari,
- Bengali,
- Gurmukhi,
- Gujarati,
- Oriya,
- Tamil,
- Telugu,
- Kannada,
- Malayalam,
- Sinhala,
- Thai,
- Lao,
- Tibetan,
- Myanmar,
- Georgian,
- Hangul,
- Ogham,
- Runic,
- Khmer,
- Nko,
- Inherited,
- ScriptCount = Inherited,
- Latin = Common,
- Ethiopic = Common,
- Cherokee = Common,
- CanadianAboriginal = Common,
- Mongolian = Common,
- Hiragana = Common,
- Katakana = Common,
- Bopomofo = Common,
- Han = Common,
- Yi = Common,
- OldItalic = Common,
- Gothic = Common,
- Deseret = Common,
- Tagalog = Common,
- Hanunoo = Common,
- Buhid = Common,
- Tagbanwa = Common,
- Limbu = Common,
- TaiLe = Common,
- LinearB = Common,
- Ugaritic = Common,
- Shavian = Common,
- Osmanya = Common,
- Cypriot = Common,
- Braille = Common,
- Buginese = Common,
- Coptic = Common,
- NewTaiLue = Common,
- Glagolitic = Common,
- Tifinagh = Common,
- SylotiNagri = Common,
- OldPersian = Common,
- Kharoshthi = Common,
- Balinese = Common,
- Cuneiform = Common,
- Phoenician = Common,
- PhagsPa = Common,
- Sundanese = Common,
- Lepcha = Common,
- OlChiki = Common,
- Vai = Common,
- Saurashtra = Common,
- KayahLi = Common,
- Rejang = Common,
- Lycian = Common,
- Carian = Common,
- Lydian = Common,
- Cham = Common,
- TaiTham = Common,
- TaiViet = Common,
- Avestan = Common,
- EgyptianHieroglyphs = Common,
- Samaritan = Common,
- Lisu = Common,
- Bamum = Common,
- Javanese = Common,
- MeeteiMayek = Common,
- ImperialAramaic = Common,
- OldSouthArabian = Common,
- InscriptionalParthian = Common,
- InscriptionalPahlavi = Common,
- OldTurkic = Common,
- Kaithi = Common,
- Batak = Common,
- Brahmi = Common,
- Mandaic = Common,
- Chakma = Common,
- MeroiticCursive = Common,
- MeroiticHieroglyphs = Common,
- Miao = Common,
- Sharada = Common,
- SoraSompeng = Common,
- Takri = Common
-};
-
enum GraphemeBreakClass {
GraphemeBreak_Other,
GraphemeBreak_CR,
@@ -274,10 +167,6 @@ Q_CORE_EXPORT LineBreakClass QT_FASTCALL lineBreakClass(uint ucs4);
inline LineBreakClass lineBreakClass(QChar ch)
{ return lineBreakClass(ch.unicode()); }
-Q_CORE_EXPORT Script QT_FASTCALL script(uint ucs4);
-inline Script script(QChar ch)
-{ return script(ch.unicode()); }
-
} // namespace QUnicodeTables
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qunicodetools.cpp b/src/corelib/tools/qunicodetools.cpp
index e86fef61e7..8bafb692ca 100644
--- a/src/corelib/tools/qunicodetools.cpp
+++ b/src/corelib/tools/qunicodetools.cpp
@@ -44,7 +44,7 @@
#include "qunicodetables_p.h"
#include "qvarlengtharray.h"
-#include <harfbuzz-shaper.h>
+#include "qharfbuzz_p.h"
#define FLAG(x) (1 << (x))
@@ -615,7 +615,7 @@ Q_CORE_EXPORT void initCharAttributes(const ushort *string, int length,
HB_ScriptItem item;
item.pos = items[start].position;
item.length = items[i].position - items[start].position;
- item.script = (HB_Script)items[start].script;
+ item.script = script_to_hbscript(items[start].script);
item.bidiLevel = 0; // unused
scriptItems.append(item);
start = i;
@@ -624,7 +624,7 @@ Q_CORE_EXPORT void initCharAttributes(const ushort *string, int length,
HB_ScriptItem item;
item.pos = items[start].position;
item.length = length - items[start].position;
- item.script = (HB_Script)items[start].script;
+ item.script = script_to_hbscript(items[start].script);
item.bidiLevel = 0; // unused
scriptItems.append(item);
}