MBT FONT LIB

A MoonBit font engine

moonfont

Parsing, metrics and glyph rasterisation, compiled from MoonBit to JavaScript. This page runs the engine in your browser — decode a font, watch a glyph resolve into pixels, then pull it into three dimensions. No server. No upload. No network.

01 — Anatomy

Inside a single glyph

One character, four readings of the same font data. The coverage mask is the rasteriser's 26.6 fixed-point output. The outline is the raw Bézier path. The extrusion gives that path depth and light. The metrics overlay shows the em square the engine measured. A character the demo face does not carry — Chinese, say — is shown in the page's own face, so the four panels are still four readings of one glyph.

Size
Coverage mask — 8-bit alpha
Vector outline — path commands
Extrusion — WebGL
Metrics — em square

02 — Bring your own font

Drop a font, watch it think

The file never leaves your machine. It is decoded by moonfont in the page, then rasterised on demand. Try any .ttf or .otf — a font you love, a font you made, a font you suspect.

Drop a font file here

or click to choose — nothing is uploaded

03 — Type with the engine

A keyboard, rendered live

Every keystroke is a decoded glyph drawn by the rasteriser, in the demo font — and set in the page's face when the demo font has no such character. The engine is the typesetter here, not a webfont.

04 — Extrude

Pull a glyph into space

The coverage mask becomes a solid. Drag to orbit; the light is a fixed direction, so the form turns through it. Depth and lighting are live.

05 — Pour

A tray of castings

Every piece below is a glyph this page decoded, sampled into convex hulls and handed to a rigid-body solver. Drag one: it hangs from a spring, swings, and keeps the speed of your hand when you let go. It lands on its neighbours, and on the button and the caption, which are solids too. Depth, light and shadow are drawn from the same outline, so the same body can be read five ways.

Solid: the outline extruded towards the light, one shadow per piece. This line and the button are solids. The letters rest on them.

Collision by matter-js 0.20 (MIT), vendored beside this page; the hulls come from the coverage mask rasterise produced.