I'm using an Adafruit 1431 OLED with my Nano using the SSD1351 library. I would like to display a degree symbol, but there's no such character included in the font (FreeSansBold9pt7b.h).
One solution would be to modify another character, for instance the "" character (0x60) since I won't ever use it, but how do I modify the font file to make 0x60 show "°" instead of ""?
I've read a few examples where the bitmap is represented by a number of values, each the "sum" of a row or column in the bitmap, and that makes sense but I can't decipher that kind of structure in the selected font file.
david_prentice:
If you use the regular 7x5 font, degree is 0xF7
Alternatively, use a “full” version of a Free Font and degree is 0xB0
Thanks, but is there no way to learn how to modify existing characters? The FreeSansBold is by far the best font for my application, but it lacks the degree sign.
There’s a file in my Fonts folder called <fontconvert.c> which says:
// Minimal font and per-glyph information is stored to
// reduce flash space requirements. Glyph bitmaps are
// fully bit-packed; no per-scanline pad, though end of
// each character may be padded to next byte boundary
// when needed. 16-bit offset means 64K max for bitmaps,
// code currently doesn’t check for overflow. (Doesn’t
// check that size & offsets are within bounds either for
// that matter…please convert fonts responsibly.)
I guess this is some kind of explanation to the fact that I can’t decipher the code.
to create your symbol, and that should be simple with a for loop, something like
void createDegreeSymbol(byte x,byte y) {
// you do iterations here ( with display.drawPixel(x,y,color) ) to create a mini circle-like shape resembling a degree symbol ?
}
Yes, you could hand-edit the font. But this would be difficult to explain.
Using a "full" font that includes the extra characters is very straightforward.
But quite honestly, you could simply use display.drawCircle() at the appropriate place on your screen.
It requires nothing more than choosing centre, radius and colour