2D Toolkit Forum
2D Toolkit => Support => Topic started by: mamamia on March 23, 2013, 04:08:57 pm
-
Hi,
Is there any way to get the text height of a text mesh using wordwrap? I think numbers of lines for the text mesh would do for me too.
P.D. I have tried with GetMeshDimensionsForString but it seems it is not taking wordwrap into account.
Thanks in advance.
-
You should do
tm.GetMeshDimensions( tm.GetFormattedString( str ) );
The "height" returned is negative as it returns the cursor postion relative to the start position.
Its not ideal, but at least you'll be able to use the information.
I will create a variant that will return the correct mesh size, including clipping due to maxchars in a future version. Its been in the todo for a while now.
-
Thanks for the info.
-
Hi again,
Excuse me unikron but I have 1.91 p1 installed and this functions doesn't seem to exist :/. Don't really like to update to the betas at this moment. Did you spell them wrongly or I must update to get access to this functions?.
Thanks in advance.
-
Was this ever added? The only similar method I'm seeing in 2.3 is the GetEstimatedMeshBounds(). Is there a better/more accurate way to get the height of the mesh after the text has been updated? Thanks.
-
You can get a very close estimate (almost 100%) by using GetEstimatedMeshBounds, it should format / word wrap as well. Are you having any issues with it?
-
No, it's working - just was wondering if there was a different way. Near 100% is fine, though.