Reputation: 1795
How can i specify font bold/italic etc. properties in monotouch?
Actually possible in native library http://www.freetimestudios.com/2010/09/20/ipad-and-ios-4-custom-font-loading/
NSDictionary *fontAttributes =
[NSDictionary dictionaryWithObjectsAndKeys:
@"Courier", (NSString *)kCTFontFamilyNameAttribute,
@"Bold", (NSString *)kCTFontStyleNameAttribute,
[NSNumber numberWithFloat:16.f], (NSString *)kCTFontSizeAttribute,
nil];
CTFontDescriptorRef descriptor =
CTFontDescriptorCreateWithAttributes((CFDictionaryRef)attributes);
CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, 0, NULL);
CFRelease(descriptor);
Upvotes: 2
Views: 1521
Reputation: 43553
The MonoTouch / C# code to match your code snippet would look like this:
CTFontDescriptorAttributes fda = new CTFontDescriptorAttributes () {
FamilyName = "Courier",
StyleName = "Bold",
Size = 16.0f
};
CTFontDescriptor fd = new CTFontDescriptor (fda);
CTFont font = new CTFont (fd, 0);
Upvotes: 2