How to increase font size of a label?

Hi there,

How can I increase the font size of the label?

When googleing, I get the following recommendation:

label.set_style_text_font(lv.font_montserrat_48, 0)  # Increase font size

But then the app breaks on that line. I guess, the font name on the vobot is different. Any ideas, which font I can use (and how I can look this up myself?).

Thank you!

Cheers,

Tobias

Hello Tobias,

The reason for your problem is: The Dock Hub system does not contain the font file corresponding to font_montserrat_48, so the program will report an error when executing this line.

The following are the fonts currently supported by Dock Hub:
[‘font_ascii_10’, ‘font_ascii_14’, ‘font_ascii_18’, ‘font_ascii_22’, ‘font_ascii_bold_18’, ‘font_ascii_bold_22’, ‘font_dejavu_16_persian_hebrew’, ‘font_ascii_bold_28’, ‘font_ascii_bold_48’, ‘font_icons_32’, ‘font_numbers_32’, ‘font_numbers_72’, ‘font_numbers_92’]

You can use the dir function to view the properties and font files provided in the lvgl library. We will also update the supported fonts to the developer documentation later.

It should be noted that:

  • If you want to use different font sizes for the same text, you need to call different font files
  • Because a single font file only has one size of characters, such as lv.font_ascii_14 only has 14px ASCII characters, most Latin letters, Greek letters, Cyrillic letters

If you have any questions about the use of the product, please feel free to leave a message.

Thank you. This was very helpful.