summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/harfbuzz')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-arabic.c60
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp10
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp8
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.h2
-rw-r--r--src/3rdparty/harfbuzz/tests/shaping/main.cpp49
5 files changed, 121 insertions, 8 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
index 4d85c19277..3837087f44 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-arabic.c
@@ -489,6 +489,56 @@ static void getArabicProperties(const unsigned short *chars, int len, HB_ArabicP
*/
}
+static Joining getNkoJoining(unsigned short uc)
+{
+ if (uc < 0x7ca)
+ return JNone;
+ if (uc <= 0x7ea)
+ return JDual;
+ if (uc <= 0x7f3)
+ return JTransparent;
+ if (uc <= 0x7f9)
+ return JNone;
+ if (uc == 0x7fa)
+ return JCausing;
+ return JNone;
+}
+
+static void getNkoProperties(const unsigned short *chars, int len, HB_ArabicProperties *properties)
+{
+ int lastPos = 0;
+ int i = 0;
+
+ Joining j = getNkoJoining(chars[0]);
+ ArabicShape shape = joining_table[XIsolated][j].form2;
+ properties[0].justification = HB_NoJustification;
+
+ for (i = 1; i < len; ++i) {
+ properties[i].justification = (HB_GetUnicodeCharCategory(chars[i]) == HB_Separator_Space) ?
+ ArabicSpace : ArabicNone;
+
+ j = getNkoJoining(chars[i]);
+
+ if (j == JTransparent) {
+ properties[i].shape = XIsolated;
+ continue;
+ }
+
+ properties[lastPos].shape = joining_table[shape][j].form1;
+ shape = joining_table[shape][j].form2;
+
+
+ lastPos = i;
+ }
+ properties[lastPos].shape = joining_table[shape][JNone].form1;
+
+
+ /*
+ for (int i = 0; i < len; ++i)
+ qDebug("nko properties(%d): uc=%x shape=%d, justification=%d", i, chars[i], properties[i].shape, properties[i].justification);
+ */
+}
+
/*
// The unicode to unicode shaping codec.
// does only presentation forms B at the moment, but that should be enough for
@@ -1012,7 +1062,10 @@ static HB_Bool arabicSyriacOpenTypeShape(HB_ShaperItem *item, HB_Bool *ot_ok)
if (f + l + item->item.pos < item->stringLength) {
++l;
}
- getArabicProperties(uc+f, l, props);
+ if (item->item.script == HB_Script_Nko)
+ getNkoProperties(uc+f, l, props);
+ else
+ getArabicProperties(uc+f, l, props);
for (i = 0; i < (int)item->num_glyphs; i++) {
apply[i] = 0;
@@ -1051,7 +1104,8 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item)
HB_Bool haveGlyphs;
HB_STACKARRAY(HB_UChar16, shapedChars, item->item.length);
- assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac);
+ assert(item->item.script == HB_Script_Arabic || item->item.script == HB_Script_Syriac
+ || item->item.script == HB_Script_Nko);
#ifndef NO_OPENTYPE
@@ -1065,7 +1119,7 @@ HB_Bool HB_ArabicShape(HB_ShaperItem *item)
}
#endif
- if (item->item.script == HB_Script_Syriac)
+ if (item->item.script != HB_Script_Arabic)
return HB_BasicShape(item);
shapedString(item->string, item->stringLength, item->item.pos, item->item.length, shapedChars, &slen,
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
index 48f4f908a8..3008fca993 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-indic.cpp
@@ -566,7 +566,7 @@ static const unsigned char indicPosition[0xe00-0x900] = {
None, None, None, None,
None, None, None, None,
- None, None, None, None,
+ Below, None, None, None,
None, None, None, None,
None, None, None, None,
None, None, None, None,
@@ -1252,7 +1252,9 @@ static bool indic_shape_syllable(HB_Bool openType, HB_ShaperItem *item, bool inv
// farther than 3 consonants from the end of the syllable.
// #### replace the HasReph property by testing if the feature exists in the font!
if (form(*uc) == Consonant || (script == HB_Script_Bengali && form(*uc) == IndependentVowel)) {
- beginsWithRa = (properties & HasReph) && ((len > 2) && *uc == ra && *(uc+1) == halant);
+ if ((properties & HasReph) && (len > 2) &&
+ (*uc == ra || *uc == 0x9f0) && *(uc+1) == halant)
+ beginsWithRa = true;
if (beginsWithRa && form(*(uc+2)) == Control)
beginsWithRa = false;
@@ -1744,6 +1746,10 @@ static int indic_nextSyllableBoundary(HB_Script script, const HB_UChar16 *s, int
++pos;
continue;
}
+ if (script == HB_Script_Malayalam && state == Matra && uc[pos-1] == 0x0d41) {
+ ++pos;
+ continue;
+ }
goto finish;
case Nukta:
if (state == Consonant)
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
index f92bb55c9c..f3ec8e10f5 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
@@ -637,7 +637,9 @@ const HB_ScriptEngine HB_ScriptEngines[] = {
// Runic
{ HB_BasicShape, 0 },
// Khmer
- { HB_KhmerShape, HB_KhmerAttributes }
+ { HB_KhmerShape, HB_KhmerAttributes },
+ // N'Ko
+ { HB_ArabicShape, 0}
};
void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
@@ -877,7 +879,9 @@ static const OTScripts ot_scripts [] = {
// Runic
{ HB_MAKE_TAG('r', 'u', 'n', 'r'), 0 },
// Khmer
- { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 }
+ { HB_MAKE_TAG('k', 'h', 'm', 'r'), 1 },
+ // N'Ko
+ { HB_MAKE_TAG('n', 'k', 'o', ' '), 1 }
};
enum { NumOTScripts = sizeof(ot_scripts)/sizeof(OTScripts) };
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
index d2357f4301..f7c7714743 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
@@ -62,6 +62,7 @@ typedef enum {
HB_Script_Ogham,
HB_Script_Runic,
HB_Script_Khmer,
+ HB_Script_Nko,
HB_Script_Inherited,
HB_ScriptCount = HB_Script_Inherited
/*
@@ -102,7 +103,6 @@ typedef enum {
HB_Script_Cuneiform = Common,
HB_Script_Phoenician = Common,
HB_Script_PhagsPa = Common,
- HB_Script_Nko = Common
*/
} HB_Script;
diff --git a/src/3rdparty/harfbuzz/tests/shaping/main.cpp b/src/3rdparty/harfbuzz/tests/shaping/main.cpp
index a7ea417470..12fa7c48f2 100644
--- a/src/3rdparty/harfbuzz/tests/shaping/main.cpp
+++ b/src/3rdparty/harfbuzz/tests/shaping/main.cpp
@@ -181,6 +181,7 @@ private slots:
void sinhala();
void khmer();
+ void nko();
void linearB();
};
@@ -515,6 +516,12 @@ void tst_QScriptEngine::bengali()
{ 0x179, 0x151, 0x172, 0x0 } },
{ { 0x995, 0x9c7, 0x9d7, 0x0 },
{ 0x179, 0x151, 0x17e, 0x0 } },
+ { { 0x9b0, 0x9cd, 0x9ad, 0x0 },
+ { 0x168, 0x276, 0x0 } },
+ { { 0x9f0, 0x9cd, 0x9ad, 0x0 },
+ { 0x168, 0x276, 0x0 } },
+ { { 0x9f1, 0x9cd, 0x9ad, 0x0 },
+ { 0x191, 0x17d, 0x168, 0x0 } },
{ {0}, {0} }
};
@@ -652,6 +659,12 @@ void tst_QScriptEngine::bengali()
{ 0x01fe, 0x0 } },
{ { 0x09b0, 0x09cd, 0x09a8, 0x09cd, 0x200d, 0x0 },
{ 0x10b, 0x167, 0x0 } },
+ { { 0x9b0, 0x9cd, 0x9ad, 0x0 },
+ { 0xa1, 0x167, 0x0 } },
+ { { 0x9f0, 0x9cd, 0x9ad, 0x0 },
+ { 0xa1, 0x167, 0x0 } },
+ { { 0x9f1, 0x9cd, 0x9ad, 0x0 },
+ { 0x11c, 0xa1, 0x0 } },
{ {0}, {0} }
};
@@ -967,6 +980,8 @@ void tst_QScriptEngine::malayalam()
{ 0x5e, 0x34, 0x65, 0x0 } },
{ { 0xd15, 0xd57, 0x0 },
{ 0x34, 0x65, 0x0 } },
+ { { 0xd1f, 0xd4d, 0xd1f, 0xd41, 0xd4d, 0x0 },
+ { 0x69, 0x5b, 0x64, 0x0 } },
{ {0}, {0} }
};
@@ -1061,6 +1076,40 @@ void tst_QScriptEngine::khmer()
}
}
+void tst_QScriptEngine::nko()
+{
+ {
+ FT_Face face = loadFace("DejaVuSans.ttf");
+ if (face) {
+ const ShapeTable shape_table [] = {
+ { { 0x7ca, 0x0 },
+ { 0x5c1, 0x0 } },
+ { { 0x7ca, 0x7ca, 0x0 },
+ { 0x14db, 0x14d9, 0x0 } },
+ { { 0x7ca, 0x7fa, 0x7ca, 0x0 },
+ { 0x14db, 0x5ec, 0x14d9, 0x0 } },
+ { { 0x7ca, 0x7f3, 0x7ca, 0x0 },
+ { 0x14db, 0x5e7, 0x14d9, 0x0 } },
+ { { 0x7ca, 0x7f3, 0x7fa, 0x7ca, 0x0 },
+ { 0x14db, 0x5e7, 0x5ec, 0x14d9, 0x0 } },
+ { {0}, {0} }
+ };
+
+
+ const ShapeTable *s = shape_table;
+ while (s->unicode[0]) {
+ QVERIFY( shaping(face, s, HB_Script_Nko) );
+ ++s;
+ }
+
+ FT_Done_Face(face);
+ } else {
+ QSKIP("couln't find DejaVuSans.ttf", SkipAll);
+ }
+ }
+}
+
+
void tst_QScriptEngine::linearB()
{
{