Trying to make new font


(Marcus L. Sanders II) #1

So I want to make a game that has a lot of dialogue so the standard font used for Arduboy wont cut it, so I made my own font but I have no idea how to make a header for Arduboy to use.

8%20bit%20custom%20font

This is my amateur custom font.


(Kea Oliver) #2

why is your Z backwards?


(Marcus L. Sanders II) #3

The better question is how did I missed that?


#4

I had a go at making your font into an ‘Arduboy-compatible’ byte array, but the spacing between characters is inconsistent, so it would require a lot more work ‘by hand’ than I am willing to do… I got as far as the numbers:

{0x00, 0x12, 0x1f, 0x10}, // 1
{0x00, 0x19, 0x15, 0x12}, // 2
{0x00, 0x00, 0x15, 0x1f}, // 3
{0x00, 0x07, 0x04, 0x1f}, // 4
{0x00, 0x00, 0x17, 0x0d}, // 5
{0x00, 0x1f, 0x15, 0x1d}, // 6
{0x00, 0x00, 0x01, 0x1f}, // 7
{0x00, 0x1f, 0x15, 0x1f}, // 8
{0x00, 0x07, 0x05, 0x1f}, // 9
{0x00, 0x1f, 0x11, 0x1f}  // 0

Numbers1

@filmote has already put in the work creating some nice small fonts - why not use those?



(Scott) #5

You could look at Arduboy-Tinyfont.


(Marcus L. Sanders II) #6

Sorry fellas, but I really don’t want to use Tinyfont, it’s a font I don’t want to use, the style of the font isn’t up my alley.


(Scott) #7

I provided a link to Tinyfont as an example because you asked how to make your font usable with an Arduboy.


(Pharap) #8

Step 1:
Figure out how to change your font so that all the letters take the same amount of screenspace.
(I.e. make it monospace.)

You can have variable-width spacing (i.e. kerning),
but it would be a lot more work and (more importantly) eat a lot more progmem.


(Marcus L. Sanders II) #9

Mono spacing, eh? So something like this?

That thread didn’t really help much because it never explained how the font was made, that thread was all about code optimization which is great for future reference but I still don’t know where to begin.


(Pharap) #10

That’s a start. Some of your symbols (exclamation mark, tilde?, minus) look like they’re still 1x5 instead of 3x5, but that’s fixable.

Since that font is 3x5 and @filmote’s Font3x5 is open source (BSD 3-clause),
you can use his code as a basis for writing your own code.

You’d just have to change the font data and add some lines to handle the extra characters that you want to handle.


(Pharap) #11

I started going through it, and actually your font is very similar to the Font3x5 font,
so there’s only a few characters that would need changing.

(In fact I think this image is out of date. The real thing seems to be much more similar.)


(Marcus L. Sanders II) #12

Sweet! Thanks man, when I get the time I’ll definitely experiment with this font.


(Pharap) #13

I actually made a start on getting it working yesterday.

I’ve converted all the letters and numbers (actually I stole the numbers from @uXe :P).
I’ve also done !, ", %, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, [, \, ], ^, _, `, {, |, }.
I’m still missing &, #, $, @, ~.

I could manage all the ones that will fit in 3x5 that you already have symbols for,
but the ones that are 4 or wider (e.g. #, @, ~) or the ones that you don’t have symbols for are going to have to be fixed, added or scrapped.

(It takes about 10-20 seconds to convert each character to image data by hand.)


(Scott) #14

P Q and R look like they need some work.

Edit: And \ renders as /


(Pharap) #15

There are two difficult problems in computer science.
Naming things, cache invalidation and off-by-one errors.

To get three off-by-one errors in a row is either bad luck or poor eyesight.
(And frankly I’d be surprised if it’s just three.)

No it doesn’t, it’s actually the input string that’s wrong.
I wrote font3x5.println(F("[/]^_`")); instead of font3x5.println(F("[\\]^_`"));


(Scott R) #16

Best I can do on my phone


(Marcus L. Sanders II) #17

I say scrap them, I can figure out a different font another day, Q and R look funny but overall it looks good.


(Pharap) #18

I’ve fixed that since then.

Try it for yourself:


(Marcus L. Sanders II) #19

Alright! …How do I use it?


(Marcus L. Sanders II) #20

I got as far as having it included in Arduino’s library but I have no idea how to use it in a code.