summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2018-10-11 20:20:00 -0400
committerBehdad Esfahbod <behdad@behdad.org>2018-10-11 20:20:29 -0400
commitbdb53ca24a5ad9671d8e29e17d1d8981505bd882 (patch)
tree9f7932d713bd9d95798e3f8c8c3529ec0236f76f
parent00c5c4a79dfb352a679a5c56bf9c756ab0fa98d2 (diff)
[myanmar] Implement Zawgyi shaper
Enabled if script tag 'Qaag' is passed to HarfBuzz. Disables mark advance-zeroing and fallback mark-positioning. Fixes https://github.com/harfbuzz/harfbuzz/issues/1162
-rw-r--r--src/hb-ot-shape-complex-myanmar.cc22
-rw-r--r--src/hb-ot-shape-complex.hh5
-rw-r--r--src/hb.hh8
-rw-r--r--test/shaping/data/in-house/Makefile.sources1
-rw-r--r--test/shaping/data/in-house/fonts/ab14b4eb9d7a67e293f51d30d719add06c9d6e06.ttfbin0 -> 1792 bytes
-rw-r--r--test/shaping/data/in-house/tests/myanmar-zawgyi.tests1
6 files changed, 37 insertions, 0 deletions
diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc
index eac408ea..e201a230 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
@@ -413,3 +413,25 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old =
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
+
+
+/* Ugly Zawgyi encoding.
+ * Disable all auto processing.
+ * https://github.com/harfbuzz/harfbuzz/issues/1162 */
+const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_zawgyi =
+{
+ nullptr, /* collect_features */
+ nullptr, /* override_features */
+ nullptr, /* data_create */
+ nullptr, /* data_destroy */
+ nullptr, /* preprocess_text */
+ nullptr, /* postprocess_glyphs */
+ HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
+ nullptr, /* decompose */
+ nullptr, /* compose */
+ nullptr, /* setup_masks */
+ HB_TAG_NONE, /* gpos_tag */
+ nullptr, /* reorder_marks */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
+ false, /* fallback_position */
+};
diff --git a/src/hb-ot-shape-complex.hh b/src/hb-ot-shape-complex.hh
index f5ef1102..216966d2 100644
--- a/src/hb-ot-shape-complex.hh
+++ b/src/hb-ot-shape-complex.hh
@@ -58,6 +58,7 @@ enum hb_ot_shape_zero_width_marks_type_t {
HB_COMPLEX_SHAPER_IMPLEMENT (khmer) \
HB_COMPLEX_SHAPER_IMPLEMENT (myanmar) \
HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_old) \
+ HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_zawgyi) \
HB_COMPLEX_SHAPER_IMPLEMENT (thai) \
HB_COMPLEX_SHAPER_IMPLEMENT (use) \
/* ^--- Add new shapers here */
@@ -374,6 +375,10 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
return &_hb_ot_complex_shaper_default;
else
return &_hb_ot_complex_shaper_use;
+
+ /* https://github.com/harfbuzz/harfbuzz/issues/1162 */
+ case HB_SCRIPT_MYANMAR_ZAWGYI:
+ return &_hb_ot_complex_shaper_myanmar_zawgyi;
}
}
diff --git a/src/hb.hh b/src/hb.hh
index f37be7ad..5d0396a6 100644
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -478,6 +478,14 @@ _hb_memalign(void **memptr, size_t alignment, size_t size)
#endif
+/*
+ * For lack of a better place, put Zawgyi script hack here.
+ * https://github.com/harfbuzz/harfbuzz/issues/1162
+ */
+
+#define HB_SCRIPT_MYANMAR_ZAWGYI ((hb_script_t) HB_TAG ('Q','a','a','g'))
+
+
/* Headers we include for everyone. Keep sorted. They express dependency amongst
* themselves, but no other file should include them.*/
#include "hb-atomic.hh"
diff --git a/test/shaping/data/in-house/Makefile.sources b/test/shaping/data/in-house/Makefile.sources
index e66f0a65..d0a3f1f6 100644
--- a/test/shaping/data/in-house/Makefile.sources
+++ b/test/shaping/data/in-house/Makefile.sources
@@ -37,6 +37,7 @@ TESTS = \
tests/mark-filtering-sets.tests \
tests/mongolian-variation-selector.tests \
tests/myanmar-syllable.tests \
+ tests/myanmar-zawgyi.tests \
tests/none-directional.tests \
tests/rand.tests \
tests/spaces.tests \
diff --git a/test/shaping/data/in-house/fonts/ab14b4eb9d7a67e293f51d30d719add06c9d6e06.ttf b/test/shaping/data/in-house/fonts/ab14b4eb9d7a67e293f51d30d719add06c9d6e06.ttf
new file mode 100644
index 00000000..a64eceac
--- /dev/null
+++ b/test/shaping/data/in-house/fonts/ab14b4eb9d7a67e293f51d30d719add06c9d6e06.ttf
Binary files differ
diff --git a/test/shaping/data/in-house/tests/myanmar-zawgyi.tests b/test/shaping/data/in-house/tests/myanmar-zawgyi.tests
new file mode 100644
index 00000000..b79d4fb4
--- /dev/null
+++ b/test/shaping/data/in-house/tests/myanmar-zawgyi.tests
@@ -0,0 +1 @@
+../fonts/ab14b4eb9d7a67e293f51d30d719add06c9d6e06.ttf:--script=Qaag:U+1000,U+103A,U+1004,U+1037,U+1039,U+1041:[Ka=0+2217|Ya-Semivowel=0+286|Nga=2+1247|Dot Below=2+0|Virama-Killer=2+0|One-Myanmar=5+1247]