greiman / SSD1306Ascii

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

Trying to Determine Biggest Text for 128 x 32 #86

Open KungFuHaiku opened 2 years ago

KungFuHaiku commented 2 years ago

Hi there,

First off, thanks for the fantastic library - it's so much snappier than the Adafruit one and has alleviated some blocking issues I had with a real-time application.

My question is whether you know which font and scale combination (e.g. set2X) I can use to capitalise on the screen's real-estate? I'd like the biggest text possible. At the moment I'm using fixednums8x16 with a set2X multiplier, but it could be bigger (or at least bold).

Also, how would I display both some large centred text and then a smaller string next to it (see attached image)? All my attempts are simply replacing one with the other.

oled-example-text

Many thanks.

greiman commented 2 years ago

I can't help with a choice for a better font than fixednums8x16 with a set2X multiplier. A few people have edited fonts with this font editor:

See openGLCDFontCreator.zip here:

https://bitbucket.org/bperrybap/openglcd/downloads/

See this "issue":

https://github.com/greiman/SSD1306Ascii/issues/85

There are several tools that help position text. The key idea is to determine the length of text and then position the cursor correctly.

Use size_t strWidth(const char* str) to determine the size of each section of text in pixels and then position the cursor to the appropriate position for the text. You may need to erase the area.