Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text alignment like pivot in text node #71

Closed
MamontRussel opened this issue Sep 12, 2021 · 4 comments
Closed

Text alignment like pivot in text node #71

MamontRussel opened this issue Sep 12, 2021 · 4 comments
Labels
enhancement New feature or request more info Further information is requested

Comments

@MamontRussel
Copy link

It will be good to have option to align text similar to regular text nodes (via pivot setting).

Top - regular text node with pivot set to Center. Bottom - richtext.
image

@britzl
Copy link
Owner

britzl commented Sep 13, 2021

@MamontRussel I don't quite understand this request. There is an option to align text horizontally using richtext.ALIGN_LEFT, richtext.ALIGN_CENTER, richtext.ALIGN_RIGHT and richtext.ALIGN_JUSTIFY.

@britzl britzl added enhancement New feature or request more info Further information is requested labels Sep 13, 2021
@MamontRussel
Copy link
Author

Yes, I know. But it looks like it does not work correctly in my case. Here is the settings for the text on picture above:

local setup = { width = t.t_size_x, parent = gui.get_node("Tutorial Text"), align = hash("richtext.ALIGN_CENTER"), valign = hash("richtext.VALIGN_MIDDLE"), position = vmath.vector3(-metrics.width/2 + 50, -300, 0) }

Moreover other align options, does not affect it as well.

@britzl
Copy link
Owner

britzl commented Sep 13, 2021

align = hash("richtext.ALIGN_CENTER"), valign = hash("richtext.VALIGN_MIDDLE")

You should not hash the values. They are defined as constants on the richtext module. Use them like this:

local setup = { width = t.t_size_x, parent = gui.get_node("Tutorial Text"), align = richtext.ALIGN_CENTER, valign = richtext.VALIGN_MIDDLE, position = vmath.vector3(-metrics.width/2 + 50, -300, 0) }

@MamontRussel
Copy link
Author

Yes, that's it. My mistake. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants