Text Alignment

I know this has been talked about in the past in relation to anchors, but can we please have text alignment options (Left, Center, Right).

It is getting rather frustrating having to program my object offsets manually (especially when I choose to change the font size) if I want my text to align to center.

thanks

MobileNoob

The problem here is that the Text object is just that, a little set of letters, and its size is determined by the font and the length of the string, and is always centered. To have a text alignment you need something to align at, for example in office softwares you align the text to the page margins, but there is no such thing as a “page” in GD, maybe the game window, and that’s why the anchor behavior can be used.

But if you want to align the text object on another object, for example to align a text (TextObject here) to the right of an object (ObjectFrame here), you just have to set the X position of the text this way:

Do = ObjectFrame.X() + ObjectFrame.Width() - TextObject.Width() to the X position of TextObject
1 Like

thank you! I will use this. Nevertheless I doesn’t unerstand too, why isn’t an align setup.

You can use events to align text now and have other styles like outline, shadow, gradient.

I don’t remember what version this was added in off the top of my head, but it’s in been in for a couple months at least. In the event editor, search for “align” or scroll down to the text object section. I think it’s under styles or effects. :slight_smile:

the action what you mention isn’t working in a single line of text (wich couners usually are). that is align something else.

Right, the action I mentioned aligns a whole text object, whether it contains a single line or multiple lines - the alignment is applied to all of them. It isn’t anything else other than a text alignment event. If you want to align separate lines, you can use instances of the same text object with an ID variable + modify text action + align.

You’re not going to see it work inside the editor, only on preview.

Maybe you are trying to align it with another object or the window’s edges?
That is something else indeed.

Use this:

You can only see it in preview mode.

Please do not bump multiple year old threads that already have answers.

Also, your post is incorrect. As mentioned above the align text action is only for text objects with multiple lines. It aligns text within the same text object.

It will not align text objects with only one line, nor does it move text objects on the screen, so it cannot align multiple text objecta to one another.

This is a second warning. Next time a multiple year old thread is bumped will lead to a period of time where you cannot post at all.

Thank you.