I am using Xamarin Studio to develop an iOS iPad app. I need to assign the System font name to a variable in the code behind on one of the pages.
How do I get whatever the System font is programmatically?
SF Pro. This neutral, flexible, sans-serif typeface is the system font for iOS, iPad OS, macOS and tvOS. SF Pro features nine weights, variable optical sizes for optimal legibility, four widths, and includes a rounded variant.
To manage installed fonts, go to Settings > General, then tap Fonts.
To install a custom font on Android, obtain the TTF file of the font you wish to use and also download the zFont app. Use the zFont app to install the TTF. It may require some prerequisites and the app will help you do it.
A system font or web-safe font is one that's already assumed to be on the vast majority of users' devices, with no need for a web font to be downloaded.
NOTE: Before somebody thinks he has to change this answer: This is answering a question about Xamarin.iOS and not ObjectiveC. The API really uses uppercase properties and method names.
Create a system UIFont and read its properties:
var font = UIFont.SystemFontOfSize(10);
string familyName = font.FamilyName;
string fontName = font.Name;
See also Apple's reference for UIFont.
Starting with iOS7, you have a richer way of getting the font, using the new UIFont properties.
For details see:
http://tirania.org/monomac/archive/2013/Sep-25.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With