Printing Outlined Text

Published 2023-06-12

Early on in playing around with PICO-8 I wrote a function to print text with a black outline.

I imagine a lot of people have also done this and I can't be the only person who found it a bit clumsy and, near the end of a project when casting about for tokens, wondered if those five very similar print calls couldn't be reduced.

Nowadays we have P8SCII so I thought I'd have a look. Here are some candidates I've written with their token counts and times from my crude testing:

'?' vs print makes no difference to performance, but does save characters and 1 token each use.

I was rather surprised that p2 uses so few tokens and isn't that slow. Also that p1 is actually the fastest (but only just).

I usually find that tokens are more precious to me than a tiny bit of performance so I'm likely to use p2 above (or p8 even). p4 is pretty cheap at 30 tokens and faster than the naive approach so perhaps it's an overall winner (so far).

I'm very interested to know if anyone has a better way(?)


Specify the colour of the outline:

(Please use any of these functions however you want)