一位同事问我最后一次,XXapp字体如何萌啊?
我也想提出萌哒哒的字体!然后,今天有这blog.
首先,我们正处于iOS发展,苹果给了我们很多的字体,当然,我就不一一列举在这里,英文,小汤表示看不懂啦,我要自己搞萌萌哒的字体啊啊啊啊!!!
比方说这种:
又比方说这种:
好了,回归正题,上面卖萌的绝对不是作者君啦.
那天,作者君从网上下载了一个ttf的字体例如以下:
然后小汤我非常淡定的运行了以下这段代码:
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
[self.view addSubview:label];
label.text = @"Hello 汉字";
label.font = [UIFont fontWithName:@"abc.ttf" size:40];
然后运行,咦?
界面上的这个字体怎么还是和原来一样啊?
!
是不是有非常多用第三方字体的小朋友们遇到过这种问题啊?
那是肯定的啦!由于在这里我们要的字体的名称不叫这个啦!
那么应该叫什么呢?小汤我先写了这么一段代码:
for(NSString *fontfamilyname in [UIFont familyNames])
{
NSLog(@"family:'%@'",fontfamilyname);
for(NSString *fontName in [UIFont fontNamesForFamilyName:fontfamilyname])
{
NSLog(@"\tfont:'%@'",fontName);
}
NSLog(@"-------------");
}
然后,他打印了这么一坨:
2015-06-06 15:28:40.276 字体測试[1347:37490] family:'Marion'
2015-06-06 15:28:40.276 字体測试[1347:37490] font:'Marion-Italic'
2015-06-06 15:28:40.276 字体測试[1347:37490] font:'Marion-Bold'
2015-06-06 15:28:40.276 字体測试[1347:37490] font:'Marion-Regular'
2015-06-06 15:28:40.276 字体測试[1347:37490] -------------
2015-06-06 15:28:40.277 字体測试[1347:37490] family:'Copperplate'
2015-06-06 15:28:40.277 字体測试[1347:37490] font:'Copperplate-Light'
2015-06-06 15:28:40.277 字体測试[1347:37490] font:'Copperplate'
2015-06-06 15:28:40.277 字体測试[1347:37490] font:'Copperplate-Bold'
2015-06-06 15:28:40.277 字体測试[1347:37490] -------------
2015-06-06 15:28:40.277 字体測试[1347:37490] family:'Heiti SC'
2015-06-06 15:28:40.277 字体測试[1347:37490] font:'STHeitiSC-Medium'
2015-06-06 15:28:40.277 字体測试[1347:37490] font:'STHeitiSC-Light'
2015-06-06 15:28:40.277 字体測试[1347:37490] -------------
2015-06-06 15:28:40.277 字体測试[1347:37490] family:'Iowan Old Style'
2015-06-06 15:28:40.277 字体測试[1347:37490] font:'IowanOldStyle-Italic'
2015-06-06 15:28:40.279 字体測试[1347:37490] font:'IowanOldStyle-Roman'
2015-06-06 15:28:40.279 字体測试[1347:37490] font:'IowanOldStyle-BoldItalic'
2015-06-06 15:28:40.279 字体測试[1347:37490] font:'IowanOldStyle-Bold'
2015-06-06 15:28:40.279 字体測试[1347:37490] -------------
2015-06-06 15:28:40.279 字体測试[1347:37490] family:'Courier New'
2015-06-06 15:28:40.279 字体測试[1347:37490] font:'CourierNewPS-BoldMT'
2015-06-06 15:28:40.280 字体測试[1347:37490] font:'CourierNewPS-ItalicMT'
2015-06-06 15:28:40.280 字体測试[1347:37490] font:'CourierNewPSMT'
2015-06-06 15:28:40.280 字体測试[1347:37490] font:'CourierNewPS-BoldItalicMT'
2015-06-06 15:28:40.280 字体測试[1347:37490] -------------
2015-06-06 15:28:40.280 字体測试[1347:37490] family:'Apple SD Gothic Neo'
2015-06-06 15:28:40.280 字体測试[1347:37490] font:'AppleSDGothicNeo-Bold'
2015-06-06 15:28:40.280 字体測试[1347:37490] font:'AppleSDGothicNeo-Thin'
2015-06-06 15:28:40.280 字体測试[1347:37490] font:'AppleSDGothicNeo-UltraLight'
2015-06-06 15:28:40.281 字体測试[1347:37490] font:'AppleSDGothicNeo-Regular'
2015-06-06 15:28:40.281 字体測试[1347:37490] font:'AppleSDGothicNeo-Light'
2015-06-06 15:28:40.281 字体測试[1347:37490] font:'AppleSDGothicNeo-Medium'
2015-06-06 15:28:40.281 字体測试[1347:37490] font:'AppleSDGothicNeo-SemiBold'
2015-06-06 15:28:40.281 字体測试[1347:37490] -------------
2015-06-06 15:28:40.282 字体測试[1347:37490] family:'Heiti TC'
2015-06-06 15:28:40.282 字体測试[1347:37490] font:'STHeitiTC-Medium'
2015-06-06 15:28:40.282 字体測试[1347:37490] font:'STHeitiTC-Light'
2015-06-06 15:28:40.282 字体測试[1347:37490] -------------
2015-06-06 15:28:40.282 字体測试[1347:37490] family:'Gill Sans'
2015-06-06 15:28:40.282 字体測试[1347:37490] font:'GillSans-Italic'
2015-06-06 15:28:40.282 字体測试[1347:37490] font:'GillSans-Bold'
2015-06-06 15:28:40.282 字体測试[1347:37490] font:'GillSans-BoldItalic'
2015-06-06 15:28:40.282 字体測试[1347:37490] font:'GillSans-LightItalic'
2015-06-06 15:28:40.282 字体測试[1347:37490] font:'GillSans'
2015-06-06 15:28:40.282 字体測试[1347:37490] font:'GillSans-Light'
2015-06-06 15:28:40.283 字体測试[1347:37490] font:'GillSans-SemiBold'
2015-06-06 15:28:40.283 字体測试[1347:37490] font:'GillSans-SemiBoldItalic'
2015-06-06 15:28:40.283 字体測试[1347:37490] font:'GillSans-UltraBold'
2015-06-06 15:28:40.283 字体測试[1347:37490] -------------
2015-06-06 15:28:40.283 字体測试[1347:37490] family:'Marker Felt'
2015-06-06 15:28:40.283 字体測试[1347:37490] font:'MarkerFelt-Thin'
2015-06-06 15:28:40.283 字体測试[1347:37490] font:'MarkerFelt-Wide'
2015-06-06 15:28:40.283 字体測试[1347:37490] -------------
2015-06-06 15:28:40.283 字体測试[1347:37490] family:'Thonburi'
2015-06-06 15:28:40.283 字体測试[1347:37490] font:'Thonburi'
2015-06-06 15:28:40.283 字体測试[1347:37490] font:'Thonburi-Bold'
2015-06-06 15:28:40.283 字体測试[1347:37490] font:'Thonburi-Light'
2015-06-06 15:28:40.284 字体測试[1347:37490] -------------
2015-06-06 15:28:40.284 字体測试[1347:37490] family:'Avenir Next Condensed'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-BoldItalic'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-Heavy'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-Medium'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-Regular'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-HeavyItalic'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-MediumItalic'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-Italic'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-UltraLightItalic'
2015-06-06 15:28:40.284 字体測试[1347:37490] font:'AvenirNextCondensed-DemiBold'
2015-06-06 15:28:40.285 字体測试[1347:37490] font:'AvenirNextCondensed-UltraLight'
2015-06-06 15:28:40.285 字体測试[1347:37490] font:'AvenirNextCondensed-Bold'
2015-06-06 15:28:40.285 字体測试[1347:37490] font:'AvenirNextCondensed-DemiBoldItalic'
2015-06-06 15:28:40.285 字体測试[1347:37490] -------------
2015-06-06 15:28:40.285 字体測试[1347:37490] family:'Tamil Sangam MN'
2015-06-06 15:28:40.285 字体測试[1347:37490] font:'TamilSangamMN'
2015-06-06 15:28:40.285 字体測试[1347:37490] font:'TamilSangamMN-Bold'
2015-06-06 15:28:40.285 字体測试[1347:37490] -------------
2015-06-06 15:28:40.285 字体測试[1347:37490] family:'Helvetica Neue'
2015-06-06 15:28:40.285 字体測试[1347:37490] font:'HelveticaNeue-Italic'
2015-06-06 15:28:40.285 字体測试[1347:37490] font:'HelveticaNeue-Bold'
2015-06-06 15:28:40.285 字体測试[1347:37490] font:'HelveticaNeue-UltraLight'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-CondensedBlack'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-BoldItalic'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-CondensedBold'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-Medium'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-Light'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-Thin'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-ThinItalic'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-LightItalic'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-UltraLightItalic'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue-MediumItalic'
2015-06-06 15:28:40.286 字体測试[1347:37490] font:'HelveticaNeue'
2015-06-06 15:28:40.287 字体測试[1347:37490] -------------
2015-06-06 15:28:40.287 字体測试[1347:37490] family:'Gurmukhi MN'
2015-06-06 15:28:40.287 字体測试[1347:37490] font:'GurmukhiMN-Bold'
2015-06-06 15:28:40.287 字体測试[1347:37490] font:'GurmukhiMN'
2015-06-06 15:28:40.287 字体測试[1347:37490] -------------
2015-06-06 15:28:40.287 字体測试[1347:37490] family:'Times New Roman'
2015-06-06 15:28:40.287 字体測试[1347:37490] font:'TimesNewRomanPSMT'
2015-06-06 15:28:40.287 字体測试[1347:37490] font:'TimesNewRomanPS-BoldItalicMT'
2015-06-06 15:28:40.287 字体測试[1347:37490] font:'TimesNewRomanPS-ItalicMT'
2015-06-06 15:28:40.287 字体測试[1347:37490] font:'TimesNewRomanPS-BoldMT'
2015-06-06 15:28:40.287 字体測试[1347:37490] -------------
2015-06-06 15:28:40.287 字体測试[1347:37490] family:'Georgia'
2015-06-06 15:28:40.288 字体測试[1347:37490] font:'Georgia-BoldItalic'
2015-06-06 15:28:40.288 字体測试[1347:37490] font:'Georgia'
2015-06-06 15:28:40.288 字体測试[1347:37490] font:'Georgia-Italic'
2015-06-06 15:28:40.288 字体測试[1347:37490] font:'Georgia-Bold'
2015-06-06 15:28:40.288 字体測试[1347:37490] -------------
2015-06-06 15:28:40.288 字体測试[1347:37490] family:'Apple Color Emoji'
2015-06-06 15:28:40.288 字体測试[1347:37490] font:'AppleColorEmoji'
2015-06-06 15:28:40.288 字体測试[1347:37490] -------------
2015-06-06 15:28:40.288 字体測试[1347:37490] family:'Arial Rounded MT Bold'
2015-06-06 15:28:40.288 字体測试[1347:37490] font:'ArialRoundedMTBold'
2015-06-06 15:28:40.288 字体測试[1347:37490] -------------
2015-06-06 15:28:40.288 字体測试[1347:37490] family:'Kailasa'
2015-06-06 15:28:40.289 字体測试[1347:37490] font:'Kailasa-Bold'
2015-06-06 15:28:40.289 字体測试[1347:37490] font:'Kailasa'
2015-06-06 15:28:40.289 字体測试[1347:37490] -------------
2015-06-06 15:28:40.289 字体測试[1347:37490] family:'Kohinoor Devanagari'
2015-06-06 15:28:40.289 字体測试[1347:37490] font:'KohinoorDevanagari-Light'
2015-06-06 15:28:40.289 字体測试[1347:37490] font:'KohinoorDevanagari-Medium'
2015-06-06 15:28:40.289 字体測试[1347:37490] font:'KohinoorDevanagari-Book'
2015-06-06 15:28:40.289 字体測试[1347:37490] -------------
2015-06-06 15:28:40.289 字体測试[1347:37490] family:'Sinhala Sangam MN'
2015-06-06 15:28:40.289 字体測试[1347:37490] font:'SinhalaSangamMN-Bold'
2015-06-06 15:28:40.289 字体測试[1347:37490] font:'SinhalaSangamMN'
2015-06-06 15:28:40.290 字体測试[1347:37490] -------------
2015-06-06 15:28:40.290 字体測试[1347:37490] family:'Chalkboard SE'
2015-06-06 15:28:40.290 字体測试[1347:37490] font:'ChalkboardSE-Bold'
2015-06-06 15:28:40.290 字体測试[1347:37490] font:'ChalkboardSE-Light'
2015-06-06 15:28:40.290 字体測试[1347:37490] font:'ChalkboardSE-Regular'
2015-06-06 15:28:40.290 字体測试[1347:37490] -------------
2015-06-06 15:28:40.290 字体測试[1347:37490] family:'Superclarendon'
2015-06-06 15:28:40.290 字体測试[1347:37490] font:'Superclarendon-Italic'
2015-06-06 15:28:40.290 字体測试[1347:37490] font:'Superclarendon-Black'
2015-06-06 15:28:40.290 字体測试[1347:37490] font:'Superclarendon-LightItalic'
2015-06-06 15:28:40.290 字体測试[1347:37490] font:'Superclarendon-BlackItalic'
2015-06-06 15:28:40.291 字体測试[1347:37490] font:'Superclarendon-BoldItalic'
2015-06-06 15:28:40.291 字体測试[1347:37490] font:'Superclarendon-Light'
2015-06-06 15:28:40.291 字体測试[1347:37490] font:'Superclarendon-Regular'
2015-06-06 15:28:40.291 字体測试[1347:37490] font:'Superclarendon-Bold'
2015-06-06 15:28:40.291 字体測试[1347:37490] -------------
2015-06-06 15:28:40.291 字体測试[1347:37490] family:'Gujarati Sangam MN'
2015-06-06 15:28:40.291 字体測试[1347:37490] font:'GujaratiSangamMN-Bold'
2015-06-06 15:28:40.291 字体測试[1347:37490] font:'GujaratiSangamMN'
2015-06-06 15:28:40.291 字体測试[1347:37490] -------------
2015-06-06 15:28:40.291 字体測试[1347:37490] family:'Damascus'
2015-06-06 15:28:40.291 字体測试[1347:37490] font:'DamascusLight'
2015-06-06 15:28:40.291 字体測试[1347:37490] font:'DamascusBold'
2015-06-06 15:28:40.292 字体測试[1347:37490] font:'DamascusSemiBold'
2015-06-06 15:28:40.292 字体測试[1347:37490] font:'DamascusMedium'
2015-06-06 15:28:40.292 字体測试[1347:37490] font:'Damascus'
2015-06-06 15:28:40.292 字体測试[1347:37490] -------------
2015-06-06 15:28:40.292 字体測试[1347:37490] family:'Noteworthy'
2015-06-06 15:28:40.292 字体測试[1347:37490] font:'Noteworthy-Light'
2015-06-06 15:28:40.292 字体測试[1347:37490] font:'Noteworthy-Bold'
2015-06-06 15:28:40.292 字体測试[1347:37490] -------------
2015-06-06 15:28:40.292 字体測试[1347:37490] family:'Geeza Pro'
2015-06-06 15:28:40.292 字体測试[1347:37490] font:'GeezaPro'
2015-06-06 15:28:40.292 字体測试[1347:37490] font:'GeezaPro-Bold'
2015-06-06 15:28:40.293 字体測试[1347:37490] -------------
2015-06-06 15:28:40.293 字体測试[1347:37490] family:'Avenir'
2015-06-06 15:28:40.293 字体測试[1347:37490] font:'Avenir-Medium'
2015-06-06 15:28:40.293 字体測试[1347:37490] font:'Avenir-HeavyOblique'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-Book'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-Light'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-Roman'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-BookOblique'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-Black'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-MediumOblique'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-BlackOblique'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-Heavy'
2015-06-06 15:28:40.296 字体測试[1347:37490] font:'Avenir-LightOblique'
2015-06-06 15:28:40.297 字体測试[1347:37490] font:'Avenir-Oblique'
2015-06-06 15:28:40.297 字体測试[1347:37490] -------------
2015-06-06 15:28:40.297 字体測试[1347:37490] family:'Academy Engraved LET'
2015-06-06 15:28:40.297 字体測试[1347:37490] font:'AcademyEngravedLetPlain'
2015-06-06 15:28:40.297 字体測试[1347:37490] -------------
2015-06-06 15:28:40.297 字体測试[1347:37490] family:'Mishafi'
2015-06-06 15:28:40.297 字体測试[1347:37490] font:'DiwanMishafi'
2015-06-06 15:28:40.297 字体測试[1347:37490] -------------
2015-06-06 15:28:40.297 字体測试[1347:37490] family:'Futura'
2015-06-06 15:28:40.297 字体測试[1347:37490] font:'Futura-CondensedMedium'
2015-06-06 15:28:40.297 字体測试[1347:37490] font:'Futura-CondensedExtraBold'
2015-06-06 15:28:40.298 字体測试[1347:37490] font:'Futura-Medium'
2015-06-06 15:28:40.298 字体測试[1347:37490] font:'Futura-MediumItalic'
2015-06-06 15:28:40.298 字体測试[1347:37490] -------------
2015-06-06 15:28:40.298 字体測试[1347:37490] family:'Farah'
2015-06-06 15:28:40.298 字体測试[1347:37490] font:'Farah'
2015-06-06 15:28:40.298 字体測试[1347:37490] -------------
2015-06-06 15:28:40.298 字体測试[1347:37490] family:'Kannada Sangam MN'
2015-06-06 15:28:40.298 字体測试[1347:37490] font:'KannadaSangamMN'
2015-06-06 15:28:40.298 字体測试[1347:37490] font:'KannadaSangamMN-Bold'
2015-06-06 15:28:40.298 字体測试[1347:37490] -------------
2015-06-06 15:28:40.298 字体測试[1347:37490] family:'Arial Hebrew'
2015-06-06 15:28:40.298 字体測试[1347:37490] font:'ArialHebrew-Bold'
2015-06-06 15:28:40.299 字体測试[1347:37490] font:'ArialHebrew-Light'
2015-06-06 15:28:40.299 字体測试[1347:37490] font:'ArialHebrew'
2015-06-06 15:28:40.299 字体測试[1347:37490] -------------
2015-06-06 15:28:40.299 字体測试[1347:37490] family:'Arial'
2015-06-06 15:28:40.299 字体測试[1347:37490] font:'ArialMT'
2015-06-06 15:28:40.299 字体測试[1347:37490] font:'Arial-BoldItalicMT'
2015-06-06 15:28:40.299 字体測试[1347:37490] font:'Arial-BoldMT'
2015-06-06 15:28:40.299 字体測试[1347:37490] font:'Arial-ItalicMT'
2015-06-06 15:28:40.299 字体測试[1347:37490] -------------
2015-06-06 15:28:40.299 字体測试[1347:37490] family:'Party LET'
2015-06-06 15:28:40.299 字体測试[1347:37490] font:'PartyLetPlain'
2015-06-06 15:28:40.299 字体測试[1347:37490] -------------
2015-06-06 15:28:40.300 字体測试[1347:37490] family:'?
??®™?
?-'
2015-06-06 15:28:40.300 字体測试[1347:37490] font:'--'
2015-06-06 15:28:40.300 字体測试[1347:37490] -------------
2015-06-06 15:28:40.300 字体測试[1347:37490] family:'Chalkduster'
2015-06-06 15:28:40.300 字体測试[1347:37490] font:'Chalkduster'
2015-06-06 15:28:40.300 字体測试[1347:37490] -------------
2015-06-06 15:28:40.300 字体測试[1347:37490] family:'Hiragino Kaku Gothic ProN'
2015-06-06 15:28:40.300 字体測试[1347:37490] font:'HiraKakuProN-W6'
2015-06-06 15:28:40.300 字体測试[1347:37490] font:'HiraKakuProN-W3'
2015-06-06 15:28:40.300 字体測试[1347:37490] -------------
2015-06-06 15:28:40.300 字体測试[1347:37490] family:'Hoefler Text'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'HoeflerText-Italic'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'HoeflerText-Regular'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'HoeflerText-Black'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'HoeflerText-BlackItalic'
2015-06-06 15:28:40.301 字体測试[1347:37490] -------------
2015-06-06 15:28:40.301 字体測试[1347:37490] family:'Optima'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'Optima-Regular'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'Optima-ExtraBlack'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'Optima-BoldItalic'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'Optima-Italic'
2015-06-06 15:28:40.301 字体測试[1347:37490] font:'Optima-Bold'
2015-06-06 15:28:40.301 字体測试[1347:37490] -------------
2015-06-06 15:28:40.302 字体測试[1347:37490] family:'Palatino'
2015-06-06 15:28:40.302 字体測试[1347:37490] font:'Palatino-Bold'
2015-06-06 15:28:40.302 字体測试[1347:37490] font:'Palatino-Roman'
2015-06-06 15:28:40.302 字体測试[1347:37490] font:'Palatino-BoldItalic'
2015-06-06 15:28:40.302 字体測试[1347:37490] font:'Palatino-Italic'
2015-06-06 15:28:40.302 字体測试[1347:37490] -------------
2015-06-06 15:28:40.302 字体測试[1347:37490] family:'Malayalam Sangam MN'
2015-06-06 15:28:40.302 字体測试[1347:37490] font:'MalayalamSangamMN-Bold'
2015-06-06 15:28:40.302 字体測试[1347:37490] font:'MalayalamSangamMN'
2015-06-06 15:28:40.302 字体測试[1347:37490] -------------
2015-06-06 15:28:40.302 字体測试[1347:37490] family:'Lao Sangam MN'
2015-06-06 15:28:40.302 字体測试[1347:37490] font:'LaoSangamMN'
2015-06-06 15:28:40.303 字体測试[1347:37490] -------------
2015-06-06 15:28:40.303 字体測试[1347:37490] family:'Al Nile'
2015-06-06 15:28:40.303 字体測试[1347:37490] font:'AlNile-Bold'
2015-06-06 15:28:40.303 字体測试[1347:37490] font:'AlNile'
2015-06-06 15:28:40.303 字体測试[1347:37490] -------------
2015-06-06 15:28:40.303 字体測试[1347:37490] family:'Bradley Hand'
2015-06-06 15:28:40.303 字体測试[1347:37490] font:'BradleyHandITCTT-Bold'
2015-06-06 15:28:40.303 字体測试[1347:37490] -------------
2015-06-06 15:28:40.303 字体測试[1347:37490] family:'Hiragino Mincho ProN'
2015-06-06 15:28:40.303 字体測试[1347:37490] font:'HiraMinProN-W6'
2015-06-06 15:28:40.303 字体測试[1347:37490] font:'HiraMinProN-W3'
2015-06-06 15:28:40.304 字体測试[1347:37490] -------------
2015-06-06 15:28:40.304 字体測试[1347:37490] family:'Trebuchet MS'
2015-06-06 15:28:40.304 字体測试[1347:37490] font:'Trebuchet-BoldItalic'
2015-06-06 15:28:40.304 字体測试[1347:37490] font:'TrebuchetMS'
2015-06-06 15:28:40.304 字体測试[1347:37490] font:'TrebuchetMS-Bold'
2015-06-06 15:28:40.304 字体測试[1347:37490] font:'TrebuchetMS-Italic'
2015-06-06 15:28:40.304 字体測试[1347:37490] -------------
2015-06-06 15:28:40.304 字体測试[1347:37490] family:'Helvetica'
2015-06-06 15:28:40.304 字体測试[1347:37490] font:'Helvetica-Bold'
2015-06-06 15:28:40.304 字体測试[1347:37490] font:'Helvetica'
2015-06-06 15:28:40.304 字体測试[1347:37490] font:'Helvetica-LightOblique'
2015-06-06 15:28:40.304 字体測试[1347:37490] font:'Helvetica-Oblique'
2015-06-06 15:28:40.305 字体測试[1347:37490] font:'Helvetica-BoldOblique'
2015-06-06 15:28:40.305 字体測试[1347:37490] font:'Helvetica-Light'
2015-06-06 15:28:40.305 字体測试[1347:37490] -------------
2015-06-06 15:28:40.305 字体測试[1347:37490] family:'Courier'
2015-06-06 15:28:40.305 字体測试[1347:37490] font:'Courier-BoldOblique'
2015-06-06 15:28:40.305 字体測试[1347:37490] font:'Courier'
2015-06-06 15:28:40.305 字体測试[1347:37490] font:'Courier-Bold'
2015-06-06 15:28:40.305 字体測试[1347:37490] font:'Courier-Oblique'
2015-06-06 15:28:40.305 字体測试[1347:37490] -------------
2015-06-06 15:28:40.305 字体測试[1347:37490] family:'Cochin'
2015-06-06 15:28:40.305 字体測试[1347:37490] font:'Cochin-Bold'
2015-06-06 15:28:40.305 字体測试[1347:37490] font:'Cochin'
2015-06-06 15:28:40.306 字体測试[1347:37490] font:'Cochin-Italic'
2015-06-06 15:28:40.306 字体測试[1347:37490] font:'Cochin-BoldItalic'
2015-06-06 15:28:40.306 字体測试[1347:37490] -------------
2015-06-06 15:28:40.306 字体測试[1347:37490] family:'Devanagari Sangam MN'
2015-06-06 15:28:40.306 字体測试[1347:37490] font:'DevanagariSangamMN'
2015-06-06 15:28:40.306 字体測试[1347:37490] font:'DevanagariSangamMN-Bold'
2015-06-06 15:28:40.306 字体測试[1347:37490] -------------
2015-06-06 15:28:40.306 字体測试[1347:37490] family:'Oriya Sangam MN'
2015-06-06 15:28:40.306 字体測试[1347:37490] font:'OriyaSangamMN'
2015-06-06 15:28:40.306 字体測试[1347:37490] font:'OriyaSangamMN-Bold'
2015-06-06 15:28:40.306 字体測试[1347:37490] -------------
2015-06-06 15:28:40.307 字体測试[1347:37490] family:'Snell Roundhand'
2015-06-06 15:28:40.307 字体測试[1347:37490] font:'SnellRoundhand-Bold'
2015-06-06 15:28:40.307 字体測试[1347:37490] font:'SnellRoundhand'
2015-06-06 15:28:40.307 字体測试[1347:37490] font:'SnellRoundhand-Black'
2015-06-06 15:28:40.307 字体測试[1347:37490] -------------
2015-06-06 15:28:40.307 字体測试[1347:37490] family:'Zapf Dingbats'
2015-06-06 15:28:40.307 字体測试[1347:37490] font:'ZapfDingbatsITC'
2015-06-06 15:28:40.307 字体測试[1347:37490] -------------
2015-06-06 15:28:40.307 字体測试[1347:37490] family:'Bodoni 72'
2015-06-06 15:28:40.307 字体測试[1347:37490] font:'BodoniSvtyTwoITCTT-Bold'
2015-06-06 15:28:40.307 字体測试[1347:37490] font:'BodoniSvtyTwoITCTT-Book'
2015-06-06 15:28:40.307 字体測试[1347:37490] font:'BodoniSvtyTwoITCTT-BookIta'
2015-06-06 15:28:40.308 字体測试[1347:37490] -------------
2015-06-06 15:28:40.308 字体測试[1347:37490] family:'Verdana'
2015-06-06 15:28:40.308 字体測试[1347:37490] font:'Verdana-Italic'
2015-06-06 15:28:40.308 字体測试[1347:37490] font:'Verdana-BoldItalic'
2015-06-06 15:28:40.308 字体測试[1347:37490] font:'Verdana'
2015-06-06 15:28:40.308 字体測试[1347:37490] font:'Verdana-Bold'
2015-06-06 15:28:40.308 字体測试[1347:37490] -------------
2015-06-06 15:28:40.308 字体測试[1347:37490] family:'American Typewriter'
2015-06-06 15:28:40.308 字体測试[1347:37490] font:'AmericanTypewriter-CondensedLight'
2015-06-06 15:28:40.308 字体測试[1347:37490] font:'AmericanTypewriter'
2015-06-06 15:28:40.308 字体測试[1347:37490] font:'AmericanTypewriter-CondensedBold'
2015-06-06 15:28:40.308 字体測试[1347:37490] font:'AmericanTypewriter-Light'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AmericanTypewriter-Bold'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AmericanTypewriter-Condensed'
2015-06-06 15:28:40.309 字体測试[1347:37490] -------------
2015-06-06 15:28:40.309 字体測试[1347:37490] family:'Avenir Next'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AvenirNext-UltraLight'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AvenirNext-UltraLightItalic'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AvenirNext-Bold'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AvenirNext-BoldItalic'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AvenirNext-DemiBold'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AvenirNext-DemiBoldItalic'
2015-06-06 15:28:40.309 字体測试[1347:37490] font:'AvenirNext-Medium'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'AvenirNext-HeavyItalic'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'AvenirNext-Heavy'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'AvenirNext-Italic'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'AvenirNext-Regular'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'AvenirNext-MediumItalic'
2015-06-06 15:28:40.310 字体測试[1347:37490] -------------
2015-06-06 15:28:40.310 字体測试[1347:37490] family:'Baskerville'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'Baskerville-Italic'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'Baskerville-SemiBold'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'Baskerville-BoldItalic'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'Baskerville-SemiBoldItalic'
2015-06-06 15:28:40.310 字体測试[1347:37490] font:'Baskerville-Bold'
2015-06-06 15:28:40.311 字体測试[1347:37490] font:'Baskerville'
2015-06-06 15:28:40.311 字体測试[1347:37490] -------------
2015-06-06 15:28:40.311 字体測试[1347:37490] family:'Khmer Sangam MN'
2015-06-06 15:28:40.311 字体測试[1347:37490] font:'KhmerSangamMN'
2015-06-06 15:28:40.311 字体測试[1347:37490] -------------
2015-06-06 15:28:40.311 字体測试[1347:37490] family:'Didot'
2015-06-06 15:28:40.311 字体測试[1347:37490] font:'Didot-Italic'
2015-06-06 15:28:40.311 字体測试[1347:37490] font:'Didot-Bold'
2015-06-06 15:28:40.311 字体測试[1347:37490] font:'Didot'
2015-06-06 15:28:40.311 字体測试[1347:37490] -------------
2015-06-06 15:28:40.311 字体測试[1347:37490] family:'Savoye LET'
2015-06-06 15:28:40.311 字体測试[1347:37490] font:'SavoyeLetPlain'
2015-06-06 15:28:40.312 字体測试[1347:37490] -------------
2015-06-06 15:28:40.312 字体測试[1347:37490] family:'Bodoni Ornaments'
2015-06-06 15:28:40.312 字体測试[1347:37490] font:'BodoniOrnamentsITCTT'
2015-06-06 15:28:40.312 字体測试[1347:37490] -------------
2015-06-06 15:28:40.312 字体測试[1347:37490] family:'Symbol'
2015-06-06 15:28:40.312 字体測试[1347:37490] font:'Symbol'
2015-06-06 15:28:40.312 字体測试[1347:37490] -------------
2015-06-06 15:28:40.312 字体測试[1347:37490] family:'Menlo'
2015-06-06 15:28:40.312 字体測试[1347:37490] font:'Menlo-Italic'
2015-06-06 15:28:40.312 字体測试[1347:37490] font:'Menlo-Bold'
2015-06-06 15:28:40.313 字体測试[1347:37490] font:'Menlo-Regular'
2015-06-06 15:28:40.313 字体測试[1347:37490] font:'Menlo-BoldItalic'
2015-06-06 15:28:40.313 字体測试[1347:37490] -------------
2015-06-06 15:28:40.313 字体測试[1347:37490] family:'Bodoni 72 Smallcaps'
2015-06-06 15:28:40.313 字体測试[1347:37490] font:'BodoniSvtyTwoSCITCTT-Book'
2015-06-06 15:28:40.313 字体測试[1347:37490] -------------
2015-06-06 15:28:40.313 字体測试[1347:37490] family:'DIN Alternate'
2015-06-06 15:28:40.313 字体測试[1347:37490] font:'DINAlternate-Bold'
2015-06-06 15:28:40.313 字体測试[1347:37490] -------------
2015-06-06 15:28:40.313 字体測试[1347:37490] family:'Papyrus'
2015-06-06 15:28:40.314 字体測试[1347:37490] font:'Papyrus'
2015-06-06 15:28:40.314 字体測试[1347:37490] font:'Papyrus-Condensed'
2015-06-06 15:28:40.314 字体測试[1347:37490] -------------
2015-06-06 15:28:40.314 字体測试[1347:37490] family:'Euphemia UCAS'
2015-06-06 15:28:40.314 字体測试[1347:37490] font:'EuphemiaUCAS-Italic'
2015-06-06 15:28:40.314 字体測试[1347:37490] font:'EuphemiaUCAS'
2015-06-06 15:28:40.314 字体測试[1347:37490] font:'EuphemiaUCAS-Bold'
2015-06-06 15:28:40.314 字体測试[1347:37490] -------------
2015-06-06 15:28:40.314 字体測试[1347:37490] family:'Telugu Sangam MN'
2015-06-06 15:28:40.314 字体測试[1347:37490] font:'TeluguSangamMN'
2015-06-06 15:28:40.314 字体測试[1347:37490] font:'TeluguSangamMN-Bold'
2015-06-06 15:28:40.314 字体測试[1347:37490] -------------
2015-06-06 15:28:40.315 字体測试[1347:37490] family:'Bangla Sangam MN'
2015-06-06 15:28:40.315 字体測试[1347:37490] font:'BanglaSangamMN-Bold'
2015-06-06 15:28:40.315 字体測试[1347:37490] font:'BanglaSangamMN'
2015-06-06 15:28:40.315 字体測试[1347:37490] -------------
2015-06-06 15:28:40.315 字体測试[1347:37490] family:'Zapfino'
2015-06-06 15:28:40.315 字体測试[1347:37490] font:'Zapfino'
2015-06-06 15:28:40.315 字体測试[1347:37490] -------------
2015-06-06 15:28:40.315 字体測试[1347:37490] family:'Bodoni 72 Oldstyle'
2015-06-06 15:28:40.315 字体測试[1347:37490] font:'BodoniSvtyTwoOSITCTT-Book'
2015-06-06 15:28:40.315 字体測试[1347:37490] font:'BodoniSvtyTwoOSITCTT-Bold'
2015-06-06 15:28:40.315 字体測试[1347:37490] font:'BodoniSvtyTwoOSITCTT-BookIt'
2015-06-06 15:28:40.315 字体測试[1347:37490] -------------
2015-06-06 15:28:40.316 字体測试[1347:37490] family:'DIN Condensed'
2015-06-06 15:28:40.316 字体測试[1347:37490] font:'DINCondensed-Bold'
2015-06-06 15:28:40.316 字体測试[1347:37490] -------------
不知道其它同学能不能从这么一坨输出里找到他呢?反正我找到了,可是,看着那个输出,小汤表示,这肯定不正确啊!
然后,小汤我又写了以下这段代码:
//这段代码用来获取字体的真正名称
NSURL *fontUrl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"abc" ofType:@"ttf"]];
CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL((__bridge CFURLRef)fontUrl);
CGFontRef fontRef = CGFontCreateWithDataProvider(fontDataProvider);
CGDataProviderRelease(fontDataProvider);
CTFontManagerRegisterGraphicsFont(fontRef, NULL);
NSString *fontName = CFBridgingRelease(CGFontCopyPostScriptName(fontRef));
NSLog(@"fontName: %@",fontName);
CGFontRelease(fontRef);
输出结果例如以下:
2015-06-06 15:32:22.674 字体測试[1381:38645] fontName: --
所以,想来大家都懂我为啥之前不信这就是字体名称了把?字体名称竟然是 --
,真坑啊…
又一次运行这段代码:
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
[self.view addSubview:label];
label.text = @"Hello 汉字";
label.font = [UIFont fontWithName:@"--" size:40];
后的效果例如以下:
OK,到这里,大家应该知道怎么用第三方的.ttf字体了吧?
把我上面那段//这段代码用来获取字体的真正名称
的对应代码直接拷贝过去,然后把你们命名的资源文件名传进去,就得到最后须要的字体名称喽~
版权声明:本文博客原创文章,博客,未经同意,不得转载。