[kern] In Format1, adjust how kerning is done

In a series of kerns in one action, kern all but last glyph forward,
and the last one backward.  Seems to better match what CoreText is doing.

Test cases, with GeezaPro Arabic:

$ ./hb-shape GeezaPro_10_10.ttc -u U+0631,U+0628
[u0628.beh=1+1415|u0631.reh=0@-202,0+700]

$ ./hb-shape GeezaPro_10_10.ttc -u U+0628,U+064F
[u064f.damma=0@0,-250+-250|u0628.beh=0@250,0+1665]

In a later change, I'll make kern machine avoid producing negative kerns.
This commit is contained in:
Behdad Esfahbod 2018-11-06 18:35:58 -05:00
parent e8c4772463
commit 9c04b60583

View File

@ -289,7 +289,7 @@ struct KernSubTableFormat1
else
{
buffer->pos[idx].x_advance += c->font->em_scale_x (v);
if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction))
if (last)
buffer->pos[idx].x_offset += c->font->em_scale_x (v);
}
}
@ -303,7 +303,7 @@ struct KernSubTableFormat1
else
{
buffer->pos[idx].y_advance += c->font->em_scale_y (v);
if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction))
if (last)
buffer->pos[idx].y_offset += c->font->em_scale_y (v);
}
}