Go Down

Topic: U8g2 Fonts Diplay a . as a little + (Read 144 times) previous topic - next topic


I am using my ST7920 Display to show a couple of line of data, and I am limited a font of 7 pixels high.

I tried a few fonts, even larger ones, and with all of them a . is displayed as a little +. I simply cannot understand why the conventional little square made up by 4 pixels were used.

This makes floating point numbers look a bit funny and a : looks plain ugly.

Are there any fonts where these characters are displayed as one see on all displays?


I am confused. You say, that the dot (.) is displayed as a little plus (+). I just checked the 6x12 font:

I would say, it is not like this. Can you send a screenshot with the corresponding code?



Hi Oliver.

I am a little red faced here since you responded on the same day and I missed it. I think my email alerts are not working.

Her is an image from Google. Have a look after number 9. This is that it looks like.


Jun 14, 2018, 12:23 pm Last Edit: Jun 14, 2018, 12:27 pm by david_prentice
You have limited choices when creating bitmaps for a small font.  e.g. a period
Code: [Select]

 O    OO
OOO   OO    OO
 O          OO

Most people choose the four-pixel version.    Likewise for a colon.
Yes, the font in Oliver's GraphicsTest example uses 5 pixels.    I got out the magnifying glass.
I am viewing it on a 0.96" OLED.   I have not been offended.

It does not look attractive on your big ST7920 display.

Personally,   I find the regular 7x5 System font which is the default in Adafruit_GFX libraries to be a good compromise.   It is acceptable x2.   It looks blocky at any other magnifications.

Oliver provides a massive choice of fonts with u8g2.
Of course you are unlikely to select large fonts on a tiny display.



Jun 14, 2018, 05:46 pm Last Edit: Jun 14, 2018, 07:42 pm by olikraus
I think David has descibed the problem very well.

For me as author of U8g2, I just add existing bitmap font. Of course I do review the fonts before adding them to U8g2, but I never change the font. The shape of each glyph had been a decision of the font author and I respect this decision. However in U8g2 there are many other fonts, so I am sure you will find a suitable font for yourself.

The font list (https://github.com/olikraus/u8g2/wiki/fntlistall) might be a good starting point. Click on the font to see the details.



I wrote a little program to show some fonts.    It runs on a Uno.   Change constructor for your display.

Code: [Select]

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

void setup()
    // put your setup code here, to run once:


#define B(x) { x, #x }

typedef struct {
    const uint8_t *font;
    const char name[30];
} font_t;

const font_t PROGMEM fonts[] = {





void loop()
    font_t *f;
    char buf[32];   //to copy PROGMEM strings
    int sz = sizeof(fonts) / sizeof(fonts[0]);
    for (int idx = 0; idx < sz; idx += 6) {
        for (int i = 0; i < 6; i++) {
            if (idx + i >= sz) break;
            f = fonts + idx + i;
#if 1
            u8g2.drawStr( 0, i * 10, strcpy_P(buf, f->name + 10));
            u8g2.setCursor( 0, i * 10);
            u8g2.print(idx + i);
            u8g2.print(" :;.,");

It gives you an idea of what the fonts look like.   Repeat the loop with index number and ":.;" to see what you like.

Incidentally,  most of the fonts that I selected use a 4-pixel period.



Jun 14, 2018, 07:45 pm Last Edit: Jun 14, 2018, 07:46 pm by olikraus
Cool  :smiley-cool: Nice use of the stingizing operator: Karma+



Go Up