From 6f2d9ba52a6d1e3fc200da1ef0e85ba020fcd0dc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 26 Jul 2014 19:17:44 -0400 Subject: [PATCH] Add old-Myanmar shaper Looks like Unsicribe responds to the 'mymr' tag by zeroing marks GDEF_LATE instead of generic-shaper UNICODE_LATE. Implement that. Fixes Bug 81775 - Incorrect Rendering with harfbuzz-ng myanmar unicode https://bugs.freedesktop.org/show_bug.cgi?id=81775 Micro-test added based on Padauk. --- src/hb-ot-shape-complex-myanmar.cc | 18 ++++++++++++++++++ src/hb-ot-shape-complex-private.hh | 5 +++-- test/shaping/Makefile.am | 1 + test/shaping/fonts/sha1sum/MANIFEST | 1 + ...9473d2403488714043bcfb946c9f78b86ad627.ttf | Bin 0 -> 3440 bytes test/shaping/tests/MANIFEST | 1 + test/shaping/tests/zero-width-marks.tests | 1 + 7 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 test/shaping/fonts/sha1sum/bb9473d2403488714043bcfb946c9f78b86ad627.ttf create mode 100644 test/shaping/tests/zero-width-marks.tests diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index 258ccc470..d016380cc 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -536,6 +536,24 @@ 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 = +{ + "default", + NULL, /* collect_features */ + NULL, /* override_features */ + NULL, /* data_create */ + NULL, /* data_destroy */ + NULL, /* preprocess_text */ + HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT, + NULL, /* decompose */ + NULL, /* compose */ + NULL, /* setup_masks */ + HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE, + true, /* fallback_position */ +}; + const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar = { "myanmar", diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh index 3e581afa9..9a7afcbd7 100644 --- a/src/hb-ot-shape-complex-private.hh +++ b/src/hb-ot-shape-complex-private.hh @@ -56,6 +56,7 @@ enum hb_ot_shape_zero_width_marks_type_t { HB_COMPLEX_SHAPER_IMPLEMENT (arabic) \ HB_COMPLEX_SHAPER_IMPLEMENT (hangul) \ HB_COMPLEX_SHAPER_IMPLEMENT (hebrew) \ + HB_COMPLEX_SHAPER_IMPLEMENT (myanmar_old) \ HB_COMPLEX_SHAPER_IMPLEMENT (indic) \ HB_COMPLEX_SHAPER_IMPLEMENT (myanmar) \ HB_COMPLEX_SHAPER_IMPLEMENT (sea) \ @@ -329,10 +330,10 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) return &_hb_ot_complex_shaper_default; case HB_SCRIPT_MYANMAR: - /* For Myanmar, we only want to use the Myanmar shaper if the "new" script - * tag is found. For "old" script tag we want to use the default shaper. */ if (planner->map.chosen_script[0] == HB_TAG ('m','y','m','2')) return &_hb_ot_complex_shaper_myanmar; + else if (planner->map.chosen_script[0] == HB_TAG ('m','y','m','r')) + return &_hb_ot_complex_shaper_myanmar_old; else return &_hb_ot_complex_shaper_default; diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am index c2c4db69e..f40f2ffff 100644 --- a/test/shaping/Makefile.am +++ b/test/shaping/Makefile.am @@ -41,6 +41,7 @@ TESTS = \ tests/indic-old-spec.tests \ tests/indic-pref-blocking.tests \ tests/mongolian-variation-selector.tests \ + tests/zero-width-marks.tests \ $(NULL) TEST_EXTENSIONS = \ diff --git a/test/shaping/fonts/sha1sum/MANIFEST b/test/shaping/fonts/sha1sum/MANIFEST index 4aaa54d57..0e9da647c 100644 --- a/test/shaping/fonts/sha1sum/MANIFEST +++ b/test/shaping/fonts/sha1sum/MANIFEST @@ -7,6 +7,7 @@ 8a9fea2a7384f2116e5b84a9b31f83be7850ce21.ttf a919b33197965846f21074b24e30250d67277bce.ttf bb29ce50df2bdba2d10726427c6b7609bf460e04.ttf +bb9473d2403488714043bcfb946c9f78b86ad627.ttf d629e7fedc0b350222d7987345fe61613fa3929a.ttf e207635780b42f898d58654b65098763e340f5c7.ttf ef86fe710cfea877bbe0dbb6946a1f88d0661031.ttf diff --git a/test/shaping/fonts/sha1sum/bb9473d2403488714043bcfb946c9f78b86ad627.ttf b/test/shaping/fonts/sha1sum/bb9473d2403488714043bcfb946c9f78b86ad627.ttf new file mode 100644 index 0000000000000000000000000000000000000000..b16dae6c575657c9de6b446147d688729fc65542 GIT binary patch literal 3440 zcmb7`ZERat8ONV{uXFR-*3G)uolR#qZE{J|IE}O9QdM5kB`JNOO`EQ@Ls{d+Zjv@$ z(=_cGC|!mGXcmLylAuIH>i#&#meJ<7r!BwJ~v}-v77N1@FUNqb6NAXx)0Dx z;=3~^PtUCgJ#_*975q=l%w}gwA70xgQn!H`>ckYMlrZ{@x1@?H+lo>bD~iMx#S;4i zJbzK_>wrkDj#xzM-|5`)$m;m&_@hytKacM(-HMkI)`dGiiSzgZLSmMUQbI!I@BP1d zt>wJO;|EIbk=Gb6U61qlHfhUc=_&uw95DV&E|HTu2%ymtdL(Gcse zl3ffL1?H*#YFUf%aqtOXo$8M=QEToC?!-@lDKHOS06JWSk`#7a12B7a12B7a12B7a12B7a12B z7a12B7a12B7a4a+=KdrV85bEBnWDI?j!wNgTvkUntD~FUqwG&&Z-e*1o$xTM;s@b_ z^l`A0*zNEUI0BEs8{iBageT!JJPoVWHv_MM=inOn9IWE!;q&BF_KWWb+jlTol+jpd zk#(~ok*Wm7RAB6$Kt=^J_XLisz;PA0#6%hLtlkVQSnIX54(l;(?Zw)qt(91H+Oo0O zlWdyDD5Qy^nm9BX#o!oGkv1ah;10ME?t)dk2kxPKb<}LdUI`~)6W$Kn@DM!8WFH_~ ze^jb50-zQ2f*s&6m;ld%FN4>>_rcG=FTwA?E%0}s*J?FJ0JMT$p#Qr=7>9s)Y7thY zA3**Y9@q@K#<=ffnYEYSJvKOAP_v#6bv?vdM?jy)!G;g7)Bu2sO;|Lrcu@Nh#Iq3#p0^< z7RFO>4;%(IXajpdmiR0@2abW=O-;eJrlvp@9Ku&))LmeJDx;pWdI2bp>xU~seBaP( zM)~cMlrgJIx0=_k{i=K9<)f>%eJCMy$ctQ^?|HY(?+=@Q`|e#|X=P1^b%}5-N%YU` zlU}2h-7jUsJkOTzA&ioByVSs4oW1M2lc?#aXnRA{(akZevx@{#<`Og=IcnM`L2zKxn`$mUbANI^!DQ#=nQqlLayXxYrBQd`O6 zQ+XId_k4;B$153N9g5whQ&s!!NWp3uPVP?@76w9vzJXLI8jTDVt_&v&R|Z1SREl2q za-~%K`Ke%~=4xuT+i0)xvWz4PeW8M+@_ChWB-tD-EadZ{JnvEQi*n_GfFTbC`YHit zf*j1mV9{6@CK=Qm4XHqLv^h$hsR6WW+joy72dOlg+N=)EO>&X>uM%^UagqOewK6Va zoRm*8xZ)&TTOCc#+@kCbfrMSxcntm^}w%4gu z?W?6w_F2U?WhLIQq`6(vaz;*Ypk|q)Gct`oyR;)phoy@#5C7PWhG|%a�<8v!yfM zS*xENxooCxd}?-lI-5zKo}{U_Q+;&vv)E~-I$PLF-Y!$s2)C8mvud9iI<9Ug1#h3$ zu@AS3k(8S~Qx>&le$+~S| zy(RcRovXZos%;jinNf4XX{J48Cx|6j!=4VG`uDW0r@gPzqRuF9l=rUcw)bXI&8eD8 NU5%axb^q(Xe*s)ddJq5r literal 0 HcmV?d00001 diff --git a/test/shaping/tests/MANIFEST b/test/shaping/tests/MANIFEST index a792e91bd..8c2bdca19 100644 --- a/test/shaping/tests/MANIFEST +++ b/test/shaping/tests/MANIFEST @@ -3,3 +3,4 @@ context-matching.tests indic-old-spec.tests indic-pref-blocking.tests mongolian-variation-selector.tests +zero-width-marks.tests diff --git a/test/shaping/tests/zero-width-marks.tests b/test/shaping/tests/zero-width-marks.tests new file mode 100644 index 000000000..bfe080933 --- /dev/null +++ b/test/shaping/tests/zero-width-marks.tests @@ -0,0 +1 @@ +fonts/sha1sum/bb9473d2403488714043bcfb946c9f78b86ad627.ttf:U+1030:[circledash=0+636|u1030.med=0@-162,0+0]