NSAttributedString 可讓文字具備更豐富的樣式。常用 key 包含字體、前景色、背景色、段落樣式、字距、刪除線、下劃線、陰影、描邊與傾斜。
NSKernAttributeName 可調整字元間距,NSFontAttributeName 可設定字體。


NSForegroundColorAttributeName 設定文字顏色,NSBackgroundColorAttributeName 設定背景顏色。


NSStrokeColorAttributeName 設定描邊顏色,NSStrokeWidthAttributeName 設定描邊寬度。正數只改變描邊寬度,負數會同時影響描邊與填滿。


NSStrikethroughStyleAttributeName 可加上刪除線,NSUnderlineStyleAttributeName 可加上下劃線。


NSShadowAttributeName 可設定陰影,但通常需要搭配其他屬性才明顯。NSVerticalGlyphFormAttributeName 可控制直排或橫排,NSObliquenessAttributeName 可讓文字傾斜,NSExpansionAttributeName 則可讓文字扁平化或擴展。





