How does LVGL determine line breaks?

So I am trying to understand LVGL a little bit better, specifically right now how labels work and I was wondering in what place LVGL exactly determines which line of a string should go onto which line. This would be extremely useful to know for a project I am working on

br

There is a helper function called _lv_txt_get_next_line which is invoked from lv_draw_label here.

Quite a bit of documentation is written above these functions in their implementation file, so maybe that helps.

Thats very helpful, thank you for the quick reply!

I would like to call _lv_txt_get_next_line in order to know the starting position of the next line, however I am unsure where I can get the letter_space, max_width and flag from. Does a label expose these somewhere?

These options are generated by the label based on the provided style and options in this file.

As far as I know flag is passing along the alignment flags, max_width is how wide a single line can be, and letter_space is whatever is set in the label’s style.