第零篇 - UIFont
国际惯例,先上图

苹果内置 所有字体名称(2015.03.15)这里是demo
// 00 Copperplate, // 01 "Heiti SC", // 02 "Iowan Old Style", // 03 "Kohinoor Telugu", // 04 Thonburi, // 05 "Heiti TC", // 06 "Courier New", // 07 "Gill Sans", // 08 "Apple SD Gothic Neo", // 09 "Marker Felt", // 10 "Avenir Next Condensed", // 11 "Tamil Sangam MN", // 12 "Helvetica Neue", // 13 "Gurmukhi MN", // 14 "Times New Roman", // 15 Georgia, // 16 "Apple Color Emoji", // 17 "Arial Rounded MT Bold", // 18 Kailasa, // 19 "Kohinoor Devanagari", // 20 "Kohinoor Bangla", // 21 "Chalkboard SE", // 22 "Sinhala Sangam MN", // 23 "PingFang TC", // 24 "Gujarati Sangam MN", // 25 Damascus, // 26 Noteworthy, // 27 "Geeza Pro", // 28 Avenir, // 29 "Academy Engraved LET", // 30 Mishafi, // 31 Futura, // 32 Farah, // 33 "Kannada Sangam MN", // 34 "Arial Hebrew", // 35 Arial, // 36 "Party LET", // 37 Chalkduster, // 38 "Hoefler Text", // 39 Optima, // 40 Palatino, // 41 "Lao Sangam MN", // 42 "Malayalam Sangam MN", // 43 "Al Nile", // 44 "Bradley Hand", // 45 "PingFang HK", // 46 "Trebuchet MS", // 47 Helvetica, // 48 Courier, // 49 Cochin, // 50 "Hiragino Mincho ProN", // 51 "Devanagari Sangam MN", // 52 "Oriya Sangam MN", // 53 "Snell Roundhand", // 54 "Zapf Dingbats", // 55 "Bodoni 72", // 56 Verdana, // 57 "American Typewriter", // 58 "Avenir Next", // 59 Baskerville, // 60 "Khmer Sangam MN", // 61 Didot, // 62 "Savoye LET", // 63 "Bodoni Ornaments", // 64 Symbol, // 65 Menlo, // 66 "Bodoni 72 Smallcaps", // 67 Papyrus, // 68 "Hiragino Sans", // 69 "PingFang SC", // 70 "Euphemia UCAS", // 71 "Telugu Sangam MN", // 72 "Bangla Sangam MN", // 73 Zapfino, // 74 "Bodoni 72 Oldstyle"
以下来自http://my.oschina.net/u/2340880
//7.0之后可用 设置字体风格
// NSString *const UIFontTextStyleHeadline; 用于标题的风格
// NSString *const UIFontTextStyleSubheadline;用于副标题的风格
// NSString *const UIFontTextStyleBody;用于正文的字体
// NSString *const UIFontTextStyleFootnote;用于脚注的字体
// NSString *const UIFontTextStyleCaption1;用于标准字幕字体
// NSString *const UIFontTextStyleCaption2;用于替换字幕字体
label.font=[UIFont preferredFontForTextStyle:UIFontTextStyleCaption2];
//说实话,没看出什么太大的差别
//设置字体和字体大小
+ (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize;
//返回所有字体的字体家族名称数组
+ (NSArray *)familyNames;
//按字体家族名称返回字体名称数组
+ (NSArray *)fontNamesForFamilyName:(NSString *)familyName;
//设置普通字体字号大小
+ (UIFont *)systemFontOfSize:(CGFloat)fontSize;
//设置加粗字体字号大小
+ (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize;
//设置斜体字号大小
+ (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize;
//一些只读属性
//字体家族名称
@property(nonatomic,readonly,retain) NSString *familyName;
//字体名称
@property(nonatomic,readonly,retain) NSString *fontName;
//字号大小
@property(nonatomic,readonly) CGFloat pointSize;
//字体设计模型,表示距离最高点偏移余量
@property(nonatomic,readonly) CGFloat ascender;
//底部的模型偏移量
@property(nonatomic,readonly) CGFloat descender;
//字体模型的头高信息
@property(nonatomic,readonly) CGFloat capHeight;
//字体模型的xHeight信息
@property(nonatomic,readonly) CGFloat xHeight;
//字体行高
@property(nonatomic,readonly) CGFloat lineHeight NS_AVAILABLE_IOS(4_0);
//模型主体信息
@property(nonatomic,readonly) CGFloat leading;
//创建一个新字体与当前字体相同,除了指定的大小
- (UIFont *)fontWithSize:(CGFloat)fontSize;
//通过描述信息返回字体 7.0后可用
+ (UIFont *)fontWithDescriptor:(UIFontDescriptor *)descriptor size:(CGFloat)pointSize NS_AVAILABLE_IOS(7_0);
//返回字体的描述信息,7.0后可用
- (UIFontDescriptor *)fontDescriptor NS_AVAILABLE_IOS(7_0);

浙公网安备 33010602011771号