2022-10-26 20:48:12 +02:00
|
|
|
from ubuntu_font import ubuntu_font
|
2023-10-12 20:37:27 +02:00
|
|
|
#
|
2022-10-26 20:48:12 +02:00
|
|
|
# Load a font with Tiny_TTF
|
|
|
|
#
|
|
|
|
#Create style with the new font
|
|
|
|
style = lv.style_t()
|
|
|
|
style.init()
|
2023-11-13 16:47:18 +01:00
|
|
|
font = lv.font_t()
|
|
|
|
lv.tiny_ttf_create_data(font, ubuntu_font, len(ubuntu_font), 30)
|
2022-10-26 20:48:12 +02:00
|
|
|
style.set_text_font(font)
|
|
|
|
style.set_text_align(lv.TEXT_ALIGN.CENTER)
|
|
|
|
|
|
|
|
# Create a label with the new style
|
2023-10-12 20:37:27 +02:00
|
|
|
label = lv.label(lv.screen_active())
|
2022-10-26 20:48:12 +02:00
|
|
|
label.add_style(style, 0)
|
|
|
|
label.set_text("Hello world\nI'm a font created with Tiny TTF")
|
|
|
|
label.center()
|