[arabic/stch] Center the stretched group over the digits

Mostly relevant when there's one digit only.

https://github.com/harfbuzz/harfbuzz/issues/4369#issuecomment-1670361856
pull/4372/head
Behdad Esfahbod 2 years ago
parent 9daef6ed4e
commit 483bc0a384
  1. 5
      src/hb-ot-shaper-arabic.cc
  2. 1
      test/shape/data/in-house/tests/arabic-stch.tests

@ -579,7 +579,10 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
++n_copies;
hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
if (excess > 0)
{
extra_repeat_overlap = excess / (n_copies * n_repeating);
w_remaining = 0;
}
}
if (step == MEASURE)
@ -590,7 +593,7 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
else
{
buffer->unsafe_to_break (context, end);
hb_position_t x_offset = 0;
hb_position_t x_offset = w_remaining / 2;
for (unsigned int k = end; k > start; k--)
{
hb_position_t width = font->get_glyph_h_advance (info[k - 1].codepoint);

@ -1,2 +1,3 @@
../fonts/d9b8bc10985f24796826c29f7ccba3d0ae11ec02.ttf;--no-glyph-names;U+0718,U+070F,U+0718,U+0718,U+002E;[1=4+168|3=3+502|3=2+502|4=1@-1004,0+0|5=1@-876,0+0|5=1@-799,0+0|5=1@-722,0+0|5=1@-645,0+0|4=1@-566,0+0|5=1@-438,0+0|5=1@-361,0+0|5=1@-284,0+0|5=1@-207,0+0|4=1@-128,0+0|3=0+502]
../fonts/507637795ce4f2975593da54d12b46f76c7cc4cc.ttf;--direction=l;U+0891,U+0661,U+0662,U+0663,U+0664,U+066B;[piastre-ar.head=0+0|piastre-ar.repeat=0@644,0+0|piastre-ar.repeat=0@778,0+0|piastre-ar.repeat=0@897,0+0|piastre-ar.repeat=0@1016,0+0|piastre-ar.repeat=0@1135,0+0|piastre-ar.repeat=0@1254,0+0|piastre-ar.repeat=0@1373,0+0|piastre-ar.repeat=0@1492,0+0|piastre-ar.tail=0@1611,0+0|one-ar=1+449|two-ar=2+449|three-ar=3+449|four-ar=4+449|decimalseparator-ar=5+222]
../fonts/507637795ce4f2975593da54d12b46f76c7cc4cc.ttf;--direction=l;U+0661,U+0662,U+0663,U+0891,U+0664,U+066B;[one-ar=0+449|two-ar=1+449|three-ar=2+449|piastre-ar.head=3@-192,0+0|piastre-ar.repeat=3@452,0+0|piastre-ar.tail=3@586,0+0|four-ar=4+449|decimalseparator-ar=5+222]

Loading…
Cancel
Save