Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Font Awesome 5 Pro

Elvin (Tharindu) Thudugala edited this page Aug 4, 2019 · 4 revisions

Plugin.Glypher.FontAwesome5Pro

  • Download Fonts from https://fontawesome.com/
  • Install this package into your shared project. There is no need to install it in your platform specific projects.

.NET Standard Projest

  • Reference Plugin.Glypher.FontAwesome5Pro NuGet
public partial class App : Application
{
    public App()
    {
        InitializeComponent();
        
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListBrand));
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListDuotone));
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListLight));
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListRegular));
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListSolid));

        MainPage = new NavigationPage(new MainPage());
    }
}

Android Project

  • Add fonts to Assets folder.
  • Font names must be
    • Font Awesome 5 Brands-Regular-400.otf
    • Font Awesome 5 Duotone-Solid-900.otf
    • Font Awesome 5 Pro-Light-300.otf
    • Font Awesome 5 Pro-Regular-400.otf
    • Font Awesome 5 Pro-Solid-900.otf
  • You can change font names
public partial class App : Application
{
    public App()
    {
        InitializeComponent();

        var glyphFont = Plugin.Glypher.FontAwesome5Pro.GlyphFont.Current;
        switch (Device.RuntimePlatform)
        {
            case Device.Android:
                glyphFont.Brand = "font name.otf#Font Awesome 5 Brands Regular";
                glyphFont.Duotone = "fontAwesomeBrands.ttf#Font Awesome 5 Duotone-Solid";
                glyphFont.Light = "font name.otf#Font Awesome 5 Pro Light";
                glyphFont.Regular = "font name.otf#Font Awesome 5 Pro Regular";
                glyphFont.Solid = "font name.otf#Font Awesome 5 Pro Solid";
                break;
        };
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListBrand));
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListDuotone));
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListLight));
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListRegular));
        GlyphRegister.Current.Init(typeof(Plugin.Glypher.FontAwesome5Pro.GlyphListSolid));

        MainPage = new NavigationPage(new MainPage());
    }
}

iOS Project

  • Add fonts to Resources folder.
  • Font names must be
    • Font Awesome 5 Brands-Regular-400.otf
    • Font Awesome 5 Duotone-Solid-900.otf
    • Font Awesome 5 Pro-Light-300.otf
    • Font Awesome 5 Pro-Regular-400.otf
    • Font Awesome 5 Pro-Solid-900.otf
  • Modify Info.plist by add below code.
<key>UIAppFonts</key>
<array>
  <string>Font Awesome 5 Brands-Regular-400.otf</string>
  <string>Font Awesome 5 Duotone-Solid-900.otf</string>
  <string>Font Awesome 5 Pro-Light-300.otf</string>
  <string>Font Awesome 5 Pro-Regular-400.otf</string>
  <string>Font Awesome 5 Pro-Solid-900.otf</string>
</array>
  • You can change font names
<key>UIAppFonts</key>
<array>
  <string>font name.otf</string>
  <string>font name.otf</string>
  <string>font name.otf</string>
  <string>font name.otf</string>
  <string>font name.otf</string>
</array>

font map