src/hb-graphite2.cc | 5 - src/hb-ot-shape-complex-myanmar.cc | 35 ++++++++-- src/hb-ot-shape-complex.hh | 5 + src/hb-ot-tag.cc | 5 - src/hb.hh | 8 ++ test/shaping/data/in-house/Makefile.sources | 1 test/shaping/data/in-house/fonts/ab14b4eb9d7a67e293f51d30d719add06c9d6e06.ttf |binary test/shaping/data/in-house/tests/myanmar-zawgyi.tests | 1 8 files changed, 49 insertions(+), 11 deletions(-)
New commits: commit bdb53ca24a5ad9671d8e29e17d1d8981505bd882 Author: Behdad Esfahbod <beh...@behdad.org> Date: Thu Oct 11 20:20:00 2018 -0400 [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 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 Binary files /dev/null and b/test/shaping/data/in-house/fonts/ab14b4eb9d7a67e293f51d30d719add06c9d6e06.ttf 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] commit 00c5c4a79dfb352a679a5c56bf9c756ab0fa98d2 Author: Behdad Esfahbod <beh...@behdad.org> Date: Thu Oct 11 20:15:31 2018 -0400 [myanmar] Shuffle diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index bebb8ec5..eac408ea 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -375,40 +375,41 @@ final_reordering (const hb_ot_shape_plan_t *plan, } -/* Uniscribe seems to have a shaper for 'mymr' that is like the - * generic shaper, except that it zeros mark advances GDEF_LATE. */ -const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old = +const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar = { - nullptr, /* collect_features */ - nullptr, /* override_features */ + collect_features_myanmar, + override_features_myanmar, nullptr, /* data_create */ nullptr, /* data_destroy */ nullptr, /* preprocess_text */ nullptr, /* postprocess_glyphs */ - HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, + HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, nullptr, /* decompose */ nullptr, /* compose */ - nullptr, /* setup_masks */ + setup_masks_myanmar, HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ - HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, - true, /* fallback_position */ + HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, + false, /* fallback_position */ }; -const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar = + +/* Uniscribe seems to have a shaper for 'mymr' that is like the + * generic shaper, except that it zeros mark advances GDEF_LATE. */ +const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old = { - collect_features_myanmar, - override_features_myanmar, + nullptr, /* collect_features */ + nullptr, /* override_features */ nullptr, /* data_create */ nullptr, /* data_destroy */ nullptr, /* preprocess_text */ nullptr, /* postprocess_glyphs */ - HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT, + HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, nullptr, /* decompose */ nullptr, /* compose */ - setup_masks_myanmar, + nullptr, /* setup_masks */ HB_TAG_NONE, /* gpos_tag */ nullptr, /* reorder_marks */ - HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY, - false, /* fallback_position */ + HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, + true, /* fallback_position */ }; commit ec8f493bf9fefc33f027db24c4b175990b2d751c Author: Behdad Esfahbod <beh...@behdad.org> Date: Thu Oct 11 20:15:00 2018 -0400 [graphite] Remove assert diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index 7f3cbfdf..e8d7c348 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -33,6 +33,8 @@ #include <graphite2/Segment.h> +#include "hb-ot-tag.h" + HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, face) HB_SHAPER_DATA_ENSURE_DEFINE(graphite2, font) @@ -284,10 +286,9 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, &count, script_tag, nullptr, nullptr); - assert (count); seg = gr_make_seg (nullptr, grface, - script_tag[count - 1], + count ? script_tag[count - 1] : HB_OT_TAG_DEFAULT_SCRIPT, feats, gr_utf32, chars, buffer->len, 2 | (hb_buffer_get_direction (buffer) == HB_DIRECTION_RTL ? 1 : 0)); commit 5646dcbd1125049c3af342fadfcfcbd523ce53d3 Author: Behdad Esfahbod <beh...@behdad.org> Date: Thu Oct 11 19:39:07 2018 -0400 Minor diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc index 301645fa..b7c7c4ad 100644 --- a/src/hb-ot-tag.cc +++ b/src/hb-ot-tag.cc @@ -36,7 +36,8 @@ hb_ot_old_tag_from_script (hb_script_t script) { /* This seems to be accurate as of end of 2012. */ - switch ((hb_tag_t) script) { + switch ((hb_tag_t) script) + { case HB_SCRIPT_INVALID: return HB_OT_TAG_DEFAULT_SCRIPT; /* KATAKANA and HIRAGANA both map to 'kana' */ @@ -49,8 +50,6 @@ hb_ot_old_tag_from_script (hb_script_t script) case HB_SCRIPT_NKO: return HB_TAG('n','k','o',' '); /* Unicode-5.1 additions */ case HB_SCRIPT_VAI: return HB_TAG('v','a','i',' '); - /* Unicode-5.2 additions */ - /* Unicode-6.0 additions */ } /* Else, just change first char to lowercase and return */ _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz