1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/examples/libs/tiny_ttf/lv_example_tiny_ttf_1.py
2023-11-13 16:47:18 +01:00

18 lines
466 B
Python

from ubuntu_font import ubuntu_font
#
# Load a font with Tiny_TTF
#
#Create style with the new font
style = lv.style_t()
style.init()
font = lv.font_t()
lv.tiny_ttf_create_data(font, ubuntu_font, len(ubuntu_font), 30)
style.set_text_font(font)
style.set_text_align(lv.TEXT_ALIGN.CENTER)
# Create a label with the new style
label = lv.label(lv.screen_active())
label.add_style(style, 0)
label.set_text("Hello world\nI'm a font created with Tiny TTF")
label.center()