NSWritingDirectionAttributeName
The writing direction of the text.
Declaration
extern NSAttributedStringKey NSWritingDirectionAttributeName;Overview
The value of this attribute is an NSArray object containing NSNumber objects representing the nested levels of writing direction overrides, in order from outermost to innermost.
This attribute provides a means to override the default bidirectional text algorithm, equivalent to using the Unicode bidi control characters LRE, RLE, LRO, or RLO paired with PDF, but as a higher-level attribute. (See Unicode Standard Annex #9 for information about the Unicode bidi formatting codes.) The NSWritingDirectionAttributeName constant is a character-level attribute that provides a higher-level alternative to the inclusion of explicit bidirectional control characters in text. It is the NSAttributedString equivalent of the HTML markup using bdo element with the dir attribute.
The values of the NSNumber objects should be 0, 1, 2, or 3, for LRE, RLE, LRO, or RLO respectively, and combinations of NSWritingDirection.leftToRight and NSWritingDirection.rightToLeft with NSTextWritingDirectionEmbedding or NSTextWritingDirectionOverride, as shown in the following table.
Array | Unicode Control Characters | Writing Direction Constants |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
See Also
Getting rendering attribute keys
NSBackgroundColorAttributeNameNSBaselineOffsetAttributeNameNSFontAttributeNameNSForegroundColorAttributeNameNSGlyphInfoAttributeNameNSKernAttributeNameNSLigatureAttributeNameNSParagraphStyleAttributeNameNSStrikethroughColorAttributeNameNSStrikethroughStyleAttributeNameNSStrokeColorAttributeNameNSStrokeWidthAttributeNameNSSuperscriptAttributeNameNSTrackingAttributeNameNSUnderlineColorAttributeName