GUI Editor :: InputText is now missing font selection?

Either I’m very tired or the selector for the font has just recently disappeared from the toolbox in the GUI Editor for the control InputText? Could you kindly double check that? Thanks,

image
Seems to be here, is that what you mean? :thinking:
Anyway, please don’t forget to rest! :smiling_face_with_three_hearts:

Thanks, I believe I did rest. Just checked this morning on chrome for both mac and windows, safari on mac and Edge on Win and I get this for all??!

Or is it so that it does not exist for this control and I selected it from the root style?
Thanks,

Oh no I’m sorry, I confused InputText for TextBlock (guess I need to wake up too :sweat_smile: ), yeah, I don’t see a font selection for InputText too, but I don’t think there ever was any? @PatrickRyan can confirm it.

Just found another potential issue, trying to fix this by changing my root default font.
The point is I need a value expressed in percentage mode. Although this default (from the root value) is only used for these 4 inputText controls that where not even in the active tab (understand visible=false) my FPS instantly dropped from 60 to 15fps and even down to 4fps on resize. Restoring a default value for the root font in pixels, the scene runs smoothly again.

@carolhmj all containers and all text controls should have all of the font styling parameters on them. Containers get them because they should set the default for any children and the individual text controls should be able to override those defaults with parameters on the control.

1 Like

@PatrickRyan back to thinking about this, I think we need to add the concept of a “default” font. Currently, if we don’t set the font on a control, we render it as “Arial” (independently of what the parent container’s font is), but if we implement this overriding behavior, we’ll need to differentiate between “default font Arial”, and “intentional Arial”, right?

1 Like

Setting a default font certainly would be a ‘nice to have’ (in my opinion).
However, I totally agree with ‘guru master’ :wink: @PatrickRyan when he says

I’m checking that now, it seems that they’re missing only in InputText and InputPassword so I’ll add them there :smiley:

@carolhmj, I agree with you that the concept of “default font family” is needed. Absent any other source of styling - local style set on the control or inherited style from a parent with assigned styling - the control should use a default style. It likely should look something like this:

  • For any control with type styling options, first adopt styling set locally on the control.
  • If there is no local styling set, look at each parent container in the hierarchy up to root and see if they have any local styling set and adopt the styling of the first parent in the hierarchy found with local styling.
  • If the root is reached and no local styling was found on any parent container, adopt default styling.

There may be a way to shorten this query with a couple flags on controls, one for default styling and one for inherited style. If a control or container does not have local styling, we set default styling to true and inherited style to false. If the control is a child of a container, it adopts the style of the parent setting the adopted style flag to true and the default style flag to whatever the parent uses. Setting local style will set the adopted style flag to false and the default style flag to false. This means you only need to look one level up the heirarchy to know if the style is default and if it is inherited.

This may help the complexity of moving a control from one hierarchy to another. With the flags setting if the style was default and if it was inherited, you should be able to use that information to set the inheritance of the target container that the control is moved into. If default and inherited are false, you retain what is local styling. If inherited is true, you know to inherit the style from the target container the control is moved into. The default flag will be helpful if the default style is changed in the scene so we aren’t baking any styling into the tool itself.

What do you think about this scenario?

Hmmm I think we can express the idea of default even more simply by just adding a new possible value for font family, “inherit”. If a control has control.fontFamily = "inherit" set, then we adopt the inheritance rules. I initially had thought about assuming that if fontFamily was not set then adopt inheritance, but this would be a different behavior from the current one so there is back compat to take into account.

As an additional bit of UI, if the control has fontFamily set to inherit and we’re on the GUI Editor, we could display what family it’s currently inheriting from on the font parameters section.

1 Like

Nice. I believe that should work and this concept of inheritance is something we are already used to. Shouldn’t be too hard to explain and for users to assimilate. I like this idea a lot. :smiling_face_with_three_hearts:

About the text controls on InputText, they were indeed missing (on InputPassword too), added them back here: [GE] Fix loading of GUIs with custom fonts and add font controls to InputText and InputPassword by carolhmj · Pull Request #13129 · BabylonJS/Babylon.js (github.com)

3 Likes

And created an issue to add the “inherit” option: [GUI] Add “inherit” option to font style in controls. · Issue #13130 · BabylonJS/Babylon.js (github.com)

4 Likes

You are amazing :smiling_face_with_three_hearts: Thanks a million.

1 Like