Rasura

Fonts

A browser cannot see installed fonts, so a character the document lacks has nowhere to come from unless you provide it.

What a font can draw

JavaScript
for (const f of await doc.fontRequirements()) {
console.log(f.pdfFont, f.embedded, f.subset, f.coverage, f.needsSupplying)
}

Coverage is measured against the embedded font program, not against what the encoding claims. A subset embedded for the word “Hamburg” contains seven glyphs whatever its /Differences array says, and asking it to draw a “z” fails.

Supplying one

JavaScript
const roboto = await fetch('/Roboto-Regular.ttf').then((r) => r.arrayBuffer())
await doc.registerFont(roboto, { matchFor: 'Helvetica' })

matchFor tells the matcher which document font this stands in for. Without it the font is a general fallback, used when nothing better is registered.

What injection does

Rasura does not add a second font to the document. It takes the glyph outline from your file and writes it into the font the document already embeds, extends that font’s cmap so the new glyph is reachable, widens /Widths and/FontBBox, and merges /ToUnicode so the text stays copyable.

The result is one font, slightly larger, and a page where the new character is set in the same typeface as its neighbours. That is the reembedded rung.

What is declined

CFF outlines cannot be injected or embedded: they need a different stream and a different subsetter. Composite fonts cannot be injected into. Both are declined by name rather than half-done, because a font written into the wrong stream passes every structural check and renders nothing.