Ashton 1.0.3

Ashton 1.0.3

测试已测试
语言语言 Obj-CObjective C
许可协议 MIT
发布最后发布2016年6月

Markus Müller-SimhoferMartin Schürrer 维护。



Ashton 1.0.3

  • 作者:
  • Martin Schuerrer

在 AppKit、CoreText、UIKit 和 HTML 之间转换 NSAttributedStrings。

这个名字听起来很奇怪?

一点也不奇怪:AtributesStringHTMLTransformation

它实际上做什么?

Ashton 分为两部分

a) 它可以将 AppKit、CoreText 或 UIKit NSAttributedString 的属性转换为 Ashton 特定中间表示,并从中间表示转换回其他平台。这使得例如 AppKit -> Ashton 中间表示 -> CoreText 成为可能。

b) 它可以在具有中间属性的 NSAttributedString 和 HTML 之间进行转换。这使得在 Mac 和 iOS 之间传输 NSAttributedString 成为可能。

AppKit 输入 中间 AppKit 输出
NSParagraphStyleAttributeNametextAlign
@"paragraph": @{ @"textAlignment":@"left|right|center" }
NSParagraphStyleAttributeNametextAlign
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