Go Down

Topic: RetroLCD: Bitmap Fonts (Read 524 times) previous topic - next topic



"Bitmap Font" is just a fancy term for sprites intended to convey information to a user defined in strings.

In fact, you could use the techniques talked about in this tutorial to convert Game Boy sprites into sprites you can use on the Arduino with those commonly available 128x64 i2c OLED displays.  You can also now use any paint program to draw your sprites instead of using graphing paper.

While the tutorial uses PHP to read the images and convert them into C for the Arduino, you could use about any language.  PHP just provides a very easy way to read and scan images.  The key take away is that you can use code to write code to save yourself a lot of time.  Even when working with a limited device like the Arduino.

The main focus of this project was to get the Code Page 437 character set into the Arduino.  It takes 4KB of PROGMEM which is reasonable.  And it includes many characters that were intended from the beginning to be used in text based games and in text based user interfaces.

I've also converted the character set found on commonly used 1602 LCD Character Displays.  This is a smaller but very readable font which only takes about 1280 bytes of PROGMEM.

The novel solution presented here is rotating the font 90 degrees since the fonts are 8 bits tall and 5 bits wide.  If you were to store them horizontally, you'd have to take up 8 bytes per character instead of the 5 bytes used here.  In fact when working with the Character Display directly creating customer characters, you are expected to use 8 bytes of memory per custom character.

The provided code for rendering takes this rotation into account when using the 5x8 size font.

Basically this tutorial covers a lot of information on how to read images and turn them into sprites given a variety of source images and encoding.

Go Up