Page 1 of 1

Make a certain character’s speech text always right align?

Posted: Thu May 13, 2021 12:52 pm
by skinnyfitgenes
Hi folks,

I’d like a certain character’s text and name (Josh) to always appear right-aligned, and his name in blue. I thought I had it, but my code isn’t working.

The colour for his name works, but his name is still aligned to the left. If his speech goes onto a second line, then it aligns to the right, but if it’s only a few words and doesn’t go onto a second line, it stays on the left.

Does anyone have any ideas?

define j = character(“Josh”, color=“000080”, what_text_align=1.0)

Re: Make a certain character’s speech text always right align?

Posted: Fri May 14, 2021 2:52 am
by strayerror
Stab in the dark, but I would guess that the text container (rather than the text within that area) is still left aligned, and so only when the first line stretches that container to be the full width does the alignment of the text within it take effect - manifesting as only affecting the second line onward. Here are two potential solutions (I've not had chance to test either however):

Attempt to align the text container as well as the text inside it:

Code: Select all

define j = character(“Josh”, color=“000080”, what_align=1.0, what_text_align=1.0)
Try to force the text container to always be maximum width:

Code: Select all

define j = character(“Josh”, color=“000080”, what_text_align=1.0, what_xfill=True)
Of the two I'd suggest that (if it works) the first is a better option, as depending on the context xfill can sometimes get a bit over zealous and disrupt surrounding containers.

Good luck!