Changing Font Style in GUI breaks font size

I am quite happy I found the trigger for this bug because its been something I found in production but at the time had no idea what caused it.

The issue:

Both of these text blocks are the exact same in every-way. Both of these have a font sizeof 78px, same height, width etc…
What caused this was changing the font style to italic then back to regular.

Here is a snippet that shows this in action.

My research:
This is caused by changing the font style. Be it in the GUI or later via code
it not impacted if you have resize-to-fit on or off
This is not the GUI being funny, I have created a .json from scratch and it produces the same outcome.

1 Like

Hello! Thanks for the report, a fix will be in this PR: Fix font style options on gui editor. by carolhmj · Pull Request #13392 · BabylonJS/Babylon.js (


I have to extend on this as I found other similar issues with the Editor.
I only thought it would be best to keep it for after the first day following New Year as I don’t want to start the year complaining about issues :grinning: :wink:

There are still a number of (sometimes very annoying issues) with the Editor; I will likely post tomorrow in my GUI Editor debug post. But since we are talking fonts and inheritance, you should have a closer look at what happens when a control is reparented. Seems like all font styling is overwritten by the new parent if the parent is left with default (Arial, 18px). I’m not sure whether if this happens when a single control is parented to a new container. I have to do some further tests. What happened to me (yesterday and this morning) is that I had an assembly of containers and controls (rectangle main container + grid + rectangle + textBlock) with font styling set only on the textBlock. Next thing that happened when I reparented my assembly to a new rectangle container, all of my text blocks went back to the default styling (unset in the new parent, Arial, 18px).
Though, from what I understood, all children should keep with their styling if set. They inherit from the parent at first but if modified, they should keep with their own styling. Moving the control to a new parent should not be affecting the custom font styling of a control. Correct?

Yep, that definitely should work, I’ll take a look into this now :thinking:

Do you have an example of this unstyling happening? I’m trying to reproduce here but I couldn’t get it to happen :thinking:

I need to set-up one. Also, I have been using a custom font from typekit, may be it only does it with custom fonts. Will check back on this shortly and let you know.

1 Like

Ooooh, the custom font is likely, I’ll wait for your example :open_mouth:

Thank you so much for the amazingly quick turnaround, I can confirm that this has solved the issue!