From e535c6835bd1308974c2fe4f13714376f37615a8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 5 Feb 2025 19:41:03 +0000 Subject: [PATCH] [Context] Simplify cache costing --- src/hb-ot-layout-gsubgpos.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 03d849165..6c62d5660 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -3882,8 +3882,7 @@ struct ChainContextFormat2_5 unsigned cache_cost () const { - unsigned c = (this+lookaheadClassDef).cost () * ruleSet.len; - return c >= 4 ? c : 0; + return (this+lookaheadClassDef).cost () * ruleSet.len; } static void * cache_func (void *p, hb_ot_lookup_cache_op_t op) { @@ -4438,6 +4437,9 @@ struct hb_ot_layout_lookup_accelerator_t thiz->digest.union_ (subtable.digest); #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE + if (c_accelerate_subtables.cache_user_cost <= 1) + c_accelerate_subtables.cache_user_idx = (unsigned) -1; + thiz->cache_user_idx = c_accelerate_subtables.cache_user_idx; if (thiz->cache_user_idx != (unsigned) -1)