Adding Font and Removing Arduboy Font

So I have two issues i’m trying to solve.

  1. I want to replace the font that I’m currently using in the program I’m writing

  2. When I compile and use avr-nm to decompile my elf and see the size of objects in my code, at the very top is font. Which I believe is defined in glcdfont.c. I don’t see any immediate references to string or printing. Any tricks on determining how to remove this from my project? at 0x00000500, it comes out to 1280 bytes which I believe is dead weight in my program.

00000500 t font
0000041a B arduboy
00000388 T Ship::DrawOnMap()

The latest version of the Arduboy library moves the write() function, used to print text, to a separate class. The font will no longer be included if you don’t use the new AbPrinter class or the Arduboy drawChar function. However, you will be responsible for rendering text yourself.

See Upgrading to 1.2

1 Like

Right now you’d have to provide your own drawChar() function to replace the font - and in that method reference your new font. You could subclass Arduboy to do this or just have the function outside the class. And as Scott said you can’t “repace” the font if you aren’t using the pre-release lib from github. Otherwise you’ll just be ADDING another font, not replacing one.

We probably should make the font replaceable though.

1 Like

I thought that might be the case but I didn’t want to create work where I didn’t need to and I couldn’t find any info online. The update removed the font too! Thanks guys! Now I can create a character draw function and not have both in memory.