Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Custom fonts don't load in iOS

$
0
0

Custom fonts don't load in Xamarin iOS. As described in the Xamarin documentation from 2013 (https://blog.xamarin.com/custom-fonts-in-ios/), I have done the following (project is attached):

1) Import the font into Resources
2) Set Build Action to "BundleResource" (mistake in the Xamarin documentation)
3) Copy to output directory: "Always Copy"

In FinishedLaunching() in the App Delegate, I iterate through all installed fonts:

foreach (var family in UIFont.FamilyNames)
{
    System.Diagnostics.Debug.WriteLine($"{family}");

    foreach (var names in UIFont.FontNamesForFamilyName(family))
    {
        System.Diagnostics.Debug.WriteLine($"{names}");
    }
}
var fontName = UIFont.FromName("Karbon", 20.0f); // fontName is null

No custom fonts show up, what is the problem here?


Visual Studio Community 2017 for Mac (Preview)
Version 7.1 Preview (7.1 build 1178)
Runtime: Mono 5.2.0.179 (2017-04/4498dc4) (64-bit)

Xamarin.iOS
Version: 10.12.0.5 (Visual Studio Community)


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>