oomek/attractplus

Text char_size incorrect until msg set

Closed this issue · 2 comments

Text char_size appears to require non-empty msg to initialize char_size.

local txt = fe.add_text("", 0, 0, fe.layout.width, fe.layout.height);

txt.char_size = 20;
print(txt.char_size + "\n"); // 30 <-- wrong

txt.msg = "Sample";
print(txt.char_size + "\n"); // 20 <-- correct

txt.msg = "";
print(txt.char_size + "\n"); // 20 <-- correct

Attract-Mode Plus v3.0.8, Attract-Mode v2.7.0

Thanks for spotting that.
Here is a proposed fix https://github.com/oomek/attractplus/tree/fix/char_size
I've also identified another problem with char_size value when you override the layout size and this fix tries to address that aswell.

fe.layout.width = 320;
fe.layout.height = 240;
oomek commented

Fixed in f264e43