Welcome to Xamarin Guy Show Blog

Keep updated for latest and Greatest Posts from Xamarin guy

Custom Embedded Fonts in Xamarin Forms

Embedding  free icons :
Step 1 :  Download the .ttf file from here :   https://materialdesignicons.com/

Step 2 : Add the .ttf file inside  shared project [In my case materialdesignicons-webfont.ttf is my .ttf  file]

Step 3 : Inside your Shared Project you will have assemblyinfo.cs file.
Put this assembly info  :
[assembly: ExportFont(“materialdesignicons-webfont.ttf”, Alias = “PermanentMarker”)]
You can Rename Alias Name as  “materialdesignicons” too.

Step 4 : Inside your MainPage.Xaml

<Image BackgroundColor=”Red” VerticalOptions=”CenterAndExpand” HorizontalOptions=”CenterAndExpand”>
<Image.Source>
<FontImageSource Glyph=”&#xf029;” FontFamily=”materialdesignicons-webfont” Size=”44″/>
</Image.Source> </Image>

 

 

 

 

Embedding Text Font inside Xamarin forms :

Step 1  : Download ttf file from here  https://fonts.google.com/
Step 2 : Add  .ttf file inside shared Project

Step 3 : Inside your Shared Project you will have assemblyinfo.cs file.
Put this assembly info  :
[assembly: ExportFont(“Pacifico-Regular.ttf”, Alias = “Pacifico”)]/

Step 4 : Inside your MainPage.Xaml

<Label Text=”Welcome to Xamarin.Forms!” FontFamily=”Pacifico” HorizontalOptions=”Center”
VerticalOptions=”CenterAndExpand” >
</Label>

Leave a Reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.