Benchmark WOFF2 Size & LCP Reductions
| Font / Preset | Original Size | Subsetted WOFF2 | Reduction | Est. LCP Gain |
|---|---|---|---|---|
| NotoSansDevanagari-Regular.ttf | 386 KB | 64.2 KB | 83.4% | ~640 ms (4G) |
| Hind-Regular.ttf (Devanagari + Latin) | 295 KB | 58.1 KB | 80.3% | ~470 ms (4G) |
| Poppins-SemiBold.ttf (Devanagari chunk) | 245 KB | 49.5 KB | 79.8% | ~390 ms (4G) |
Production @font-face CSS Example
/* Devanagari + Rupee */
@font-face {
font-family: 'Noto Sans Devanagari';
src: url('./fonts/NotoSansDevanagari.devanagari.woff2') format('woff2');
font-weight: 400;
font-display: swap;
unicode-range: U+0900-097F, U+1CD0-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A8E0-A8FF;
} Why Devanagari and Hindi font subsetting Matters for Production Web Performance
Indian-language web fonts like Noto Sans Devanagari, Poppins, or Hind often bundle multiple scripts or thousands of legacy glyphs. Naively stripping glyphs without HarfBuzz breaks halant conjuncts and vowel matra positioning.
Unoptimized desktop font files routinely ship thousands of glyphs, legacy kern tables, and unused script blocks that the browser must download, parse, and rasterize before painting text. On mobile networks, a single 450 KB font file can delay First Contentful Paint (FCP) and Largest Contentful Paint (LCP) by 800 ms to 2,500 ms. By running Devanagari and Hindi font subsetting directly in your browser via WebAssembly, you eliminate dead bytes before they ever reach your CDN edge.
Unlike legacy server-side pipelines that require uploading proprietary or licensed font binaries to third-party servers, UltraStack FontSubset executes HarfBuzz (hb-subset.wasm) and Google wawoff2 inside an isolated Web Worker. Your font binary stays in volatile browser memory, is inspected for OpenType metadata and EULA strings, and is compressed into a standards-compliant WOFF2 payload in milliseconds.
How HarfBuzz WASM & WOFF2 Brotli Compression Work Under the Hood
HarfBuzz hb-subset performs full Indic GSUB/GPOS layout closure over U+0900-097F, U+1CD0-1CF9, ZWJ/ZWNJ (U+200C-200D), and ₹ (U+20B9), guaranteeing that every ligature and half-form renders accurately.
During subsetting, HarfBuzz constructs a glyph closure graph starting from your selected Unicode codepoints (for example, Latin Basic U+0000-00FF, Currency & Numerals including ₹ U+20B9, or non-Latin scripts such as Devanagari, Arabic, and Cyrillic). Rather than naively deleting glyph outlines, hb-subset traces GSUB substitution lookups (ligatures, small caps, contextual alternates, and Indic conjuncts) and GPOS positioning rules (kerning pairs and mark-to-base anchors) so every reachable glyph and layout rule remains intact.
Once the SFNT tables (glyf/loca or CFF, cmap, hmtx, head, hhea, OS/2, GSUB, GPOS) are compacted, wawoff2 applies WOFF2 table transforms and Brotli entropy coding. Because WOFF2 reconstructs predictable locatable offsets and delta-encodes glyph coordinates, it typically achieves 30% to 50% smaller file sizes than WOFF1 and 60% to 92% smaller payloads than raw TTF or OTF files.
Step-by-Step Optimization Workflow
1. Upload your Devanagari-capable .ttf, .otf, or .woff2 font. 2. Enable the Devanagari preset (U+0900-097F + ₹ U+20B9) and Latin Basic if bilingual. 3. Verify conjuncts like क्ष, त्र, ज्ञ and ₹ in the Live Specimen Previewer. 4. Export split WOFF2 chunks so Latin-only pages never download Devanagari bytes.
After generating the subsetted .woff2 output, always verify glyph coverage using the Live Specimen Previewer's Before vs. After toggle. Toggling between the original Blob URL and the newly subsetted WOFF2 Blob URL injects both fonts into document.fonts so you can visually confirm kerning, diacritics, currency symbols, and variable-font axis interpolation before deploying.
Finally, copy the generated @font-face CSS block—including font-display: swap, exact unicode-range descriptors, and the metric-matched fallback @font-face rule using size-adjust, ascent-override, descent-override, and line-gap-override—directly into your global stylesheet.
Eliminating Cumulative Layout Shift (CLS) with Metric-Matched Fallbacks
Subsetting shrinks download time, but even a 15 KB WOFF2 file takes tens of milliseconds over a cold TLS connection. When the browser renders fallback system text (such as Arial or Helvetica) and later swaps in your custom web font, differences in x-height, ascender, descender, and average advance width cause text reflow—triggering Cumulative Layout Shift (CLS) penalties in Core Web Vitals.
To eliminate layout shift, UltraStack FontSubset reads your font's OS/2 (sTypoAscender, sTypoDescender, sTypoLineGap, sxHeight) and hhea vertical metrics alongside unitsPerEm. It computes a calibrated size-adjust percentage and matching ascent-override, descent-override, and line-gap-override percentages on a local system fallback @font-face. The fallback text occupies the exact same vertical and horizontal bounding box as your web font, resulting in near-zero CLS during font swap.
Frequently Asked Questions
Will Hindi conjuncts (सयुक्ताक्षर) and matras still render properly? +
Yes. HarfBuzz traces GSUB Indic shaping rules and retains all required ligature and half-form glyphs automatically.
Is the Indian Rupee symbol (₹ / U+20B9) included? +
Yes. Both the Devanagari preset and the Currency & Numerals preset explicitly include U+20B9.
Can I split a bilingual English + Hindi font into two WOFF2 files? +
Yes. Enable Latin Basic + Devanagari with unicode-range splitting to serve separate tiny chunks for each script.
What happens if I subset a font without Devanagari support? +
The inspector and batch splitter detect 0 matching Devanagari glyphs and skip generating an empty chunk.
Does this work for Marathi, Sanskrit, and Nepali fonts? +
Yes. All languages using the Devanagari script (U+0900-097F) and Vedic extensions are covered.