M5Unified icon indicating copy to clipboard operation
M5Unified copied to clipboard

changing font

Open 7h30th3r0n3 opened this issue 1 year ago • 1 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 : https://github.com/7h30th3r0n3/Evil-M5Core2/issues/2

7h30th3r0n3 avatar May 10 '24 11:05 7h30th3r0n3

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

lovyan03 avatar May 10 '24 12:05 lovyan03

Thanks for your time 😉

7h30th3r0n3 avatar Jul 31 '24 19:07 7h30th3r0n3