Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Baguettator on Thu 01/04/2021 10:39:28

Title: Label limit ?
Post by: Baguettator on Thu 01/04/2021 10:39:28
Hi !

I found other threads about it, but I need to have a confirmation from that year since AGS has been updated. Sorry if I didn't find the answer in an earlier thread, I tried to search, but maybe I didn't see it..?

Well, my question is simple : is there a limit of characters inside a label ? It seems one of my labels is cut just before the end of the text.
Title: Re: Label limit ?
Post by: Crimson Wizard on Thu 01/04/2021 11:14:13
There's no character limit for very a long time.
There was a total wrapped lines limit (50 lines) before 3.5.0.
Labels do not autoresize though, it's essential to give them enough Width and Height to accomodate all text.
Title: Re: Label limit ?
Post by: Baguettator on Thu 01/04/2021 11:29:21
OK, so it is a nice information :)

However, I found that for a script, the GetTextWidth was not "exact" (or I misunderstood something) : I wanted to get a label's width to get this label with only one line. And I had to write :

mylabel.Width = GetTextWidth(mylabel.Text, mylabel.Font) + 1;

This "+1" was needed, without it my text was written in two lines.

Engine problem ?

Maybe it is the same problem for Height ?
Title: Re: Label limit ?
Post by: Crimson Wizard on Thu 01/04/2021 11:39:34
Quote from: Baguettator on Thu 01/04/2021 11:29:21
However, I found that for a script, the GetTextWidth was not "exact" (or I misunderstood something) : I wanted to get a label's width to get this label with only one line. And I had to write :

mylabel.Width = GetTextWidth(mylabel.Text, mylabel.Font) + 1;

This "+1" was needed, without it my text was written in two lines.

This is a historical issue that was kept only for compatibility until now, but probably will be fixed in future version (maybe in ags4 branch, as this may break some existing script modules).
https://www.adventuregamestudio.co.uk/forums/index.php?topic=36567

More information and links related to undocumented AGS wrapping rules here:
https://github.com/adventuregamestudio/ags-manual/issues/103