Giant Fonts, Limited Character set (small files for micros)

128x128 pixel 1.5" full colour OLED display with MicroSD card slot. [Product page]
Post Reply
mikehains
Posts: 5
Joined: Fri Jul 26, 2013 2:17 pm

Giant Fonts, Limited Character set (small files for micros)

Post by mikehains » Sat Dec 12, 2015 6:36 am

Giant fonts take up a lot of space.

In the wiki for FTOLED there is a note at the bottom of the page about creating larger fonts (see https://github.com/freetronics/FTOLED/w ... aying-Text).

It isn't clear however, how to make a font with just a few characters. The answer wasn't obvious to Mr Google, so I went about experimenting.

If you use the suggested software (GLCDFontCreator2) you can:

-> Download GLCDFontCreator2 from https://code.google.com/p/glcd-arduino/ ... eator2.zip
-> Extract
-> Run using start.bat
-> Select [File]/[New Font]
-> In the right hand column select [Import Font] and choose a font ! eg Batang
-> Just below that, select size (eg 64)
-> In the left hand column select "Start Index" as 48 (ie start with the '0' character)
-> Make "Character Count" 11 (ie all the numbers, plus the colon)
-> At the top of the column name the new font, eg Batang_64
-> Click [Export] / [Export font]
-> Put in the same name, eg Batang_64.h
-> Copy to the correct folder: C:\Users\DadsHP\Documents\Arduino\libraries\FTOLED-master\fonts
-> Open the file, and:
-> Replace:
#include <inttypes.h>
#include <avr/pgmspace.h>
with
#include <inttypes.h>
#ifdef __AVR__
#include <avr/pgmspace.h>
#else
#define PROGMEM
#endif
-> Change: static uint8_t Batang_64
to static const uint8_t Batang_64

Now you should have a custom font with only the numbers and the colons, and very small size to load into your micro.

Works for me !

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Giant Fonts, Limited Character set (small files for micros)

Post by angusgr » Wed Dec 30, 2015 5:46 am

Thanks for posting these steps, very helpful!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests