Why self-host at all
A hosted font service sees a request on every page view: the visitor's IP, the page, the referrer. In the EU that has been treated as a personal-data transfer, and several sites have been fined over it. Self-hosting removes the request — the font comes from your domain, under your privacy policy — and it is faster, because there is no second DNS lookup or TLS handshake.
Generate the kit
- Open the @font-face generator.
- Drop the TTF or OTF. The tool reads the family name, weight class and italic flag from the font itself.
- Press Convert and write CSS. You get a
.woff2download and the rule that points at it. - Put the file in
/fonts/, paste the rule into your stylesheet, and the preload line into the page head.
Read the numbers in the rule
A common mistake is declaring every face as font-weight: 400. If the bold face is declared 400 as well, the browser synthesises bold from the regular and the text looks smeared. The generator writes the real value, for example 700 for a bold face, so the browser picks the file you meant.
Stop the layout shift
Text either waits invisible or renders in a fallback and swaps. Both move the page unless the fallback has similar metrics. The generated CSS lists system-ui and a generic family, and uses font-display: swap; if the shift is still visible, add size-adjust to the fallback rule until the two line up.
When to skip all this
If you only need one weight of a system-adjacent font, the honest answer is to use the system stack and ship no font at all. A web font is worth its bytes when the typeface is part of the brand, not when it is a nicer Helvetica.