From 9c04b6058306cd4b2123a33a7cbeb47505434217 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 6 Nov 2018 18:35:58 -0500 Subject: [PATCH] [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. --- src/hb-ot-kern-table.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh index c7282a3a0..980b7e150 100644 --- a/src/hb-ot-kern-table.hh +++ b/src/hb-ot-kern-table.hh @@ -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); } }