Label limit ?

Started by Baguettator, 01 Apr 2021, 10:39

« previous - next »

Baguettator

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.

Crimson Wizard

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.

Baguettator

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 ?

Crimson Wizard

#3
Quote from: Baguettator on 01 Apr 2021, 11:29
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

SMF spam blocked by CleanTalk