Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

macOS: Use FontAwesome

$
0
0

Hi,

I have a Xamarin.Forms application with FontAwesome for iOS & Android. Now I
want to use it in macOS also.

I added this to the Info.plist:

    <key>Fonts provided by application</key>
    <array>
        <string>FontAwesome5Regular.otf</string>
        <string>FontAwesome5Solid.otf</string>
    </array>

In my App.xaml I use this:

<OnPlatform x:Key="FontAwesomeBrands" x:TypeArguments="x:String">
    <On Platform="Android" Value="FontAwesome5Brands.otf#Regular" />
    <On Platform="iOS" Value="FontAwesome5Brands-Regular" />
    <On Platform="macOS" Value="FontAwesome5Brands-Regular" />
</OnPlatform>

<OnPlatform x:Key="FontAwesomeSolid" x:TypeArguments="x:String">
    <On Platform="Android" Value="FontAwesome5Solid.otf#Regular" />
    <On Platform="iOS" Value="FontAwesome5Free-Solid" />
    <On Platform="macOS" Value="FontAwesome5Free-Solid" />
</OnPlatform>

<OnPlatform x:Key="FontAwesomeRegular" x:TypeArguments="x:String">
    <On Platform="Android" Value="FontAwesome5Regular.otf#Regular" />
    <On Platform="iOS" Value="FontAwesome5Free-Regular" />
    <On Platform="macOS" Value="FontAwesome5Free-Regular" />
</OnPlatform>

Could it be that the FontFamlily names other on macOS?
I checked that the font is in Resource folder in the macOS project and it is defined as BundleResource.

Thanks and greets,
Johann


Viewing all articles
Browse latest Browse all 91519

Trending Articles