测试已测试 | ✓ |
语言语言 | Obj-CObjective C |
许可协议 | MIT |
发布最后发布 | 2016年6月 |
由 Markus Müller-Simhofer、Martin Schürrer 维护。
在 AppKit、CoreText、UIKit 和 HTML 之间转换 NSAttributedStrings。
一点也不奇怪:AtributesStringHTMLTransformation。
Ashton 分为两部分
a) 它可以将 AppKit、CoreText 或 UIKit NSAttributedString 的属性转换为 Ashton 特定中间表示,并从中间表示转换回其他平台。这使得例如 AppKit -> Ashton 中间表示 -> CoreText 成为可能。
b) 它可以在具有中间属性的 NSAttributedString 和 HTML 之间进行转换。这使得在 Mac 和 iOS 之间传输 NSAttributedString 成为可能。
AppKit 输入 | 中间 | AppKit 输出 |
---|---|---|
NSParagraphStyleAttributeName 与 textAlign |
@"paragraph": @{ @"textAlignment":@"left|right|center" } |
NSParagraphStyleAttributeName 与 textAlign |
NSFontAttributeName |
@"font": @{ @"traitBold":@YES, @"traitItalic":@NO, @"features":@[@[@5, @1], @[@14, @1]], @"pointSize":@12, @"familyName":@"Helvetica" } |
NSFontAttributeName |
NSSuperscriptAttributeName 的值为 1 或 -1 |
@"verticalAlign": @"super|sub" |
NSSuperscriptAttributeName |
NSUnderlineColorAttributeName |
@"underlineColor": @[@255, @0, @0, @1.0] |
NSUnderlineColorAttributeName |
NSStrikethroughStyleAttributeName |
@"strikethrough": @"single|thick|double" |
NSStrikethroughStyleAttributeName |
NSStrikethroughColorAttributeName |
@"strikethroughColor": @[@255, @0, @0, @1.0] |
NSStrikethroughColorAttributeName |
NSForegroundColorAttributeName |
@"color": @[@255, @0, @0, @1.0] |
NSForegroundColorAttributeName |
NSStrokeColorAttributeName |
@"color": @[@255, @0, @0, @1.0] |
NSForegroundColorAttributeName |
NSLinkAttributeName |
@"link": @"http://google.com/" |
NSLinkAttributeName |