[solved] How to get the width of a text object?

How can we calculate the width of a text object?
My attempt

(StrLength(tab_name.String()) * GlobalVariable(letter_width))

This way is a very weak method, because It is letter’s width dependent. And If a font family doesn’t maintain constant letter width then my code is trash. :frowning_face:
This only works with my font.

TextObject.Width() :slight_smile:
Does it only work with BBCode text? Perhaps.

1 Like

width() method on normal text object returns 0

Tip: What I do, is a trick add variable(your text) + NewLine() then the TextObject has width and height, if you try to get TextObject.width() it works, I don’t know way but works


Thanks a lot mon…

1 Like