Font Issue - Help!

I have the BBC Micro 16x16 bitmap, but for some reason it's refusing to behave, can anyone spot the issue with the .fnt file: playdate_fonts/Source/fonts at main · orllewin/playdate_fonts · GitHub

For some reason it breaks at the '*'.

You can see in this image, I'm printing the chars in the order they appear, but the * is missing then all glyphs after that are drawn with the system default.

Seemingly with that glyph breaking the font parser somehow, all subsequent chars are an index out..!

* is used to bracket bold text--and your font has no bold, so a system font replaces the bold portion.

If you want an actual star, escape it with a preceding backslash: \*

(Not all of Playdate's drawing function support bold and italic styles, but graphics.drawText does. Also, the "normal" isn't needed for this case—normal is the default anyway.)

But why is the second case failing, where there's no bold character?

That sounds like some second, separate bug—or a glitch in the font. Assuming it's a separate PNG and FNT, you might look at the FNT file's contents and see if anything looks weird in it. (Or in Caps itself.)

I have heard of issues with Caps offsetting characters by 1 when a two-character Unicode glyph (like some emojis) is used... but that was just Caps, not an issue in-game IIRC.

Aah I see on your first point now, yes, that makes sense, it's switching to bold inline, thank you.

But the wider issue remains, why on earth is everything 1 out? The .fnt is my own, from this BBC char sheet.

When you examine it in Caps, does everything look OK? This second issue seems font-specific

I tried Caps, and that might have exposed the bug - there seems to be an assumption that the first entry will be a space, even though that's not the index I've specified in the .fnt file, and it's not defined that way in the spec as far as i can tell. I had a quick look through the fonts shipped with the SDK and they all have the space char at index 0 so that might be why this hasn't surfaced before.

Caps is happy now but it's still an index out running on the simulator. I give up!

Sounds promising! Luckily Caps can rebuild the bitmap for you with "space" added

1 Like

Figured it out - there were two colons, you can see in the spritesheet above - after 9 and towards the end, different characters, but I'd entered them the same, the second one is actually 'broken bar': ¦¦¦¦¦¦¦¦

1 Like