libgdxbitmap-fonts

Libgdx Find out where the lines ends


So I have a label - 200 width with wrap set to true. Before a set text to my label I want to check where first line ends, then when the second line end etc. Is it possible to check this? I'm working on text justify algorithm for label and I need to know where lines end.


Solution

  • GlypLayout may be useful.

    glyplayout.width gives you exact length when you draw on screen so you can find out that how many chars can be drawn until you exceed 200 pixel width.