Custom fonts defined in a theme failing to load after upgrading to 3.1.0
Posted: 02 Sep 2021, 02:07
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'