I’ve got some questions about text control in BabylonJS GUI I couldn’t find answers to in the docs or on the forum.
1: TextBlock: Line Height
Is there an equivalent of CSS’s line-height
property for a TextBlock control?
lineSpacing looks like it could be useful, but it doesn’t look like it affects line height, just the spacing between lines.
I also came across fontOffset which has a height
property. But I’m not sure if its safe to mess with this property.
2: TextBlock: Letter Spacing
Is there an equivalent of CSS’s letter-spacing
for a TextBock control?
The letter-spacing
property in CSS allows us to adjust the amount of space between characters in a text. I didn’t come across any properties or accessors to help with this.
3: TextBock: Inline Styles
Is it possible to have basic inline styles in a TextBlock control?
I need to be able to format certain words within a TextBlock as italic. From what I’ve seen, it looks like there’s no way to do in BabylonJS GUI.
4: Units
How can we determine what units are accepted for the various properties in controls?
Is there documentation on what unit values are compatible with a given property?
Color units
- HEX
- rgb
- rgba
- hsl
- hsla
- identifiers/keywords
I believe these are all valid for a color.
Length units
- percentage
- px
- em
- rem
- pt
- cm
- mm
- in
- Q
- pc
- ex
- ch
- lh
- vw
- vh
- vmin
- vmax
I know px and percentage are valid. I’m hoping em, rem, and pt could also be valid. If any of the other CSS units are valid, that’d just be a bonus.
5: Calc()
Can we do calculations similar to the calc()
CSS function?
Obviously, we can do math in javascript/typescript, but is there a way to mix units like can be done in CSS? For example, this would be valid in CSS: calc( 20% + 100px)
.
6: Gradients
Like can be done in CSS, can we use a gradient as a background color or in an image?
Any insight into these questions would be greatly appreciated. Thanks!