summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2014-07-23 16:48:51 -0400
committerBehdad Esfahbod <behdad@behdad.org>2014-07-23 16:53:03 -0400
commitfc0daafab0336b847ac14682e581a8838f36a0bf (patch)
treef2f38f52f4c6b39d4845653e4686f338f7da2528
parentd6d349d17898529ecdf8217a54987a3e9f81ce05 (diff)
[indic] Handle old-spec Malayalam reordering with final Halant
See comment. Micro-tests added.
-rw-r--r--src/hb-ot-shape-complex-indic.cc28
-rw-r--r--test/shaping/Makefile.am1
-rw-r--r--test/shaping/fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttfbin0 -> 3428 bytes
-rw-r--r--test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttfbin0 -> 2272 bytes
-rw-r--r--test/shaping/fonts/sha1sum/MANIFEST2
-rw-r--r--test/shaping/tests/MANIFEST1
-rw-r--r--test/shaping/tests/indic-old-spec.tests2
-rw-r--r--test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt1
8 files changed, 30 insertions, 5 deletions
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 33215a30..be5d574b 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -921,14 +921,32 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
info[start].indic_position() = POS_RA_TO_BECOME_REPH;
/* For old-style Indic script tags, move the first post-base Halant after
- * last consonant. Only do this if there is *not* a Halant after last
- * consonant. Otherwise it becomes messy. */
- if (indic_plan->is_old_spec) {
+ * last consonant.
+ *
+ * Reports suggest that in some scripts Uniscribe does this only if there
+ * is *not* a Halant after last consonant already (eg. Kannada), while it
+ * does it unconditionally in other scripts (eg. Malayalam). We don't
+ * currently know about other scripts, so we single out Malayalam for now.
+ *
+ * Kannada test case:
+ * U+0C9A,U+0CCD,U+0C9A,U+0CCD
+ * With some versions of Lohit Kannada.
+ * https://bugs.freedesktop.org/show_bug.cgi?id=59118
+ *
+ * Malayalam test case:
+ * U+0D38,U+0D4D,U+0D31,U+0D4D,U+0D31,U+0D4D
+ * With lohit-ttf-20121122/Lohit-Malayalam.ttf
+ */
+ if (indic_plan->is_old_spec)
+ {
+ bool disallow_double_halants = buffer->props.script != HB_SCRIPT_MALAYALAM;
for (unsigned int i = base + 1; i < end; i++)
- if (info[i].indic_category() == OT_H) {
+ if (info[i].indic_category() == OT_H)
+ {
unsigned int j;
for (j = end - 1; j > i; j--)
- if (is_consonant (info[j]) || info[j].indic_category() == OT_H)
+ if (is_consonant (info[j]) ||
+ (disallow_double_halants && info[j].indic_category() == OT_H))
break;
if (info[j].indic_category() != OT_H && j > i) {
/* Move Halant to after last consonant. */
diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am
index 4cc79b8f..c2c4db69 100644
--- a/test/shaping/Makefile.am
+++ b/test/shaping/Makefile.am
@@ -38,6 +38,7 @@ CLEANFILES += \
TESTS = \
tests/arabic-feature-order.tests \
tests/context-matching.tests \
+ tests/indic-old-spec.tests \
tests/indic-pref-blocking.tests \
tests/mongolian-variation-selector.tests \
$(NULL)
diff --git a/test/shaping/fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf b/test/shaping/fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf
new file mode 100644
index 00000000..fc226491
--- /dev/null
+++ b/test/shaping/fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf
Binary files differ
diff --git a/test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf b/test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf
new file mode 100644
index 00000000..746fc603
--- /dev/null
+++ b/test/shaping/fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf
Binary files differ
diff --git a/test/shaping/fonts/sha1sum/MANIFEST b/test/shaping/fonts/sha1sum/MANIFEST
index cd2ede5e..4aaa54d5 100644
--- a/test/shaping/fonts/sha1sum/MANIFEST
+++ b/test/shaping/fonts/sha1sum/MANIFEST
@@ -1,6 +1,8 @@
226bc2deab3846f1a682085f70c67d0421014144.ttf
+270b89df543a7e48e206a2d830c0e10e5265c630.ttf
37033cc5cf37bb223d7355153016b6ccece93b28.ttf
4cce528e99f600ed9c25a2b69e32eb94a03b4ae8.ttf
+57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf
813c2f8e5512187fd982417a7fb4286728e6f4a8.ttf
8a9fea2a7384f2116e5b84a9b31f83be7850ce21.ttf
a919b33197965846f21074b24e30250d67277bce.ttf
diff --git a/test/shaping/tests/MANIFEST b/test/shaping/tests/MANIFEST
index 1b577c7c..a792e91b 100644
--- a/test/shaping/tests/MANIFEST
+++ b/test/shaping/tests/MANIFEST
@@ -1,4 +1,5 @@
arabic-feature-order.tests
context-matching.tests
+indic-old-spec.tests
indic-pref-blocking.tests
mongolian-variation-selector.tests
diff --git a/test/shaping/tests/indic-old-spec.tests b/test/shaping/tests/indic-old-spec.tests
new file mode 100644
index 00000000..96e8cdd3
--- /dev/null
+++ b/test/shaping/tests/indic-old-spec.tests
@@ -0,0 +1,2 @@
+fonts/sha1sum/57a9d9f83020155cbb1d2be1f43d82388cbecc88.ttf:U+0C9A,U+0CCD,U+0C9A,U+0CCD:[U0C9A_U0CCD.haln=0+1066|U0C9A_0CCD.blwf=0+0]
+fonts/sha1sum/270b89df543a7e48e206a2d830c0e10e5265c630.ttf:U+0D38,U+0D4D,U+0D31,U+0D4D,U+0D31,U+0D4D:[glyph201=0+1183|U0D4D=0+0]
diff --git a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
index c5144f0f..2e732ae8 100644
--- a/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
+++ b/test/shaping/texts/in-tree/shaper-indic/indic/script-malayalam/misc/misc.txt
@@ -62,3 +62,4 @@
ശിം‌
കോം‌
യ‍്യ
+സ്റ്റ്