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++; }