【发布时间】:2012-01-25 18:19:51
【问题描述】:
如何在 monotouch 中指定字体粗体/斜体等属性?
在本机库中实际上是可能的 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);
【问题讨论】:
-
其他问题 (stackoverflow.com/questions/4913363/…) 有帮助吗?
-
实际上对我没有帮助。我需要自定义字体的粗体文本
-
您是否阅读了您之前列出的链接上的“使用 iOS 注册自定义字体”部分,并验证了
Info.plist中的UIAppFonts是否正确设置了所有内容?
标签: c# fonts xamarin.ios core-text