Can you change the Unity Noesis default FontSize at runtime?
Running under Unity, I've set my Noesis default fontsize to 15px. This works good for our WebAssembly builds, but for tablets we'd like the default fontsize to be bigger.
Maybe a better way to do this would be to just create different styles for tablet/mobile, but I was wondering if there was some way to alter the default fontsize programmatically? Then I could detect the Android or iOS builds and set the default fontsize to 18 in those cases and leave it 15 for our WebAssembly build.
Thanks--if this isn't possible, any other suggestions on how to accomplish this are welcome. Otherwise, I'll just code the default fontsize into every page and alter it in the viewmodel.
Maybe a better way to do this would be to just create different styles for tablet/mobile, but I was wondering if there was some way to alter the default fontsize programmatically? Then I could detect the Android or iOS builds and set the default fontsize to 18 in those cases and leave it 15 for our WebAssembly build.
Thanks--if this isn't possible, any other suggestions on how to accomplish this are welcome. Otherwise, I'll just code the default fontsize into every page and alter it in the viewmodel.
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: Can you change the Unity Noesis default FontSize at runtime?
You can call the following code at your application startup to change default font properties.
If a xaml was loaded before executing that code, then that xaml will keep using the values set in Noesis settings.
Another approach could be to use DynamicResources in your control styles to set FontSize, then add to the root xaml the value you want to use depending on the platform:
Code: Select all
Noesis.GUI.SetFontDefaultProperties(30.0f, FontWeight.Normal, FontStretch.Normal, FontStyle.Normal);
Another approach could be to use DynamicResources in your control styles to set FontSize, then add to the root xaml the value you want to use depending on the platform:
Code: Select all
view.Content.Resources["DefaultFontSize"] = 30.0f;
Re: Can you change the Unity Noesis default FontSize at runtime?
Cool, I will try these suggestions. Thanks!
Who is online
Users browsing this forum: No registered users and 4 guests