Andr谩s T贸th‘s professional blog
banditoth.net

Hey there 馃憢, I’m banditoth a .NET MAUI developer from Hungary.
I write about software development with .NET technologies.

You can find me on:
LinkedIn | Github | StackOverflow | X / Twitter | Threads

[Xamarin.Forms] Custom font handling made easy by MS

This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.

No more sorrow with custom font defining in Xamarin.Forms. Later we had to define a ResourceDictionary for storing platform specific filenames for our ttf files, import for each platform specific project the ttf file, and set a specific build action for them.

Now we only need to import the TTF file to our Xamarin.Forms project, and set the build action to BundleResource, and add a new line to assembly.cs:

[assembly: ExportFont("Nunito-Light.ttf", Alias = "Nunito")]

See reference at: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/fonts

Appreciate it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.