Custom fonts defined in a theme failing to load after upgrading to 3.1.0
We have just upgraded our Unity integration to NoesisGUI 3.1.0. We have a folder structure like this:
GameTheme.xaml looks something like this:
GameTheme.Fonts.xaml looks something like this:
We specify the paths this way so that the fonts show up correctly in our Unity game as well as in Blend where our designers are directly editing the UI layouts.
All of our TextBlocks in the xaml files driving the UI we're using in-game make reference to these custom fonts by specifying the FontFamily property, like this:
For each of our custom fonts, though, we are seeing this error:
The custom fonts are still showing up in Blend, but the "not found" errors in Unity are preventing the custom fonts from showing up in-game. This worked before the upgrade, when we were on NoesisGUI 3.0.12. I am having trouble finding documentation for how to use custom fonts defined in custom themes, and nothing I've tried so far is working. What can I try to resolve this?
Code: Select all
-- Assets
-- Scripts
-- Runtime
-- Client
-- UI
-- Themes
GameTheme.xaml
GameTheme.Fonts.xaml
-- Fonts
CustomFontA.otf
CustomFontB.otf
CustomFontC.otf
Code: Select all
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="GameTheme.Fonts.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Code: Select all
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<FontFamily x:Key="Font.Family.CustomFontA">/Blend;component/Assets/Scripts/Runtime/Client/UI/Themes/Fonts/#Custom Font A</FontFamily>
<FontFamily x:Key="Font.Family.CustomFontB">/Blend;component/Assets/Scripts/Runtime/Client/UI/Themes/Fonts/#Custom Font B</FontFamily>
<FontFamily x:Key="Font.Family.CustomFontC">/Blend;component/Assets/Scripts/Runtime/Client/UI/Themes/Fonts/#Custom Font C</FontFamily>
</ResourceDictionary>
All of our TextBlocks in the xaml files driving the UI we're using in-game make reference to these custom fonts by specifying the FontFamily property, like this:
Code: Select all
FontFamily="{StaticResource Font.Family.CustomFontA}"
Code: Select all
[noesis] Assets/Scripts/Runtime/Client/UI/Themes/GameTheme.Fonts.xaml(8): Font not found '/Blend;component/Assets/Scripts/Runtime/Client/UI/Themes/Fonts/#Custom Font A'
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: Custom fonts defined in a theme failing to load after upgrading to 3.1.0
Hi Rachelle,
In 3.1 font assets use a new NoesisFontImporter and we recently found that doing an upgrade from previous versions of Noesis to 3.1 leaves existing fonts with the default Unity importer. This is causing that font dependencies can't be found.
We just fixed the upgrade script to force a reimport of xamls and fonts so they are overriden with the proper importer . You can manually do a Reimport on your Themes folder to force that now. Please let me know if that works for you.
In 3.1 font assets use a new NoesisFontImporter and we recently found that doing an upgrade from previous versions of Noesis to 3.1 leaves existing fonts with the default Unity importer. This is causing that font dependencies can't be found.
We just fixed the upgrade script to force a reimport of xamls and fonts so they are overriden with the proper importer . You can manually do a Reimport on your Themes folder to force that now. Please let me know if that works for you.
Re: Custom fonts defined in a theme failing to load after upgrading to 3.1.0
Unfortunately this doesn't resolve the issue. I re-imported the Themes folder, continued to see this error, and then re-imported the entire UI folder (the xaml that makes use of Themes and Fonts lives in various subfolders of UI) for good measure. Still no luck, same error:
Anything else I should try?
Code: Select all
[noesis] Assets/Scripts/Runtime/Client/UI/Themes/GameTheme.Fonts.xaml(6): Font not found '/Blend;component/Assets/Scripts/Runtime/Client/UI/Themes/Fonts/#Custom Font A'
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: Custom fonts defined in a theme failing to load after upgrading to 3.1.0
I was able to reproduce the problem, could you please report this in our bugtracker?
It is not working when the Uri contains the assembly part. In the meantime you can use a relative path:
or an absolute path without the assembly part:
It is not working when the Uri contains the assembly part. In the meantime you can use a relative path:
Code: Select all
<FontFamily x:Key="Font.Family.CustomFontA">Fonts/#Custom Font A</FontFamily>
Code: Select all
<FontFamily x:Key="Font.Family.CustomFontA">/Assets/Scripts/Runtime/Client/UI/Themes/Fonts/#Custom Font A</FontFamily>
Re: Custom fonts defined in a theme failing to load after upgrading to 3.1.0
Bug submitted here: https://www.noesisengine.com/bugs/view.php?id=2103
The workaround (I chose the absolute path) is resolving the issue in-game, but I look forward to the bug fix to get things working again in Blend for our designers. Thank you!
The workaround (I chose the absolute path) is resolving the issue in-game, but I look forward to the bug fix to get things working again in Blend for our designers. Thank you!
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: Custom fonts defined in a theme failing to load after upgrading to 3.1.0
Thanks for the report.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest