Log In  

Good morning friends! I was working on a different, text-heavy project, but when I showed it to some friends they had a hard time reading the built-in font.

So I decided that I needed a custom font, but I really don't have the sprite-sheet space to make it work.

I couldn't find one I liked in the BBS, so I built this, and I thought it might be interesting.

Cart #dcfonter-2 | 2020-04-25 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

The font renderer supports variable-width fonts with both upper and lower case. Other than that it's pretty basic: the letters don't have descenders, I only actually drew the glyphs I needed, and I haven't put a whole lot of effort into optimizing any particular part of it.

Still, the final product is pretty small, and easy to modify.

If you want to make your own font, what you do is:

  • Draw your letter-forms in the spritesheet. (Letter dimensions are computed automatically.)
  • If necessary, adjust the character-code mapping in build_font on tab 2.
  • Run the cart, and press a button to copy the encoded font to your clipboard.
  • Go into tab 2 and replace the [[...]] string near the top of the buffer with the contents of your clipboard.
  • Run the cart again to make sure your new font looks like what you want. (Yeah, sorry that the demo part uses the previously-computed font, not the live-built font.)
  • Repeat as necessary. Once you're happy, copy and paste the code from tab 2 into your project.
P#75359 2020-04-25 16:09 ( Edited 2020-04-25 16:14)

This is a really neat devtool cart, thanks for sharing!

P#81155 2020-08-25 11:14

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 06:49:53 | 0.010s | Q:17