Trying to make one word in a sentence bold, anyway to do that currently?
I believe the answer is still ‘no’. Not within a tb.
Though, I do very much hope the answer that will be coming from the admins or masters will be ‘Yes’ … Is it?
I’ve always found it’s a huge downside of the 2D GUI not being able to make even very simple (inline) styling within a tb… so I’m gonna bookmark this and wait for the answer
There is a PR open to add a
StructuredTextBlock, which would allow you to format parts of your overall string: StructuredTextBlock (GUI 2D) by cronvel · Pull Request #11383 · BabylonJS/Babylon.js · GitHub. It’s not finished yet though.
In the meantime, you can use a StackPanel, which is a container that can stack controls together either horizontally or vertically: Simple GUI in fullscreen mode | Babylon.js Playground (babylonjs.com). Make sure that you set resizeToFit to true on your text blocks, which keeps the size of the text block equal to the dimensions of the text, or the spacing will not work correctly.
Note that this approach won’t support word wrap. If you want to do that, you could create a bunch of single-word text blocks, iterate over them, and append them to a horizontal stack panel until they reached a max width. Once they hit that max width, you could create another horizontal stack panel and start adding them there.
At the end, you can add all your panels to a parent vertical stack panel to get them in a vertical line.
LoL. I guess not. I believe it’s best to wait for the new PR to go through