Font SDK · JavaScript and WebAssembly
A font engine in one file.
Font generation, in your own code.
It runs in the browser or in Node, with no server, no GPU and nothing sent anywhere.
Set in Thread
Numbers in,
font out.
One call compiles a whole TrueType font on the device. About 90 ms and 14 KB: fast enough to follow a slider.
import { createEngine } from "@typomat/engine";
const engine = await createEngine({ licenseKey });
const ttf = engine.compile(
{ weight: 118, contrast: 0.92, serif: 0.5, xHeight: 470 },
{ name: "Acme Display" },
);
const face = new FontFace("Acme Display", ttf);
document.fonts.add(await face.load());Or just
the letters.
Outlines come back as SVG paths with kerning, the same curves as the font. Draw them on your canvas, or put them straight in a design.
// Letters as SVG paths, kerned, ready for a canvas.
const { glyphs } = engine.glyphs({ weight: 170, width: 1.5 }, "Acme");
let x = 0;
for (const glyph of glyphs) {
draw(glyph.d, x);
x += glyph.advance + glyph.kern;
}Made to embed.
- On the device
- Nothing your users type or make ever leaves their browser, so there's nothing to add to your privacy policy.
- Off the main thread
- Compile in a worker and a slider never stutters. The engine has no dependencies.
- Typed
- TypeScript types for all 64 parameters, and a catalog with every range and default for building your own controls.
Good to know
No. It's a WebAssembly file and a small JavaScript package, and it runs entirely on the device. It works just as well in Node, if you'd rather generate on your server.
The engine is 6 MB, or 1.8 MB over the wire with Brotli. Load it when someone opens your font tool, rather than with your first page.
Never. Your licence key is checked on the device against a signature inside the key. If a key has expired or doesn't match the domain, the SDK warns in the console and keeps working, so a renewal can't take down your product.
You get the compiled engine and the JavaScript around it. The Swift source isn't part of a licence.
Your account always has the newest package. Updates are included for as long as your licence runs.
Try it in your product.
Start with the free API trial, or write to Marco about what you're building.