From bdb53ca24a5ad9671d8e29e17d1d8981505bd882 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 11 Oct 2018 20:20:00 -0400 Subject: [PATCH] [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 --- src/hb-ot-shape-complex-myanmar.cc | 22 ++++++++++++++++++ src/hb-ot-shape-complex.hh | 5 ++++ src/hb.hh | 8 +++++++ test/shaping/data/in-house/Makefile.sources | 1 + ...14b4eb9d7a67e293f51d30d719add06c9d6e06.ttf | Bin 0 -> 1792 bytes .../data/in-house/tests/myanmar-zawgyi.tests | 1 + 6 files changed, 37 insertions(+) create mode 100644 test/shaping/data/in-house/fonts/ab14b4eb9d7a67e293f51d30d719add06c9d6e06.ttf create mode 100644 test/shaping/data/in-house/tests/myanmar-zawgyi.tests diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index eac408ea7..e201a2309 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 f5ef11027..216966d2e 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 f37be7ad0..5d0396a67 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 e66f0a65d..d0a3f1f64 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 0000000000000000000000000000000000000000..a64eceac6d9a76c1a86f0eded4712ae07ccd8665 GIT binary patch literal 1792 zcmbVNZ){Ul6hHU9+t-c_=(=vh@n??~Hc>X9-PV9;*oLrdY)pnroFnqKy|u&sS-J|$ zK_c))7J}0y1eaj;LCL5vrY3w)6E$o>1iu&!!DS%* zch2vgd+s^sz7iv%EP9PZ+O)Ol`6}g<(n}=GKwGfAX^pGJIUXkxj{!Hg2b6Ak*V^xa zb^A82($h`(lmY&?z*eunxAT*_ST*FUL_(fVRXVO^o!bMx9l8o16xr=&0oVt;!WW3_ zU;O&)DDXDmCH_#m!p4Oyz#P~bQ1*9|liA=)-%k!I0o9dT^9>PS3*E-4XnQzK_@vcjFU+IMWd#@3CUWA1zGDeYpswpMzqxp4Hxk0WQVvxIi#;v4VW zicU>Me;yiKHOw0BvobBgxc1fExHe()^enu7?!6x-&ms`w#Q7H9L5lz+v*dJ8xe_#LY zap1wU_C)d+Wl|12JBrH7D%`HTT)QMXa_w$cdD(;KUVL@`uGWJGTdS&`eK38nrM0iG zwY85GRBzslGO_#T`3~)td61UqkvSdZrR-ruo?PIx$9zd^;1 zjSXKbtdX(=slD%5uAMK$&IjA zre<-N4htVxNXV49XyRPZZ^xXczDbs8la;KM8M_m;)RD1UydX1{lpjyi818rKrgPc^ zT^52Bh+_q}daN6)mB}P7Tneq%(XT9~#jeJ##3ueF&KBJp$GvBJ;VUIGvIC`Lfflg- zv@Fsxb}}vVM>r;0%`T+%lA%9CGP!6ie&vu_NI^xs)Jt8s%|TKr0&NlAO7c@TZo2}x z9%B$yRiIPAElu0~n8R4<1usH922wGr(C)?90p@&~M?0~~MpRKR4t_WG`rE(mPlhgRSoA$2u**Q580+D;-LUl-8vPvAkiuAzilQED{TzA} zVOYI5O|NmrR6JqC@!$Kl8GHTTd_B6Zgti-*-hutR^oo(w@SI9KWNaWeVqZu2jHPFp z8gM2(w*hLysGq|H#%g0uRW*H2(4mLZeK~hBqoV{SGR{m)VrHRE5gWWp#^z8&u2TJ> zee;{U!b(6Xsq6Cl)o|7eN=cI%=-M0Fr}{Iu2i21LUL_b%!bVT({cXiRLQ?NBXy)OI PvWS=xR@%_}e?5N!l+cTj literal 0 HcmV?d00001 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 000000000..b79d4fb40 --- /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]