From c650858c639764717f3d7276ad67bd5bf55aaedc Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sat, 8 Jul 2023 13:57:05 +0300 Subject: [PATCH] [graphite] Fix cluster advance width Based on https://github.com/harfbuzz/harfbuzz/issues/4309#issuecomment-1624730406 Fixes https://github.com/harfbuzz/harfbuzz/issues/4309 --- src/hb-graphite2.cc | 5 +++-- src/wasm/graphite/shape.cc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index 9bb9136c4..7ea038622 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -368,9 +368,10 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan HB_UNUSED, } else { + auto origin_X = gr_slot_origin_X (is) * xscale; c->advance = 0; - clusters[ci].advance += gr_slot_origin_X(is) * xscale - curradv; - curradv += clusters[ci].advance; + clusters[ci].advance += origin_X - curradv; + curradv = origin_X; } ci++; } diff --git a/src/wasm/graphite/shape.cc b/src/wasm/graphite/shape.cc index e523e4cbf..f445049a4 100644 --- a/src/wasm/graphite/shape.cc +++ b/src/wasm/graphite/shape.cc @@ -164,9 +164,10 @@ shape (void *shape_plan, } else { + auto origin_X = gr_slot_origin_X (is) * xscale; c->advance = 0; - clusters[ci].advance += gr_slot_origin_X(is) * xscale - curradv; - curradv += clusters[ci].advance; + clusters[ci].advance += origin_X - curradv; + curradv = origin_X; } ci++; }