Custom Fonts in Xamarin Forms v4.5.0.530

In my previous post Custom Fonts in Xamarin Forms the section title Preview Feature is now working.

We’re use the Lobster-Regular.ttf file mentioned in the aforementioned post.

  • Add a Resources/Fonts folder to your shared project
  • Add your .otf or .ttf file to this Fonts folder
  • Set the Build Action to Embedded resource
  • In you AssemblyInfo.cs file add
    [assembly: ExportFont("Lobster-Regular.ttf")]
    
  • Now in your XAML you simply use
    <Label Text="Hello Xamarin.Forms"
       FontFamily="Lobster-Regular" />
    

That’s all there is to it.

You may still want to use the previous method for custom fonts if applying either different fonts to different devices, otherwise, this is such a simple and natural way to handle this task.