Reputation: 305
How do I create a font in Monotouch?
I want to specify the font family, size, and style (e.g., Courier, bold, 25).
Upvotes: 2
Views: 962
Reputation: 26495
If I have a UIButton
named _woot
:
_woot.Font = UIFont.FromName ("Courier-Bold", 25);
If you can figure out a font name, use this code to print them all out:
string fonts = "--------------------------------------\n";
var fontFamilies = new List<String> (UIFont.FamilyNames);
fontFamilies.Sort ();
foreach (var familyName in fontFamilies) {
foreach (var fontName in UIFont.FontNamesForFamilyName (familyName)) {
fonts += familyName;
fonts += "\t";
fonts += fontName;
fonts += "\n";
}
fonts += "--------------------------------------\n";
}
Console.WriteLine (fonts);
Upvotes: 3