# unjs/fontaine

Automatic font fallback based on font metrics

Repository: https://github.com/unjs/fontaine
Canonical: https://ross.abutalabs.com/products/fontaine
Language: TypeScript
License: MIT
License Family: permissive
Topics: cls, fonts, web-vitals, hacktoberfest
Last push: 2026-08-25T18:27:32+00:00

## Health v2 (maintenance only)
Score: 99/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 99, longevity 100
- inputs: {"age_days": 1434, "days_push": 8, "days_rel": 8, "gap_med": 1, "n_releases_24m": 10}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1983, forks 47 (observed 2026-08-28T04:06:01.982728+00:00)

## What it is
Fontaine is a TypeScript library that automatically generates font fallbacks based on font metrics to reduce layout shift (CLS). It computes metric-compatible fallback fonts so text renders consistently while web fonts load.

## Use cases
- reduce cumulative layout shift from web font loading
- generate metric-compatible font fallbacks automatically
- improve web vitals scores for font rendering
- avoid text reflow when custom fonts swap in
- optimize font loading in build pipelines

## When to choose
- your site suffers CLS from font swapping
- you want automatic fallback font generation at build time
- you need metric-compatible fallbacks without manual font metric work

## When to avoid
- you don't load custom web fonts
- you need full font subsetting or optimization rather than fallbacks
- your project is not in a Node.js/JavaScript build environment

## Facets
- artifact type: library
- maturity: active
- function: ui-components, developer-tools
- domain: web-development, frontend, performance
- platform: -
- tags: font-fallback, font-metrics, cls, web-vitals, css-fonts, unjs, nodejs, web-server

## Member repositories
- unjs/fontaine (main) score 99

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:01.982728+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:03:31.523154+00:00, confidence not recorded.
  - readme: https://github.com/unjs/fontaine (fetched 2026-08-28T04:06:01.982728+00:00, sha a3da6d63289a)
  - registry_npm: https://registry.npmjs.org/fontaine (fetched 2026-08-29T10:43:35.730160+00:00, sha 82d3b4ac42ce)
- Data as of 2026-08-30T08:39:29.467469+00:00.
