Engineering Guides

Variable Fonts: Static Weight Instancing vs. Trimming Axis Ranges

Use HarfBuzz WASM in your browser to pin Variable Font axes (wght/wdth) into lightweight static weights or trim axis spans without Python fonttools.

4 min readUpdated:

Quick Answer

Variable fonts pack fvar/gvar axis deltas into a single file, making them 3x–6x larger than a single static weight. When a page uses only one or two weights, pin static instances with HarfBuzz (320 KB → 52 KB) or trim unused axis extremes (e.g. wght 400–700) locally in browser WASM.

Why full variable fonts can hurt single-weight performance

Shipping a full variable font with Thin 100 to Black 900, optical size (opsz), and italic deltas makes sense when a design system uses 5+ weights dynamically. But if your site only uses Regular 400 and Bold 700, a 320 KB variable file wastes 200+ KB compared to two focused static WOFF2 weights or a trimmed axis span.

Additionally, older desktop apps, video tools, and game engines often expose only the default Regular style of a variable font unless you export static instances.

Two surgical HarfBuzz strategies: Pin vs. Trim Range

FontTo exposes HarfBuzz 1.6+ instantiation APIs directly in your browser without installing Python fonttools:

1. Pin Static Instance (hb_subset_input_pin_axis_location): Locks wght=400 or wght=700, flattens gvar deltas into static outlines, and drops fvar/avar tables completely.

2. Trim Axis Range (hb_subset_input_set_axis_range): Keeps the font variable over a narrower span (such as wght 400..700) combined with character subsetting.

@font-face {
  font-family: 'InterVarTrimmed';
  src: url('/fonts/inter-400-700.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

Inspect axes and named instances before exporting

Use FontTo's Variable Font Inspector to scrub real-time sliders for wght, wdth, slnt, and opsz, preview named foundry instances, and export either the live static coordinate or a clamped variable WOFF2.

Frequently asked questions

Does pinning a static instance remove fvar and gvar tables cleanly?

Yes. HarfBuzz instantiates the requested axis coordinates into the glyf/HVAR metrics and strips variable variation tables so legacy apps see a standard static font.

Can I combine variable axis trimming with text subsetting?

Yes. Subset Variable Font lets you shrink the weight range (for example 400–700) and prune unused Unicode glyphs in a single pass.

Why does variable font CSS use font-weight: 400 700?

Supplying a two-number range in @font-face tells the browser which weights can be synthesized cleanly from the variable axis without triggering faux bold.

Authoritative References

Tools used in this guide

Related formats

Related Comparisons

More engineering guides