diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh index 7bd5ab1ae..e6280386c 100644 --- a/src/hb-ot-var-avar-table.hh +++ b/src/hb-ot-var-avar-table.hh @@ -178,12 +178,11 @@ struct avar if (version.major < 2) return; - /* TODO Use cache. */ - const auto *v2 = (const avarV2Tail *) map; const auto &varidx_map = this+v2->varIdxMap; const auto &var_store = this+v2->varStore; + auto *var_store_cache = var_store.create_cache (); hb_vector_t out; out.alloc (coords_length); @@ -191,12 +190,14 @@ struct avar { int v = coords[i]; uint32_t varidx = varidx_map.map (i); - float delta = var_store.get_delta (varidx, coords, coords_length); + float delta = var_store.get_delta (varidx, coords, coords_length, var_store_cache); v += round (delta); v = hb_clamp (v, -(1<<14), +(1<<14)); out.push (v); } + OT::VariationStore::destroy_cache (var_store_cache); + for (unsigned i = 0; i < coords_length; i++) coords[i] = out[i]; }