[subset] Document that the avar2 range budget fallback is safe Running out of HB_BUDGET_SUBSET_AVAR2_RANGES returns early from _compute_avar2_reachable_ranges() and records nothing for the remaining axes. That does not produce a wrongly instanced font: avar2_reachable_ranges is only used to cull variation data that cannot be reached, and an axis without a range is never culled (_hb_avar2_region_is_dead() skips it, the same as the VARC path that resets the map). A pinned axis that is not detected as self-contained stays in fvar as a hidden pin, which is what CFF2 fonts always get. The output is correct, only larger. Likewise the exact-grid fallback uses interval bounds, which are conservative. Say so in the comments instead of "left unconstrained". Tested: meson test -C build (278/278); hb-subset --instance wght=400 and wght=300:700 on GoogleSansFlex, NotoSansKR and SourceSerif4 variable fonts, all glyphs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diff --git a/src/hb-limits.hh b/src/hb-limits.hh index 71523ac..56a9e91 100644 --- a/src/hb-limits.hh +++ b/src/hb-limits.hh
@@ -326,7 +326,11 @@ * final coordinates each axis can reach. A delta-set row can list a region * any number of times and axes can share a row, so the table size does not * bound that work. An axis whose exact bounds do not fit what is left gets - * the looser interval bounds; once exhausted, axes are left unconstrained. */ + * the looser interval bounds; once exhausted, the remaining axes get no + * range and are not detected as self-contained. Either way the instance + * stays correct, only less optimized: those ranges only cull variation + * data that cannot be reached, and a pinned axis not found self-contained + * stays in fvar as a hidden pin. */ #ifndef HB_BUDGET_SUBSET_AVAR2_RANGES #define HB_BUDGET_SUBSET_AVAR2_RANGES ((int64_t) 1 << 26) #endif
diff --git a/src/hb-subset-plan-var.cc b/src/hb-subset-plan-var.cc index a174b64..346a1de 100644 --- a/src/hb-subset-plan-var.cc +++ b/src/hb-subset-plan-var.cc
@@ -172,7 +172,8 @@ const OT::HBUINT8 *delta_bytes = vd.get_delta_bytes (); unsigned row_size = vd.get_row_size (); unsigned region_count = vd.get_region_index_count (); - /* Out of budget: the remaining axes are left unconstrained. */ + /* Out of budget: record nothing for the remaining axes. That is + * still correct, only less tight; see HB_BUDGET_SUBSET_AVAR2_RANGES. */ if (unlikely (!hb_budget_spend (budget, HB_BUDGET_1, region_count))) return true; for (unsigned r = 0; r < region_count; r++)