|Attention||Topic was automatically imported from the old Question2Answer platform.|
it appears fairly easy to apply some
BbCode to (parts of) a text in a
RichTextLabel via the editor’s Inspector, like right-aligning
But what if I don’t have any straight text to deal with in the Inspector but rather some yet to be inserted input (by the user) in an empty RichTextLabel? How could I mark certain elements of a text (e. g. entered numbers) to only tweak them?
And I’d like to apply a general right-aligning to the whole RichTextLabel, but as there is no such option to select in the Inspector, isn’t there any way to apply this by code within the node’s script?
Could you maybe make a Word doc or something demonstrating what you’re trying to achieve and share a screenshot? It’s a little hard for me to imagine what you’re trying to accomplish.
DDoop | 2020-12-15 16:02
But of course, I’ll try: let’s say I have an empty text-field made of a RichTextLabel (gray). The user then enters a couple of numbers, a comma and some more numbers. What I’d like to achieve is three things:
- the numbers are aligned to the right of the box
- spacing of the thousands’ position is a little farther from the hundreds’ than usual (but not an empty space!)
- the numbers after the comma should be a little smaller and positioned higher in the line
Which could look somewhat like this:
Telling the Label that the current input is a thousands’ position or an after-comma one is a challenge of its own, but I believe I could manage that. I have, however, no idea, how I can BbCode these parts accordingly, so that they „automatically“ do it when these positions are entered. Any thought is much appreciated!
pferft | 2020-12-15 20:51