[Xamarin.Forms] Custom font handling made easy by MS
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!
Tags In
Leave a Reply Cancel reply
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Hi, I am András,
I am a seasoned software engineer from Budapest, Hungary with a strong focus on mobile app development using .NET MAUI and Xamarin.Forms. My expertise also extends to website building for my happy customers and other complex system designing. I am passionate about developing well-organized, maintainable software solutions.