User avatar
ARPP3
Topic Author
Posts: 26
Joined: 20 Jun 2023, 21:22

Unity Default Font and Font Weight

11 Jul 2023, 23:17

Hi all 🙂,

I am not sure if this is user error or not, but when I try to configure a default, what I see is not my expected results.

If you set the Noesis.settings.asset default font entry to, for example, Lato-heavy, I would assume that I can omit the FontFamily="Fonts/#Lato" from a TextBlock element, but still have control over the FontWeight. This isn't what happens for me. If I don't specify the FontFamily and only the FontWeight, it will use the font family from the asset I selected in Unity to be the default, and ignore what I've set as the FontWeight and use whatever is present in the default font asset I set.

Just as an example demo, this will not render in Unity as a Light font variant, but it will use the Heavy variant.
<TextBlock Text="Testing" FontWeight="Light"/> <!-- This will be Lato, but it will be heavy, since the default font is Lato-heavy.ttf -->
<TextBlock Text="Testing" FontFamily="Fonts/#Lato" FontWeight="Light"/> <!-- This will be Light -->
I understand that as the fonts are imported, the custom importer will split it into a Family, Weight, Style and Stretch. But why should my explicitly set FontWeight attribute not override what I've set in the Noesis.settings file? Is it not the more immediate attribute that trumps the default values in the settings file?

Thanks!
David
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: Unity Default Font and Font Weight

12 Jul 2023, 12:18

Hi,

This is a bit confusing and we need to improve it.

What is happening is that only the font asset specified in the settings is being used. So just that ttf, with its own weight, style and stretch, is available later as the default FontFamily.

To solve this we are thinking on exposing a list of font assets in the settings and allow the user to drag all the font variations they are going to use. Does that make sense to you?

I created ticket #2650 to fix it.
 
User avatar
ARPP3
Topic Author
Posts: 26
Joined: 20 Jun 2023, 21:22

Re: Unity Default Font and Font Weight

12 Jul 2023, 15:00

Yes, this makes sense to me! However, manually building this list up could be more confusing and error prone, for instance it would have to be clear you can't begin mixing and matching font families per font weight? Like the heavy variant is ComicSans and the thin variant is Lato.

Alternatively just keeping the UI as is and internally grabbing the rest of the font weights in the same way that the xaml already does this, would be ideal and possibly more intuitive, this is for example, how I expected the behaviour to be.

Whatever works though is fine by me!

Thanks for making the ticket!
David

Who is online

Users browsing this forum: No registered users and 6 guests