CyberTheWorm wrote: ↑
March 12th, 2019, 7:01 pm
Yes I saw the Casey post, that is what made me think I could try with the lyrics.
Will have to try and figure a way to get the length.
I do that in that example skin. It's easy...
I think the simplest way is what I have done there, which is to just have an invisible copy of the text in a meter that you can then measure for height. The text will be "contained" in a single invisible pixel that is outside the skin, and thus in no way "drawn", but will actually still measure the height it would have if it was fully displayed.
Once you know the height of the entire text if it was simply drawn in a meter, you really have all you need to know. Estimating the height of the font can be useful to make each "scroll" be more pleasing, so you don't end in the horizontal middle of a line of text, but not really critical.
The "length" of the string, in lines or characters is first, impossible to reliably get, and second, irrelevant. All that matters is the "height" of the string if it was drawn in a stand-alone meter.
Don't forget that unless you want a really wide container, or want to truncate lines of text, you are likely to have "wrapping", which makes any measurement of lines or characters (which can only be done in Lua) pointless. It's only height that matters.