NSLayoutManager boundingRect(forGlyphRange:in:) returns wrong value for RTL languages
问题 In my app, I draw custom background under lines of text in UITextView . To do so, I use boundingRect(forGlyphRange:in:) method of NSLayoutManager . It works well for LTR languages (Latin, Cyrillic, Chinese etc): But if I use it for RTL texts (Hebrew, Farsi etc), the method returns wrong bounding rect (see padding on the left edge): These additional paddings seem to have some logic. The first character determines the size of the padding for a line: What the reason for this extra padding and