NSTextField and NSParagraphStyle: right align left-to-right text and left align right-to-left text

NSTextField and NSParagraphStyle have a alignment: NSTextAlignment property that allows to align text to the left, center, right, or natural, which means that text for left-to-right languages is aligned left and text for right-to-left languages is aligned right. What I'm looking for is how to align text in the opposite direction of the natural direction. (Note that using the leading and trailing NSLayoutConstraints is not enough as they only aligns the text bounding box, but not the text within the bounding box.)

Is there a way to accomplish this? Or is there a built-in function that allows to determine what the natural direction of a String is, so that I can then calculate the alignment by flipping that value?

NSTextField and NSParagraphStyle: right align left-to-right text and left align right-to-left text
 
 
Q