(u8g2_for_adafruit_gfx) How to change font size?

Im using this code! I want to know how to change font size

#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;

#include <U8g2_for_Adafruit_GFX.h>
U8G2_FOR_ADAFRUIT_GFX u8g2_for_adafruit_gfx;

void setup()
    u8g2_for_adafruit_gfx.begin(tft);                 // connect u8g2 procedurhes to Adafruit GFX
    u8g2_for_adafruit_gfx.setForegroundColor(TFT_WHITE);  // apply Adafruit GFX color
    u8g2_for_adafruit_gfx.setBackgroundColor(TFT_BLACK);  // apply Adafruit GFX color

void loop(void) 

   // u8g2_for_adafruit_gfx.setFont(u8g2_font_unifont_t_korean2);  // use korean for all the glyphs of "헬로월드"
    u8g2_for_adafruit_gfx.setFont(u8g2_font_unifont_t_korean1);    // use korean for all the glyphs of "헬로월드"
    u8g2_for_adafruit_gfx.setCursor(0, 60);
    u8g2_for_adafruit_gfx.print("한국사\n");   // Korean


The normal way would be to use a different font

Yep, using a different font is likley to be the way ...........

The Command reference for U8g2_for_Adafruit_GFX does not appear to list any commands for directly controlling font size.

1 Like

Yes, you need a different font. i.e. with a bigger point size.
However this will use more bytes and hence will not fit in an AVR.

I presume that you are Korean. In which case, what do you do in Korea ?

I guess that Chinese, Japanese, Korean, ... fonts are just too big for an AVR. And most Chinese applications use a GeniTop ROM or similar.
If your application has a fixed number of text messages you only need to store those particular characters.
But any general purpose application would need a complete font. e.g. from a Font ROM.

If you have a Font ROM, I would show you how to use it with MCUFRIEND_kbv
But I would need you to do the testing and provide feedback on GitHub.

U8g2_for_Adafruit_GFX should work fine on ARM or ESP32 targets e.g. Arduino Due.
These have plenty of Flash memory and no restrictions on the Font size.


Edit. Corrected the Font brand name. i.e. Genitop

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.