Embedding custom font in app

VinayahamoorthyVVinayahamoorthyV USMember
edited September 2015 in Xamarin.iOS

Hi,

I followed the below post and implemented the custom font.
forums.xamarin.com/discussion/12553/how-to-use-custom-font-in-xamarin-mac
And it is working fine.

I have pushed the code to repository and I am getting error after downloading the code from repo and run the app.

System.ArgumentNullException: Argument cannot be null Parameter name: value.

And i added the error handling code to

NSUrl fontURL = NSBundle.MainBundle.GetUrlForResource("SanFranciscoText-Bold", "otf"); NSError err = CTFontManager.RegisterFontsForUrl(fontURL, CTFontManagerScope.Process); Console.WriteLine(err.Description); lblTitle.Font=NSFont.FromFontName ("SanFranciscoText-Bold", 12.0f) Getting exception in this line;

Error Description shows this message

Error Domain=com.apple.CoreText.CTFontManagerErrorDomain Code=103 "The file is not a recognized or supported font file format." UserInfo=0x600000279f80 {NSLocalizedDescription=The file is not a recognized or supported font file format., CTFontManagerErrorFontURLs=(

"file:///Users/company/Downloads/soluntion/project/bin/Debug/proj.app/Contents/Resources/SanFranciscoDisplay-Bold.otf"
), NSLocalizedFailureReason=Font registration was unsuccessful.}

Need help on this

Tagged:
Sign In or Register to comment.