You Know This Font, But You Don’t Really Know It

Typography enthusiasts reach a point at which they can recognise a font after seeing only a few letters in the wild, and usually identify its close family if not the font itself. It’s unusual then for a font to leave them completely stumped, but that’s where [Marcin Wichary] found himself. He noticed a font which many of you will also have seen, on typewriter and older terminal keys. It has a few unusual features that run contrary to normal font design such as slightly odd-shaped letters and a constant width line, and once he started looking, it appeared everywhere. Finding its origin led back well over a century, and led him to places as diverse as New York street furniture and NASA elevators.

The font in question is called Gorton, and it came from the Gorton Machine Co, a Wisconsin manufacturer. It’s a font designed for a mechanical router, which is why it appears on so much custom signage and utilitarian components such as keyboard keys. Surprisingly its history leads back into the 19th century, predating many of the much more well-know sans serif fonts. So keep an eye out for it on your retro tech, and you’ll find that you’ve seen a lot more of it than you ever knew. If you are a fellow font-head, you might also know the Hershey Font, and we just ran a piece on the magnetic check fonts last week.

Thanks [Martina] for the tip!

Llama.ttf Is AI, In A Font

It’s a great joke, and like all great jokes it makes you think. [Søren Fuglede Jørgensen] managed to cram a 15 M parameter large language model into a completely valid TrueType font: llama.ttf. Being an LLM-in-a-font means that it’ll do its magic across applications – in your photo editor as well as in your text editor.

What magic, we hear you ask? Say you have some text, written in some non-AI-enabled font. Highlight that, and swap over to llama.ttf. The first thing it does is to change all “o” characters to “ø”s, just like [Søren]’s parents did with his name. But the real magic comes when you type a length of exclamation points. In any normal font, they’re just exclamation points, but llama.ttf replaces them with the output of the TinyStories LLM, run locally in the font. Switching back to another font reveals them to be exclamation points after all. Bønkers!

This is all made possible by the HarfBuzz font extensions library. In the name of making custom ligatures and other text shaping possible, HarfBuzz allows fonts to contain Web Assembly code and runs it in a virtual machine at rendering time. This gives font designers the flexibility to render various Unicode combinations as unique glyphs, which is useful for languages like Persian. But it can just as well turn all “o”s into “ø”s or run all exclamation points through an LLM.

Something screams mischief about running arbitrary WASM while you type, but we remind you that since PostScript, font rendering engines have been able to run code in order to help with the formatting problem. This ability was inherited by PDF, and has kept malicious PDFs in the top-10 infiltration vectors for the last fifteen years. [Citation needed.] So if you can model a CPU in PDF, why not an LLM in TTF? Or a Pokemon clone in an OpenType font?

We don’t think [Søren] was making a security point here, we think he was just having fun. You can see how much fun in his video demo embedded below.

Continue reading “Llama.ttf Is AI, In A Font”

A Journey Through Font Rendering

In the wide world of programming, there are a few dark corners that many prefer to avoid and instead leverage the well-vetted libraries that are already there. [Phillip Tennen] is not one of those people, and when the urge came to improve font rendering for his hobby OS, axle, he got to work writing a TrueType font renderer.

For almost a decade, the OS used a map table encoding all characters as 8×8 bitmaps. While scaling works fine, nonfractional scaling values are hard to read, and fractional scaling values are jagged and blocky. TrueType and font rendering, in general, are often considered dark magic. Font files (.ttf) are structured similarly to Mach-O (the binary format for macOS), with sections containing tagged tables. The font has the concept of glyphs and characters. Glyphs show up on the screen, and characters are the UTF/Unicode values that get translated into glyphs by the font. Three critical tables are glyf (the set of points forming the shape for each glyph), hmtx (how to space the characters), and cmap (how to turn Unicode code points into glyphs).

Seeing the curtain pulled back from the format itself makes it seem easy. In reality, there are all sorts of gotchas along the way. There are multiple types of glyphs, such as polygons, blanks, or compound glyphs. Sometimes, control points in the glyphs need to be inferred. Curves need to be interpolated. Enclosed parts of the polygon need to be filled in. And this doesn’t even get to the hinting system.

Inside many fonts are tiny programs that run on the TrueType VM. When a font is rendered at low enough resolutions, the default control points will lose their curves and become blobs. E’s become C, and D’s become O’s. So, the hinting system allows the font to nudge the control points to better fit on the grid. Of course, [Phillip] goes into even more quirks and details in a wonderful write-up about his learnings. Ultimately, axle has a much better-looking renderer, we get a great afternoon read, and fonts seem a little less like forbidden magic.

Maybe someday [Phillip] will implement other font rendering techniques, such as SDF-based text renderers. But for now, it’s quite the upgrade. The source code is available on GitHub.

Finally! A Typeface For Hardware People

When it comes to novelty typefaces there is no shortage of weird and wonderful fonts to be found when you have finally tired of Comic Sans. Everything from bananas forming letters to Wild West saloon lettering can be yours, plus of course our favourite, the embossed Dymo label. But there’s a new kid on the novelty typeface block, and for us it sweeps all before it.

Scopin’ Sans is as its creator [Guy Dupont] calls it “A typeface for hardware people”, and its party trick is that it doesn’t produce letters. Instead it forms an oscilloscope trace that displays what it would look like as serial data. Instantly your text jumps straight to 1337, and you win the internet.

We have shamefacedly to admit that we don’t know binary ASCII by sight, so we’ll have to take his word for it. But for the curious there’s a demo from which you can amuse yourself creating traces, and if you can’t recognize serial ASCII then the chances are few of the people around you can either. We take our hats off to [Guy], and it’s something we’re sure we’ll use at some point to delight and confuse our friends. It’s not the first font we’ve brought you, here are some more if you come from the bitmap era.

Modifying Old Fonts In The Name Of Baseball

Baseball is in full swing again, and having recently accepted a position with Major League Baseball, [Ty Porter] is warming up with a big contribution to the MLB LED Scoreboard project — modifying 20-some old fonts to support baseball’s ‘ꓘ’ character that indicates a special strikeout with a called third strike (meaning the batter didn’t take a swing).

The problem is that Major League Baseball-the-entity recently deprecated the original data source for the scoreboard project. This called for a huge refactor of the codebase, including previously-patched fonts which were now showing either the font’s default no-character character, or nothing at all.

Fortunately, BDF font files are fairly human-readable and make reference to bitmap, which is an actual bitmap in hex. [Ty] settled on Unicode A4D8 (ꓘ), a character from the Tibeto-Burman language Lisu that certainly looks good enough to this baseball fan. Then it became a matter of mirroring the bitmap for ‘K’. [Ty] tried a few things like reversing the nibbles and looking up each one in a table, but that also mirrors the padding, which is bad news.

Then he tried not reversing the nibbles and just looked them up in a table, but this approach dropped and added bits unintentionally. Finally, he tried reversing the order, looking up the reversed nibble, and shifting each byte until there was no padding. This worked for most of the 20 fonts [Ty] patched. The others fell in line with some manual work.

Not much of a baseball fan? You’re almost guaranteed to like this one, especially if you hate mayo.

Hackaday Links Column Banner

Hackaday Links: May 1, 2022

We start this week with news from Mars, because, let’s face it, the news from this planet isn’t all that much fun lately. But a couple of milestones were reached on the Red Planet, the first being the arrival of Perseverance at the ancient river delta it was sent there to explore. The rover certainly took the scenic route to get there, having covered 10.6 km over the last 424 sols to move to a position only about 3.5 km straight-line distance from where it landed. Granted, a lot of that extra driving was in support of the unexpectedly successful Ingenuity demonstration, plus taking time for a lot of pit stops along the way at interesting features. But the rover is now in place to examine sedimentary rocks most likely to harbor the fossil remains of ancient aquatic life — as opposed to the mainly igneous rocks it has studied along the crater floor so far. We’re looking forward to seeing what happens.

Continue reading “Hackaday Links: May 1, 2022”

Can You Identify This Mystery Unicode Glyph?

For anyone old enough to have worked with the hell of multiple incompatible character sets, Unicode has been a liberation; a true One Character Set To Contain Them All. We have so many Unicode characters to play with that there’s a fascinating pursuit in itself in probing at the obscure corners of what can be rendered on screen as a Unicode glyph. With so many disparate character sets having been brought together to make the Unicode standard there are plenty of unusual characters to choose from, and it’s one of them that [Jonathan Chan] has examined in detail.

U+237C ⍼, or the right angle with downwards zigzag arrow, is a mysterious Unicode symbol with no known use and from an unknown origin. XKCD featured it as a spoof “Larry Potter”, but as [Jonathan]’s analysis shows it’s proving impossible to narrow down where it came from. Mystical cult symbol? Or perhaps fiscal growth in an economy in which time runs downwards? Either way, when its lineage has been traced into the early 1990s with no answer to the question it appears that there may be a story behind it.

Hackaday readers never cease to amaze us with the breadth of their knowledge, ingenuity, and experience, so we think it’s not impossible that among you there may be people who will turn and pull a dusty computer manual from the shelf to give us the story behind this elusive glyph. We’d love to hear in the comments below.

Meanwhile if Unicode sparks your interest, we’ve given it a close look in the past.

Thanks [Jonty] for the tip.