And I have as result
For value = “18:15” > textSize.x = 9 and textSize.y = 80
For value = “ABCDEFGHIJKLMNOPQRSTUVWXYZ” > textSize.x = 15 and textSize.y = 400
The police is Montserrat_Bold_14
The text need 1 line for the first test and 3 lines for the second test (width is limited to 60)
The results you’re getting (x=9, y=80) look suspicious — for Montserrat Bold 14, "18:15" on a single line should give something closer to x≈40px, y≈16px. The small x and large y suggest the font pointer might not be valid.
A few things to check:
1. Are you on LVGL v8 or v9? In v9 the function was renamed from lv_txt_get_size → lv_text_get_size. Make sure you’re calling the right one for your version.
2. How is fonts declared? The third parameter must be a const lv_font_t *. Can you share how fonts is defined? A common mistake is passing an array or an uninitialized pointer. The correct call looks like this:
Thx a lot.
The problem was here, there is a “magic part” that switch fonts, and the code don’t generate error or crash but make magic number as result.