apmobiletoolkit - AP.MobileToolkit.FontGenerator 3.0.14-beta

The Font Generator is a build utility to automatically generate font packages for use with the AP.MobileToolkit.Fonts for Xamarin.Forms, Uno Platform, WinUI and Maui.

PM> Install-Package AP.MobileToolkit.FontGenerator -Version 3.0.14-beta -Source https://www.myget.org/F/apmobiletoolkit/api/v3/index.json

Copy to clipboard

> nuget.exe install AP.MobileToolkit.FontGenerator -Version 3.0.14-beta -Source https://www.myget.org/F/apmobiletoolkit/api/v3/index.json

Copy to clipboard

> dotnet add package AP.MobileToolkit.FontGenerator --version 3.0.14-beta --source https://www.myget.org/F/apmobiletoolkit/api/v3/index.json

Copy to clipboard
<PackageReference Include="AP.MobileToolkit.FontGenerator" Version="3.0.14-beta" />
Copy to clipboard
source https://www.myget.org/F/apmobiletoolkit/api/v3/index.json

nuget AP.MobileToolkit.FontGenerator  ~> 3.0.14-beta
Copy to clipboard

> choco install AP.MobileToolkit.FontGenerator --version 3.0.14-beta --source https://www.myget.org/F/apmobiletoolkit/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "apmobiletoolkit" -SourceLocation "https://www.myget.org/F/apmobiletoolkit/api/v2"
Install-Module -Name "AP.MobileToolkit.FontGenerator" -RequiredVersion "3.0.14-beta" -Repository "apmobiletoolkit" -AllowPreRelease
Copy to clipboard

AP.MobileToolkit.Fonts

AP.MobileTookit.Fonts is designed to make it easier to consume fonts. We currently provide Font Awesome Free as an available installable font. Each font ships with a Mapping class for those who prefer strongly typed XAML.

In addition to a mapping class the fonts all ship with the css shipped with Font Awesome allowing us to easily reuse the same syntax that you may be used to with a web font.

Download

You can add the MyGet CI feed to nuget by adding it as a source in Visual Studio:

https://www.myget.org/F/apmobiletoolkit/api/v3/index.json

Or you can add a NuGet.config to your solution like the following:

<configuration>
  <packageSources>
    <clear />
    <add key="AP.MobileToolkit" value="https://www.myget.org/F/apmobiletoolkit/api/v3/index.json" />
    <add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>
Package NuGet.org MyGet.org
AP.MobileToolkit.Forms.Fonts CoreFontsShield CoreFontsMyGetShield
AP.MobileToolkit.Forms.Fonts.FontAwesomeFree.Brands FABrandsShield FABrandsMyGetShield
AP.MobileToolkit.Forms.Fonts.FontAwesomeFree.Regular FARegularShield FARegularMyGetShield
AP.MobileToolkit.Forms.Fonts.FontAwesomeFree.Solid FASolidShield FASolidMyGetShield

How this works

This utilizes the Embedded Fonts feature in Xamarin.Forms 4.5 and has it's own FontRegistry that it uses to handle font registrations. In order to use it, in your application simply register font's either shipped as part of the toolkit or that you have created on your own.

public partial class App : Application
{
    public App()
    {
        FontRegistry.RegisterFonts(
            FontAwesomeBrands.Font,
            FontAwesomeRegular.Font,
            FontAwesomeSolid.Font);

        InitializeComponent();

        MainPage = new MainPage();
    }
}

Because we cross-compile AP.MobileToolkit.Fonts there is no need to do any platform init to keep any of the native plumbing from being stripped out by the linker.

Using it in your XAML couldn't be easier:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:ap="http://avantipoint.com/mobiletoolkit"
             x:Class="SampleFonts.MainPage">
  <StackLayout>
    <Label Text="{ap:Icon 'far fa-user'}" />
    <Button Text="{ap:Icon 'far fa-user'}" />
    <Image Source="{FontImage Glyph={ap:Icon 'far fa-check-circle'}, Color=Blue, Size=60}" />
    <Label Text="{ap:Icon {x:Static ap:FontAwesomeRegular.User}}" />
  </StackLayout>
</ContentPage>

NOTE The Icon extension will work on any Element that has both a Text and FontFamily property. Both are set automatically. This does not work with the ToolbarItem as it does not have a FontFamily property. If using a ToolbarItem be sure to use the FontImageSource.

  • .NETStandard 2.0
    • Uno.SourceGenerationTasks (>= 2.0.13)

Owners

Dan Siegel

Authors

dansiegel

Project URL

https://github.com/AvantiPoint/AP.MobileToolkit.Fonts

License

Unknown

Tags

avantipoint fonts xamarin.forms

Info

0 total downloads
0 downloads for version 3.0.14-beta
Download (278.67 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
3.0.14-beta 278.67 KB Sun, 18 Oct 2020 05:02:41 GMT 0
3.0.13-beta 278.69 KB Wed, 22 Jul 2020 16:09:57 GMT 0
3.0.11-beta 278.68 KB Tue, 26 May 2020 17:34:43 GMT 0
3.0.10-beta-g825a51becf 278.71 KB Tue, 26 May 2020 17:03:27 GMT 0
3.0.9-beta 278.67 KB Tue, 26 May 2020 16:46:46 GMT 0