Log In  


Hi, I made a 3x4 custom font following the "Variable Width P8SCII Fonts" part there: https://www.lexaloffle.com/bbs/?tid=49075
Everything works fine, including variable char widths, but I found 2 small problems:

  • using P8SCII "#" to change background color is 1 line and 1 column short, as shown on "BASE" here:
  • stopping the program and then resuming it switched the font back to defaut (and also shows the "BASE" background color as intended):
1


Regarding font borders, if you have not disabled the top and left padding with "\^-b", try using
poke(0x5f5b,0x11) --[offset_x (low nibble), offset_y (high)].

Also, if you interrupt the cart or switch to the editor screen, some memory areas will be reset.

This applies not only to switching custom fonts, but also to sprites of other carts that are reloaded.

To avoid this, it seems necessary to always set the valid flag for the custom font in the drawing function.

function _draw()
 poke(0x5f58,0x80)
 -- draw code --
end

1

Thanks for bringing my attention to \^-b @shiftalow, in fact I can't find any of this in my code that would disable top and left padding, but adding \^b to # works with my custom font. Ie print("\^b\^#base",15,5,0x80) shows a nice black on red "base" as intended. But again this wasn't disabled before so I guess something in the custom font process may mess with that, or maybe there's a poke that disabled this but I don't know which memory address.

EDIT: got it. To use the custom font I had to poke(0x5f58,81) but it set 0x2 (padding) to none. With poke(0x5f58,83) it's fine. And you're right on putting this on _draw instead of _init, this way resuming the cart still shows the custom font.



[Please log in to post a comment]