Fonts / Getting the font into the document
Whether your font licence lets you embed it in a generated document
Embedding a font into a document distributes that font, and whether you are permitted to do that is a question about the licence rather than about the technology.
What is actually going on
Every PDF with a custom font in it contains a copy of that font, or of the part of it that was used. That is distribution, and font licences have opinions about it. Some permit embedding freely. Some permit it only in a form that cannot be extracted and reinstalled. Some price it separately from the desktop or web licence you already bought, and web licences in particular are often written for fonts served to a browser rather than baked into a file you send to a customer. A generated document is the case licences are least clear about, because it is not a website and it is not a printed brochure: it is an artefact your system manufactures and hands over, at volume.
How fonts reach this API
There is no font option on the render. A font arrives the way every other subresource arrives: your @font-face names a URL, the renderer fetches it while the document loads, and what was used is embedded in the output. So there is no font upload, no list of available fonts, no substitution control and no subsetting switch. It also means the two failures that actually stop a font are network-shaped rather than typographic: the URL has to be absolute and publicly reachable, and the fetch has to finish before the page is captured. Everything else on this page is decided in your stylesheet and in the font file itself.
The decisions
Reasons rather than a description of the code. Each of these has a default, and the default is chosen by the engine rather than by you.
- Read the specific licence for the specific font before it goes into a document pipeline, not after. This is the one item in this cluster that can require throwing work away.
- Note that a web font licence is not automatically a licence to embed. Serving a font to a browser and putting it inside a file you deliver are different acts, and some licences separate them explicitly.
- Check whether volume matters. Some licences are priced by page views or by number of documents, and a generated-document pipeline can pass a threshold quickly and silently.
- Prefer an open licence where the design allows it. A font under a permissive open licence removes the question entirely, and there are excellent ones.
- Keep a record of which font is under which licence alongside the code that loads it, so the next person does not have to rediscover it.
- If you cannot establish the position, do not embed. A document with a substituted font is a fixable problem; an unlicensed distribution at volume is not.
What it looks like
A fragment, with the wrong version kept in a comment where the wrong version is the thing people actually write.
/* Keep the licence position next to the code that loads the font, so
the question is answered where it gets asked. */
/*
* Brand Sans
* licence: <name of licence>, purchased <date>, seat/volume terms: <...>
* embedding in generated documents: permitted / restricted / not permitted
* reviewed by: <who>, <when>
*/
@font-face {
font-family: "Brand Sans";
src: url("https://assets.example.com/brand-sans-400.woff2") format("woff2");
font-weight: 400;
}
/*
* Fallback used where embedding is not permitted. Substituting a font is a
* visible compromise and a recoverable one; distributing a font you are not
* licensed to distribute is neither.
*/
:root {
--font-body: "Brand Sans", "Source Sans 3", system-ui, sans-serif;
}What people do instead
Assuming the web font licence already bought for the marketing site covers the invoices. They are different uses and licences frequently treat them differently. The assumption is easy to make because the technical setup is identical, which is exactly why it goes unexamined.
How to find out rather than assume
Open the licence and search it for the words embed, embedding, distribute and document. If it does not address embedding, ask the foundry in writing rather than inferring. This is not a check you can run against the file: it is a check you run against the paperwork, once, before the pipeline exists.
Frequently asked
Can I upload a font instead of serving one?
No. There is no font upload and no font list. The renderer fetches what your @font-face points at, so the file has to be somewhere it can reach over the network. In practice that means a public URL on your own asset host or a font service, and it means a font on a private path or behind an authenticated endpoint fails to load silently and the fallback is used instead.
How do I know which fonts ended up in the document?
Open the finished file in a reader and look at its document properties, which list the embedded fonts. That list is the truth: it says whether the face you meant was used, whether a fallback was substituted, and how many faces the document is carrying. It is a five second check and it catches most of the failures in this cluster.
Why does the font work in my browser and not in the render?
Almost always because the URL resolves for you and not for the renderer. A relative path, a local file, a development host, or an asset behind a login all work while you are looking at the page and none of them work when a machine somewhere else loads it. The fallback is then used and nothing reports an error, which is why the symptom is a document that looks subtly wrong rather than a render that failed.
Related font topics
The topics that cause each other, then the rest of the same group.
Which font file format to serve for a document that embeds it
WOFF2, WOFF, TTF and OTF all work, and the one you serve changes the download size, not what ends up in the finished document.
Designing a font fallback chain for a document you cannot see
The list of families after the one you want, which decides what the document looks like on the day the font does not load.
Icon fonts in a PDF, and why an SVG is almost always better
Icons delivered as font glyphs, which look fine on the page and turn the document's extracted text into rubbish.
Why an archival PDF has to embed every font it uses
Every conformance standard requires the actual font program to be inside the file, because a font named but not embedded is a promise that some other machine will have it, and archiving exists precisely because that promise fails.
Every font topic
The full list, grouped by supply, engine behaviour, and what happens to the text afterwards.
Fonts reach a render the way every other subresource does, over the network from the URL you named. Render the document and look at what actually got embedded.