Page 1 of 1

Fontawesome, Font not found until it's selected

Posted: 10 Jun 2020, 18:42
by yokaichan
Hello,

I start a new project in which I use Fontawesome to display some icons.

I add the followinf resource into my MainWindow.xaml (because in the App.xaml the StaticResource is not found):
<ResourceDictionary>
<FontFamily x:Key="FontAwesome">../Fonts/fa-solid-900.ttf#Font Awesome 5 Free</FontFamily>
</ResourceDictionary>
When I launch the scene , the font is not found, and the scene don't display the right icon.
But if I click on the "fa-solid-900.asset" to select it into the Unity UI, then launch the scene, it shows me the right icon. (but the error "not found" still here)

Re: Fontawesome, Font not found until it's selected

Posted: 10 Jun 2020, 19:05
by sfernandez
One question, if you select MainWindow asset in the editor, does it show the font as a dependency in the inspector?

Re: Fontawesome, Font not found until it's selected

Posted: 10 Jun 2020, 19:12
by yokaichan
No, all dependencies are empty

Re: Fontawesome, Font not found until it's selected

Posted: 10 Jun 2020, 19:31
by sfernandez
Ok, it seems there is a problem with the dependencies when the font path includes the ttf file.
Could you please try with the following:
<FontFamily x:Key="FontAwesome">../Fonts/#Font Awesome 5 Free</FontFamily>

Re: Fontawesome, Font not found until it's selected

Posted: 10 Jun 2020, 19:34
by yokaichan
Thank you very much... it works perfectly.