JIT bitmap text rendering for microcontrollers

56 points - today at 10:42 AM

Source

Comments

drfuchs today at 12:32 PM
For prior related work, check out patent US-6377261-B1 "Compiling glyphs into instructions for imaging for execution on a general purpose computer" filed 1996. The basic idea is each character turns into a sequence of "Load Immediate" / "Shift" / "OR to Memory" instructions; so there's no more fetching from a stored bitmap of the font, as the pixels are implicit in the Immediate data in the generated machine code. Then you can get fancy when one row of pixels is the same as the previous row in the character, so you don't even need to do the Load Immediate. Etc. This scheme was used in FrameMaker for Macintosh back in the day, as implemented by Gus Fernandez (who went hog wild on additional optimizations).
codazoda today at 12:55 PM
I've been building BASIC32, a retro BASIC interpreter for microcontrollers so I can flash it once and easily create lots of new projects.

What you give up with the authors approach is "read". The screen becomes write-only. There are only a few functions that require reads: getting a pixels current color and doing operations like flood fills or paints.

Because I was going for the retro feel of BASIC, I wanted to support these, so I opted for a frame buffer. It isn't as technically cool. On the RP2350, it does require low resolution and low bit rates because they often have RAM limited to KB.

If you step-up to the ESP32-S3 variants with 4MB or 8MB of RAM the frame buffer gets much easier.

dsign today at 1:02 PM
Added "race the beam" to my personal dictionary today :-). It's such a breath of fresh air to read something which is not written by an LLM.
erichocean today at 1:13 PM
This is cool, I did something similar with a CoreText replacement I've been building recently.

My code can JIT + render to the atlas faster at p100 than CoreText can render without the JIT at p50, and with better quality (measured against an exact cover reference).

toolbrewlab today at 2:49 PM
[flagged]