If we went and bought a font for use in our app, is it possible to bundle the font and use it inside the app? We're creating apps that need to generate buttons on the fly and need to use a specific font for it.
Cheers
w://
If we went and bought a font for use in our app, is it possible to bundle the font and use it inside the app? We're creating apps that need to generate buttons on the fly and need to use a specific font for it.
Cheers
w://
Put your fonts into a directory in your project root (same level as Info.plist) and list the files in Info.plist:
<key>UIAppFonts</key>
<array>
<string>Fonts/Quicksand_Bold.otf</string>
<string>Fonts/Quicksand_Book.otf</string>
</array>
Then add the files in MonoDevelop to your project and set the build action to "Content". After that you can use the font:
UILabel title = new UILabel (new RectangleF (80, 190, 160, 60));
title.Font = UIFont.FromName("QuicksandBook-Regular", 20);
title.SetTitle ("Font Demo");
If you have problems determining the right font name you can use this code snipped to retrive a list of all installed fonts:
String fonts = "";
List<String> fontFamilies = new List<String> (UIFont.FamilyNames);
fontFamilies.Sort ();
foreach (String familyName in fontFamilies) {
foreach (String fontName in UIFont.FontNamesForFamilyName (familyName)) {
fonts += fontName + "\n";
}
fonts += "\n";
}
Console.WriteLine (fonts);
There no Monotouch library out there from what I know, but you could try porting this one: