Forum Xamarin.Forms

Problem with CustomFont in Xamarin.Forms(doesn't work on iOS)

AdrianGhiAdrianGhi USMember ✭✭

Hi, I've tried to use three different fonts on Xamarin.Forms and on Android works fine, but on iOS it doesn't work...

I followed this example:
1. I added my files in Resources - > Font
2. I edited Info.plist file and now i have:

3. I'm trying to use like this:
<OnPlatform x:TypeArguments="x:String">
<On Platform="iOS" Value="Black" />
<On Platform="Android" Value="Black.ttf#Black" />

In you have what I want to use.

Where is the problem?


  • LinnKristinLinnKristin NOUniversity ✭✭

    Have you set your Build Acton to Content and your Copy to output directory to Always copy ? and files are in The Resource folder ?

  • AdrianGhiAdrianGhi USMember ✭✭

    Yes, I did everything, and still doesn't work

  • LinnKristinLinnKristin NOUniversity ✭✭

    Is the font in the *.app file ?
    You can also see if the font is present by using this code in AppDelegate - FinishedLaunching (so you then know is the trouble is your markup or the fact that the font is not there)

    var fontList = new StringBuilder();
    var familyNames = UIFont.FamilyNames;
    foreach (var familyName in familyNames ){
    fontList.Append(String.Format("Family: {0}\n", familyName));
    Console.WriteLine("Family: {0}\n", familyName);
    var fontNames = UIFont.FontNamesForFamilyName(familyName);
    foreach (var fontName in fontNames ){
    Console.WriteLine("\tFont: {0}\n", fontName);
    fontList.Append(String.Format("\tFont: {0}\n", fontName));

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    @AdrianGhi - did you solve this? I've got some fonts in the same family not working. The regular fonts work, but not the italic ones.

    @LinnKristin's suggestion to dump out the known fonts was a good idea. I can see that the fonts in question have been loaded, but they're not displaying.

Sign In or Register to comment.