Show HN: QR code renderer in a TrueType font
qr.jim.shIn the "Libre Barcode Project" discussion yesterday, 1bpp asked: "Is anyone willing to sacrifice their sanity for the sake of implementing a QR renderer as TTF hinting code?"
Yes. I had some tokens to burn and was curious... turns out, it's possible. This was put together by a mix of Gemini, GPT, and Claude (depending on which usage limits kept running out). Side question: Why is nobody making QR codes on web pages clickable (regardless if it’s an image or text-based)? Not every QR code represents a URL, of course, but many do. Maybe there should be a qrcode URL scheme that lets browsers behave the same way as a camera scanning a QR code. See https://github.com/jimparis/qr-font/blob/master/design.md for the actual design. As who have written a QR code encoder library... I'm in shock and awe. 1bpp's comment suggesting this yesterday:
https://news.ycombinator.com/item?id=48682460 This is absolute black magic. I never realized OpenType rules were powerful enough to render something as complex as a QR matrix inline. It’s basically Turing-complete: https://simoncozens.github.io/fonts-and-layout/features.html Once something is Turing-complete, the magic turns from black to white. ;) Font shaping rules are actually turing complete. An incredible amount of engineering effort has gone into this not being a total disaster everywhere at all times. That's a wonderfully cursed idea. Selecting parts of the code (in F7 mode or with SHIFT-LEFT/RIGHT) highlights which individual pixels corresponds to the actual letters. That's a wonderfully idea. I Like Wow. This is so freaking cool. This is terrifying, great job! Impressive work! Not mentioned is the fact that the resulting QR Fonts are huge --- much larger than the javascript needed to render a QR code.