使用方式是
NSAttributedStringKey.font 替代 NSFontAttributeName
extension NSAttributedStringKey {
@available(iOS 6.0, *)
public static let paragraphStyle: NSAttributedStringKey // NSParagraphStyle, default defaultParagraphStyle
@available(iOS 6.0, *)
public static let foregroundColor: NSAttributedStringKey // UIColor, default blackColor
@available(iOS 6.0, *)
public static let backgroundColor: NSAttributedStringKey // UIColor, default nil: no background
@available(iOS 6.0, *)
public static let ligature: NSAttributedStringKey // NSNumber containing integer, default 1: default ligatures, 0: no ligatures
@available(iOS 6.0, *)
public static let kern: NSAttributedStringKey // NSNumber containing floating point value, in points; amount to modify default kerning. 0 means kerning is disabled.
@available(iOS 6.0, *)
public static let strikethroughStyle: NSAttributedStringKey // NSNumber containing integer, default 0: no strikethrough
@available(iOS 6.0, *)
public static let underlineStyle: NSAttributedStringKey // NSNumber containing integer, default 0: no underline
@available(iOS 6.0, *)
public static let strokeColor: NSAttributedStringKey // UIColor, default nil: same as foreground color
@available(iOS 6.0, *)
public static let strokeWidth: NSAttributedStringKey // NSNumber containing floating point value, in percent of font point size, default 0: no stroke; positive for stroke alone, negative for stroke and fill (a typical value for outlined text would be 3.0)
@available(iOS 6.0, *)
public static let shadow: NSAttributedStringKey // NSShadow, default nil: no shadow
@available(iOS 7.0, *)
public static let textEffect: NSAttributedStringKey // NSString, default nil: no text effect
@available(iOS 7.0, *)
public static let attachment: NSAttributedStringKey // NSTextAttachment, default nil
@available(iOS 7.0, *)
public static let link: NSAttributedStringKey // NSURL (preferred) or NSString
@available(iOS 7.0, *)
public static let baselineOffset: NSAttributedStringKey // NSNumber containing floating point value, in points; offset from baseline, default 0
@available(iOS 7.0, *)
public static let underlineColor: NSAttributedStringKey // UIColor, default nil: same as foreground color
@available(iOS 7.0, *)
public static let strikethroughColor: NSAttributedStringKey // UIColor, default nil: same as foreground color
@available(iOS 7.0, *)
public static let obliqueness: NSAttributedStringKey // NSNumber containing floating point value; skew to be applied to glyphs, default 0: no skew
@available(iOS 7.0, *)
public static let expansion: NSAttributedStringKey // NSNumber containing floating point value; log of expansion factor to be applied to glyphs, default 0: no expansion
@available(iOS 7.0, *)
public static let writingDirection: NSAttributedStringKey // NSArray of NSNumbers representing the nested levels of writing direction overrides as defined by Unicode LRE, RLE, LRO, and RLO characters. The control characters can be obtained by masking NSWritingDirection and NSWritingDirectionFormatType values. LRE: NSWritingDirectionLeftToRight|NSWritingDirectionEmbedding, RLE: NSWritingDirectionRightToLeft|NSWritingDirectionEmbedding, LRO: NSWritingDirectionLeftToRight|NSWritingDirectionOverride, RLO: NSWritingDirectionRightToLeft|NSWritingDirectionOverride,
@available(iOS 6.0, *)
public static let verticalGlyphForm: NSAttributedStringKey // An NSNumber containing an integer value. 0 means horizontal text. 1 indicates vertical text. If not specified, it could follow higher-level vertical orientation settings. Currently on iOS, it's always horizontal. The behavior for any other value is undefined.
}