I have a Xamarin Forms v4.2 solution where I want to use some Font Awesome 5 icons. I have added the Font Awesome TTF file in the correct location I believe with the file properties set correctly based on the platforms. But when I try to use an FA Icon iOS and Android displays correctly and UWP displays a square in place of icon. I have included code snippets for App.xaml, Page.xaml and the constants helper file along with picture of the UWP file location and a picture of what each platform displays. I believe this has something to do with UWP not finding the font file since the other two platforms work perfectly. But I have been enable to remedy this issue.
--- App.xaml ----
<OnPlatform x:Key="FontAwesome5FreeRegular" x:TypeArguments="x:String">
<On Platform="iOS" Value="FontAwesome5Free-Regular" />
<On Platform="Android" Value="fa-regular-free-400.ttf#Regular" />
<On Platform="UWP" Value="Assets/Fonts/fa-regular-free-400.ttf#Font Awesome 5 Free Regular" />
</OnPlatform>
--- Helper class for constant codes ---
public static class IconFontAwesome5FreeRegular
{
public const string Heart = "\uf004";
public const string Star = "\uf005";
}
--- Page.xaml ----
<StackLayout HeightRequest="100" Orientation="Vertical">
<Label
FontFamily="{StaticResource FontAwesome5FreeRegular}"
FontSize="44"
HorizontalOptions="CenterAndExpand"
Text="{x:Static fontawesome:IconFontAwesome5FreeRegular.Heart}"
TextColor="Red"/>
</StackLayout>
Image 1 - iOS Image 2 - UWP Image 3 - Android Image 4 - UWP project file location