Fonts that turn typed text into scannable barcodes — and compute the EAN-13 checksum themselves
The Libre Barcode project renders Code 39, Code 128 and EAN-13 as fonts: type the digits, get a scannable code. The party trick is an OpenType-driven checksum. The thread's most experienced voice has one word of advice: don't.
Barcode fonts are old, but this set's flourish is computing the EAN-13 check digit inside the font's typographic features rather than asking you to do it. It's downloadable from Google Fonts.
The expert pushback is practical: generating a correct Code 128 as an SVG is about the same effort, and the genuinely hard part — switching between character sets — is exactly what a font can't handle well.
A barcode you can type
The Libre Barcode project ships fonts that render scannable barcodes directly from text — Code 39, Code 128 and EAN/UPC (EAN-13), with or without the human-readable digits beneath — distributed via GitHub and Google Fonts. The clever bit, as one reader noted, is that this one “can calculate the EAN13 checksum on its own,” pushing logic into OpenType features that older barcode fonts left to the user. The reaction from one well-known hacker was pure affection for the hack: “This is a perversion of the most sickening nature. Nicely done!”
“Do not do this unless you have no other choice”
The most useful comment was a warning from someone who'd clearly shipped barcodes in anger. An engineer who's implemented Code 128 laid out why the font approach is a trap:
“Generating correct Code128 as a SVG is about the same amount of work as generating the correct input for some sort of barcode font (the hard part is determining the switches between character sets, not generating bars from bytes).”
In other words, the font moves the easy half of the problem and leaves you the hard half. A second reader extended the point to the dense 2D formats: self-computing a checksum is nice, but “good luck doing that with something like Reed-Solomon (QR, Data Matrix).”
Why it's still worth knowing about
The honest framing is that this is a beautiful piece of typographic engineering with a narrow safe zone. For a simple EAN-13 label where the printer can't generate codes natively, a self-checksumming font is genuinely handy; for anything with character-set switching or 2D error correction, the thread's veterans would reach for a real generator. The most fun datapoint wasn't about printing at all — one reader described using a barcode generator to craft a special code that reprograms a cheap scanner to read both UPS and FedEx tracking numbers. Barcodes, it turns out, are a deeper rabbit hole than the font makes them look.
Get breakdowns like this every day
The top Hacker News stories, unpacked — by email, Telegram, or RSS.
“Reading the news is the new smoking” — and the comment section argues about whether quitting is a privilege
Adam Mastroianni quit the news in 2020 and says his brain “got quieter.” His case: news is habitual, stress-inducing, harms bystanders, and was once thought good for you — just like cigarettes. ProPublica's tech lead pushes back: do nothing about genocide, and you don't care about it.