[morx] Fix cluster-merging when ligating

Only merge when actual ligature happened.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1305
This commit is contained in:
Behdad Esfahbod 2018-10-23 16:46:10 -07:00
parent aa5af8d041
commit ba502dea1e
4 changed files with 6 additions and 3 deletions

View File

@ -399,9 +399,6 @@ struct LigatureSubtable
if (unlikely (!match_length))
return true;
/* TODO Only when ligation happens? */
buffer->merge_out_clusters (match_positions[0], buffer->out_len);
unsigned int cursor = match_length;
do
{
@ -437,6 +434,7 @@ struct LigatureSubtable
bool (action & LigActionLast));
if (action & (LigActionStore | LigActionLast))
{
const GlyphID &ligatureData = ligature[ligature_idx];
if (unlikely (!ligatureData.sanitize (&c->sanitizer))) return false;
hb_codepoint_t lig = ligatureData;
@ -452,6 +450,9 @@ struct LigatureSubtable
buffer->skip_glyph ();
end--;
}
buffer->move_to (end + 1);
buffer->merge_out_clusters (match_positions[cursor], buffer->out_len);
}
action_idx++;

View File

@ -1,5 +1,6 @@
TESTS = \
tests/aat-trak.tests \
tests/aat-morx.tests \
tests/arabic-fallback-shaping.tests \
tests/arabic-feature-order.tests \
tests/arabic-like-joining.tests \

View File

@ -0,0 +1 @@
../fonts/TestMORXTwentyeight.ttf::U+0041,U+0078,U+0045,U+0079,U+0044,U+0079,U+0079:[A_E_D=0+1394|x=0+529|y=0+510|y=5+510|y=6+510]