RC RANDOM CHAOS

This TrueType Font Turns Bracketed Text Into Scannable QR Codes

· via Hacker News

Original source

Jim's TrueType QR Code Font

Hacker News →

Jim Paris has built an experimental OpenType font that renders any text wrapped in square brackets as a live QR code, while leaving the surrounding characters as normal, readable type. Typing something like abc[hello]ghi produces ordinary letters, followed by a scannable QR symbol encoding “hello,” followed by more ordinary letters — all within a single font. The trick relies entirely on OpenType shaping: the glyphs and GSUB substitution logic are generated by a Python build script that compiles a delimiter parser, byte expansion, a Reed-Solomon parity circuit, QR module placement, and fixed mask rendering into the final .ttf files.

Three variants ship at increasing capacities — 21x21, 25x25, and 29x29 modules, holding up to 17, 32, or 53 printable-ASCII characters respectively. All use byte mode and a fixed mask pattern, with brackets as delimiters. The readable ASCII glyphs are borrowed from Liberation Sans Regular and scaled into the QR em square, which is why the generated families are renamed (QR Font 1-L, 2-L, 3-L) and licensed under the SIL Open Font License. The project uses uv for dependency management, and the default build emits thousands of contextual lookups for the full parity circuit, with a faster placeholder-parity option for layout-only testing.

It’s a proof of concept rather than a production tool: it only works in environments that actually apply GSUB features, and inputs are bounded to printable ASCII within the stated character limits. Still, it’s a clever demonstration of how much computation — including error-correction math — can be smuggled into the shaping layer of a font file, and there’s a live browser demo to try it.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.