4x6 Font for the Arduboy

I have created a 4 x 6 font for the Arduboy.

Previously I created a 3x5, here > 3x5 Font for those with good eyesight

It has the upper- and lower-case alphabet, numbers and the exclamation mark and the period. You can easily add extra characters if you like.

There is a #define that allows you to remove the lower case letters. Doing so strips out 108 bytes.
A sample program is shown below:

    #include <Arduboy2.h>
    #include "src/fonts/Font4x6.h"

    Arduboy2Base arduboy;
    Font4x6 font4x6 = Font4x6();

    void setup() {

      arduboy.boot();

    }

    void loop() {

      if (!(arduboy.nextFrame())) return;

      arduboy.clear();
      font4x6.setCursor(12, 12);
      font4x6.print(F("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
      font4x6.print(F("\nabcdefghijklmnopqrstuvwxyz"));
      font4x6.print(F("\n0123456789"));
      font4x6.print(F("\n!."));

      arduboy.display();

    }

You can also pass a line height to the constructor, as shown below:

Font4x6 font4x6 = Font4x6( 11 );

22%20pm

Check it out!

8 Likes

As a comparison …

22%20pm

1 Like

The descender on the lower case f looks a bit strange to me.

1 Like

You don’t like it going below the other letters?

Correct. I think the bottom of the f should be even with abcde and other letters without descenders.

From the article you linked to:

In most fonts, descenders are reserved for lowercase characters such as g, j, q, p, y, and sometimes f.

I have included the artwork into the repository so people can alter or create their own!

Its a spreadsheet and calculates the data automatically …

2 Likes

Great font, it was just what I was looking for. The default font is a bit too big and takes up too much room on the intro screen of my new game, but the tiny font was too small. This one is just right and still very readable. Thanks.

If you want to see where it is being used, the game is Arduban, yet another Sokoban clone with 255 levels. I’ll hopefully be announcing it on the forum soon.

1 Like

Glad you could use it. Did you keep the standard font our alter it to your needs?

The standard font works well for me. My code is MIT license, so I just added your BSD-3 to the headers of the files I copied in and linked to your GitHub repo in my README. Hope that works for you.

I’m adding screenshots right now, so I should be pushing some images of the game in a few minutes.

Thanks again.

1 Like

Here’s a screenshot of it in use. The smaller font allowed me to fit the level selection and the number of moves the level is solved in using the small space in the lower right to keep the graphic interesting. Thanks again…

Intro

Nice … (and small!)

Forgot to mention … you may be able to change your reference from Arduboy2 to Arduboy2Base (if you are not using any USB features and save a chunk of memory. Worth a go!

1 Like

?? Arduboy2Base doesn’t remove any USB features, only the built in text functions. :confused:

Oh … yes you are right, I mixed the savings from the text up with the ARDUBOY_NO_USB macro. Two potential savings for @rprouse

3 Likes

I’d prefer to keep the game easy to load, but I’ll keep that in my back pocket. I’ve got most of my functionality done and am sitting at 91%. I came up with an interesting way to compress the levels that allowed me to fit the 255 levels along with the graphics and other libraries I’m using. I actually managed to get to nearly 300 levels, but as an old school programmer, I’m attracted to 255 :wink:

1 Like