[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
This commit is contained in:
Behdad Esfahbod 2018-10-11 20:20:00 -04:00
parent 00c5c4a79d
commit bdb53ca24a
6 changed files with 37 additions and 0 deletions

View File

@ -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 */
};

View File

@ -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;
}
}

View File

@ -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"

View File

@ -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 \

View File

@ -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]