Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Unable to load a custom Font by following walkthrough..

$
0
0

I'm trying to load a custom font by following your walkthrough , including the blog post it refers to, without success. I keep getting a null argument exception. Is anyone else having this issue? I'm using the PCL approach, not shared project. Repro steps for iOS are:

  1. Copy font to Resources folder in iOS project
  2. Set Build action to "BundleResource"
  3. Set copy to output directory to "Always copy"
  4. In the Source tab of Info.plist, add the "Fonts provided by application" key and add a string value of "Quicksand_Bold.otf" (in my case)
  5. Load the font
    var bodyLabel = new Label
    {
    HorizontalOptions = LayoutOptions.CenterAndExpand,
    VerticalOptions = LayoutOptions.CenterAndExpand,
    Font = Device.OnPlatform (
    Font.OfSize ("Quicksand_Bold", 15),
    Font.SystemFontOfSize (NamedSize.Medium),
    Font.SystemFontOfSize (NamedSize.Large)
    )
    };

Viewing all articles
Browse latest Browse all 58056

Trending Articles