Where's the fonts in Adafruit_SSD1306/Adafruit_GFX

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
wa7iut
 
Posts: 11
Joined: Tue Oct 26, 2010 12:27 pm

Where's the fonts in Adafruit_SSD1306/Adafruit_GFX

Post by wa7iut »

I am messing around with the 128x64 1.3" OLED and successfully have put my own bitmaps into Adafruit_SSD1306.cpp but now am looking for where the fonts used by the display.println() and other methods are stored and defined. I've looked through all the library files (in the directories Adafruit_SSD1306 and Adafruit_GFX) but not finding it (or missing it for some reason. Where should I be looking?

Thanks!

Bob

User avatar
jersagfast
 
Posts: 83
Joined: Mon May 16, 2011 1:10 pm

Re: Where's the fonts in Adafruit_SSD1306/Adafruit_GFX

Post by jersagfast »

Hello, I'm pretty sure its the glcdfont.c file in the Adafruit_GFX folder. It is a standard ascii 5 X 7 font.

User avatar
wa7iut
 
Posts: 11
Joined: Tue Oct 26, 2010 12:27 pm

Re: Where's the fonts in Adafruit_SSD1306/Adafruit_GFX

Post by wa7iut »

Thanks, I don't know how I missed that! I was focused on the Adafruit_GFX.cpp file but totally missed the include, even though I was looking for it. Now need to find where the display.println() function is defined.

Thanks again!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Where's the fonts in Adafruit_SSD1306/Adafruit_GFX

Post by adafruit_support_rick »

Adafruit_GFX subclasses Print. Print::print calls Print::write(), which is a virtual function. Adafruit_GFX implements the virtual function as Adafruit_GFX::write. Adafruit_GFX::drawChar is called from there. To complete the picture, Adafruit_GFX::drawChar() calls virtual function Adafruit_GFX::drawPixel to actually render the character on the screen. The virtual function drawPixel is implemented as Adafruit_SSD1306::drawPixel()

If that makes your head hurt as much as it makes mine hurt, feel free to forget about the details and just know that print() winds up back at Adafruit_GFX::drawPixel. Adafruit_GFX::drawPixel accesses the font data structure, and renders the characters pixel-by-pixel with calls to Adafruit_SSD1306::drawPixel()

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”