diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index ddd6662e8454be782dd282087ac59fd95204d9e0..6b38739c91b6942c3cd8032ce9701528ad031074 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -362,6 +362,18 @@ hb_ot_shape_setup_masks_fraction (hb_ot_shape_context_t *c) hb_buffer_t *buffer = c->buffer; + hb_mask_t pre_mask, post_mask; + if (HB_DIRECTION_IS_FORWARD (buffer->props.direction)) + { + pre_mask = c->plan->numr_mask | c->plan->frac_mask; + post_mask = c->plan->frac_mask | c->plan->dnom_mask; + } + else + { + pre_mask = c->plan->frac_mask | c->plan->dnom_mask; + post_mask = c->plan->numr_mask | c->plan->frac_mask; + } + /* TODO look in pre/post context text also. */ unsigned int count = buffer->len; hb_glyph_info_t *info = buffer->info; @@ -380,10 +392,10 @@ hb_ot_shape_setup_masks_fraction (hb_ot_shape_context_t *c) end++; for (unsigned int j = start; j < i; j++) - info[j].mask |= c->plan->numr_mask | c->plan->frac_mask; + info[j].mask |= pre_mask; info[i].mask |= c->plan->frac_mask; for (unsigned int j = i + 1; j < end; j++) - info[j].mask |= c->plan->frac_mask | c->plan->dnom_mask; + info[j].mask |= post_mask; i = end - 1; } diff --git a/test/shaping/Makefile.am b/test/shaping/Makefile.am index f2bb95bdd22215c3a747f727a85ae7a77a6b7b22..ea0b28a7ebab6438aab74d10e1346b7c39dda0e4 100644 --- a/test/shaping/Makefile.am +++ b/test/shaping/Makefile.am @@ -43,6 +43,7 @@ CLEANFILES += \ TESTS = \ tests/arabic-fallback-shaping.tests \ tests/arabic-feature-order.tests \ + tests/automatic-fractions.tests \ tests/cluster.tests \ tests/color-fonts.tests \ tests/context-matching.tests \ diff --git a/test/shaping/fonts/sha1sum/15dfc433a135a658b9f4b1a861b5cdd9658ccbb9.ttf b/test/shaping/fonts/sha1sum/15dfc433a135a658b9f4b1a861b5cdd9658ccbb9.ttf new file mode 100644 index 0000000000000000000000000000000000000000..4b80f80443b099f82927f924a4434818d76394ad Binary files /dev/null and b/test/shaping/fonts/sha1sum/15dfc433a135a658b9f4b1a861b5cdd9658ccbb9.ttf differ diff --git a/test/shaping/tests/automatic-fractions.tests b/test/shaping/tests/automatic-fractions.tests new file mode 100644 index 0000000000000000000000000000000000000000..f9510e26c938a01021d8dbf20e0b61ce21c2dad0 --- /dev/null +++ b/test/shaping/tests/automatic-fractions.tests @@ -0,0 +1,3 @@ +fonts/sha1sum/15dfc433a135a658b9f4b1a861b5cdd9658ccbb9.ttf::U+0031,U+0032,U+0033,U+2044,U+0034,U+0035,U+0036:[one.numr=0+600|two.numr=1+600|three.numr=2+600|fraction=3+252|four.small=4+600|five.small=5+600|six.small=6+600] +fonts/sha1sum/15dfc433a135a658b9f4b1a861b5cdd9658ccbb9.ttf:--direction=l --script=arab:U+0031,U+0032,U+0033,U+2044,U+0034,U+0035,U+0036:[one.numr=0+600|two.numr=1+600|three.numr=2+600|fraction=3+252|four.small=4+600|five.small=5+600|six.small=6+600] +fonts/sha1sum/15dfc433a135a658b9f4b1a861b5cdd9658ccbb9.ttf:--direction=l:U+0661,U+0662,U+0663,U+2044,U+0664,U+0665,U+0666:[uni0661.numr=0+600|uni0662.numr=1+600|uni0663.numr=2+600|fraction=3+252|uni0664.small=4+600|uni0665.small=5+600|uni0666.small=6+600]