greiman / SSD1306Ascii

Text only Arduino Library for SSD1306 OLED displays
MIT License
490 stars 120 forks source link

How would one add a new font to the driver? #84

Closed JonRobert closed 2 years ago

JonRobert commented 2 years ago

Hi, I've modified a copy of Zevvpeep replacing the $ with the ° char. I would like to add a copy to the library and not change the Zevvpeep font file.

I've added a renamed font in these places with no luck. 1) allfont.h added name of new file 2) in the font file itself 3) SSD1306mainpage.h added name of new file.

BTW Many thanks for this code. Currently I'm using a 16x2 OLED, printing the numbers in CaLite24 and the units in ZevvPeep8x16 works great.

greiman commented 2 years ago

ZevvPeep8x16.h has a quirk. The include guard is:

#ifndef font8x16_h
#define font8x16_h
....
#endif  // font8x16_h

It should be ZevvPeep8x16_h and I will change this in a future version.

You must use a different include guard for your copy.

A font file name only appears in these places:

C:\Users\Bill\Documents\Arduino\libraries\SSD1306Ascii\src\fonts\allFonts.h (1 hit) Line 63: #include "X11fixed7x14B.h" C:\Users\Bill\Documents\Arduino\libraries\SSD1306Ascii\src\fonts\X11fixed7x14B.h (4 hits) Line 8: #ifndef X11fixed7x14B_h Line 9: #define X11fixed7x14B_h Line 10: GLCDFONTDECL(X11fixed7x14B) = { Line 113: #endif // X11fixed7x14B_h