How To Use Google Fonts In Xamarin Forms
I ve first only added the main font montserrat regular and robotocondensed regular.
How to use google fonts in xamarin forms. Goodbye images hello fonts. For my example i will use a google font like indie flower just visit the page and download the file by using the download family. I work on a xamarin forms project where i added 2 google fonts. I downloaded a greek true type font from google i placed it in the assets folder under a folder i named fonts. The font can then be consumed on each platform by referencing its name without the file extension.
My entire mobile development career i have gone all in on using device specific images and icons. Opensans regular fontfamily staticresource normalfont label text welcome to xamarin forms. Stacklayout label text welcome to xamarin forms. Opensans bold fontfamily staticresource boldfont label text welcome to xamarin forms. Using font icons in xamarin forms.
Xamarin already contains some popular font styles but if you want to add custom fonts in xamarin forms then this article will surely help you out. Now rebuild your solution and use your custom font in the xaml or c as you would normally use. In my mainpage i have one label with the standard hello world message from xamarin forms project and i am using my libre baskerville in the fontfamily property of the label control. Label text welcome to xamarin forms fontfamily myawesomecustomfont fontsize 50 horizontaloptions center verticaloptions centerandexpand under the hood the font is loaded and cached whenever you start the app. These are properly scaled and sized images that fit 1x 2x 3x hdpi xhdpi xxhdi and so on which are great because they are super optimized for each platform.
I appreciate your help in this. First of all we need to get a font. The result is the word displays in english and not greek. Then to use the font you just need to reference the key. Then i try to use it in the page where i want to display the greek words using xamarin label command with font family and text parameters.
Add font to xamarin forms app. Custom fonts are one of the back bones of modern app development. Use font alias label text hello xamarin forms fontfamily lobster. Because of that be mindful of how many custom fonts you are adding. You are ready to use a custom font.