m5stack / M5Unified

Unified library for M5Stack series

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

changing font

7h30th3r0n3 opened this issue · comments

Hi ! thanks for the great work !

What is the way to change the font ?

I tried things like :
M5.Display.setFont(&fonts::Font4);
or

void gfxSetup (LGFX Device* gfx) {
 gfx->setFont(&fonts::efontCN 12);
}

but it seem to not changing any font at all, and chinese characters are not printed correctly on screen while using
M5.Display.println("something);

more info : 7h30th3r0n3/Evil-M5Core2#2

Hello, @7h30th3r0n3 .
Please try the code below.

#include <M5Unified.h>

void setup() {
    M5.begin();
    M5.Display.setFont(&fonts::efontCN_12);
    M5.Display.print("你好世界");
}

image

I looked at the code in the URL you linked, and it seems likely that you are using the setTextFont function to disable the font each time.
After setting the font, we recommend checking whether the font has been changed unintentionally before drawing