M5Stack Core2, How to load Custom Font?
-
I was reading: https://community.m5stack.com/topic/388/cahnge-font-size-in-python/ on how to load custom font on my Core2 Board and tried to do it myself.
Given font file in
.ttfformat, I've generated 2 files: in.cand.binformat using the following online tool: https://lvgl.io/tools/font_conv_v5_3Then, I moved them to my Core2 Board and tried to use the new font like this (I'm working with MicroPython):
from m5stack import * from m5stack_ui import * from uiflow import * from valera import * screen = M5Screen() screen.clean_screen() screen.set_screen_bg_color(0xFFFFFF) label0 = M5Label('Hi', x=149, y=86, color=0x000, parent=None) lcd.compileFont("./valera.c") lcd.font("./valera.c")But, every time I run the above code the program crashes and causes a restart to the device.
Any suggestions on what could be the problem here? -
What crash is it, what the error message?
-
I'm not seeing any error message, the device just restarts.
I've tried to use the following code instead (without callinglcd.font):lcd.compileFont("./valera.c") label0 = M5Label('Hi', x=149, y=86, color=0x000, font=valera.fon, parent=None)While it doesn't cause restart the font isn't working (I've tried to search the generated files and
compileFontdoesn't seem to produce any.fonfile, which shouldn't be the case)Side Note: my input
.cfile is less than 100 KB in size, as larger files caused crashes according to the comments in previous posts.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login