Asteroids font
Asteroids font
My version of the Asteroids font is derived from Ed Logg's hand-written notes (shown in this archived post from edge-online.com/features/making-asteroids). I modified a few of the characters to make them more distinct as well as added a strike to the 0 so that it stands out from the O.
Examples
![]() |
![]() |
I've used the font in my Asteroids "clone" Space Rocks, as well as my Vectorscope clock and Twitter oscilloscope. It is a very easy font to embed, so it shows up in several places where I need to draw legible text with a microcontroller. It is uppercase only, and I've had to create a few special characters for ones that weren't represented in Logg's notes.
Code
The source code is in github.com/vst/teensyv/asteroid_font.c and has been compressed to use very little memory in representing the font in memory.
The drawing routine extracts the 4-bit X and Y offsets from the array and generates the moveto() or lineto() commands:
const uint8_t * const pts = asteroids_font[- ' '](c).points;
int next_moveto = 1;
for(int i = 0 ; i < 8 ; i++)
{
uint8_t delta = pts[i](i);
if (delta == FONT_LAST)
break;
if (delta == FONT_UP)
{
next_moveto = 1;
continue;
}
unsigned dx = ((delta >> 4) & 0xF) * size;
unsigned dy = ((delta >> 0) & 0xF) * size;
if (next_moveto)
moveto(x + dx, y + dy);
else
lineto(x + dx, y + dy);
next_moveto = 0;
}
return 12 * size;

