iOS开发苹果支持中文字体,和使用字体
1.中文字体
转自:https://zhidao.baidu.com/question/1239016138772367339.html
ios7英文字体:Helvetica 下的各种系统,例如Helvetica Neue等,细究起来很烦,不同的地方用不同的系统,但都是Helvetica家族下的 ios7中文字体:STHeitiSC-Light 黑体-简
2.苹果使用字体
转自:http://blog.csdn.net/onlyou930/article/details/7422097
字体名如下:
Font Family: American Typewriter Font: AmericanTypewriter Font: AmericanTypewriter-Bold Font Family: AppleGothic Font: AppleGothic Font Family: Arial Font: ArialMT Font: Arial-BoldMT Font: Arial-BoldItalicMT Font: Arial-ItalicMT Font Family: Arial Rounded MT Bold Font: ArialRoundedMTBold Font Family: Arial Unicode MS Font: ArialUnicodeMS Font Family: Courier Font: Courier Font: Courier-BoldOblique Font: Courier-Oblique Font: Courier-Bold Font Family: Courier New Font: CourierNewPS-BoldMT Font: CourierNewPS-ItalicMT Font: CourierNewPS-BoldItalicMT Font: CourierNewPSMT Font Family: DB LCD Temp Font: DBLCDTempBlack Font Family: Georgia Font: Georgia-Bold Font: Georgia Font: Georgia-BoldItalic Font: Georgia-Italic Font Family: Helvetica Font: Helvetica-Oblique Font: Helvetica-BoldOblique Font: Helvetica Font: Helvetica-Bold Font Family: Helvetica Neue Font: HelveticaNeue Font: HelveticaNeue-Bold Font Family: Hiragino Kaku Gothic **** W3 Font: HiraKakuProN-W3 Font Family: Hiragino Kaku Gothic **** W6 Font: HiraKakuProN-W6 Font Family: Marker Felt Font: MarkerFelt-Thin Font Family: STHeiti J Font: STHeitiJ-Medium Font: STHeitiJ-Light Font Family: STHeiti K Font: STHeitiK-Medium Font: STHeitiK-Light Font Family: STHeiti SC Font: STHeitiSC-Medium Font: STHeitiSC-Light Font Family: STHeiti TC Font: STHeitiTC-Light Font: STHeitiTC-Medium Font Family: Times New Roman Font: TimesNewRomanPSMT Font: TimesNewRomanPS-BoldMT Font: TimesNewRomanPS-BoldItalicMT Font: TimesNewRomanPS-ItalicMT Font Family: Trebuchet MS Font: TrebuchetMS-Italic Font: TrebuchetMS Font: Trebuchet-BoldItalic Font: TrebuchetMS-Bold Font Family: Verdana Font: Verdana-Bold Font: Verdana-BoldItalic Font: Verdana Font: Verdana-Italic Font Family: Zapfino Font: Zapfino
UIFont fontWithName 后不知道字体的名字,看了下面的全解决!
3.打印字体族,和字体名字
转自:http://www.2cto.com/kf/201505/397306.html
ios的提供了很多的字体样式。有时候我们在开发应用的时候可能用到不同的字体,通过此Demo我们可以获取到所有的字体样式供我们选择。 首先获取字体字体族科名字,再通过族科的名字获取到字体的名字。
NSArray *arr = [UIFont familyNames];
for (NSString *str in arr) {
NSArray *at = [UIFont fontNamesForFamilyName:str];
for (NSString *fffff in at) {
NSLog(@”字体名字 %@”,fffff);
}
}
然后再使用如下代码就可以修改字符串的字体 。
// NSString * testStr = @我随手一打就是漂亮的十五个字了;
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:testStr];
[str addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(0,3)];
[str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(3,4)];
[str addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(7,4)];
[str addAttribute:NSFontAttributeName value:[UIFont fontWithName:_fontArray[indexPath.row] size:30] range:NSMakeRange(0, 15)];