Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Custom font not working

arsenalfandanarsenalfandan Member
edited October 2018 in Xamarin.Forms

Hi,

I am trying to get a custom font to display in the Android project of my Xamarin forms solution. But cannot get it to work.

I have copied the TTF file into the assets folder on my Android project. Its build action is AndroidAsset and I have tried all the CopyToOutputDirectory options.

I am trying to display my font in a label in Xaml with this code (plus a bunch of other variants on this code):

<Label Text="Hello Forms with XAML">
    <Label.FontFamily>
        <OnPlatform x:TypeArguments="x:String">
                <On Platform="Android" Value="BRADHITC.TTF#Bradley Hand ICT"/>
        </OnPlatform>
    </Label.FontFamily>
</Label>

Does anyone know what I am missing here?

Thanks in advance,
Dan

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    The file's name in Xamarin Android project is case sensitive. Try to modify your font file's name to BRADHITC.ttf. Change the file type to lowercase letters.

Sign In or Register to comment.