I am using an UITextView
and customised NSLayoutManager
to draw text with a background. For this I assign an underlined NSAttributedString
to the UITextView
and then override the drawUnderline
of the NSLayoutManager
to draw the background instead of drawing the underline. This works quite well because with regular text we just get one glyph per line.
However if emojis are added to the string the NSLayoutManager
creates a separate glyph for the emojis which then breaks the design because drawUnderline
is called for every separate glyph range hence the backgrounds do overlap with each other then.
I tried to only draw one background per line but it turned out to be less reliable than expected. Is there any possibility to stop the NSLayoutManager from creating a separate glyph for the emojis?
I appreciate the help!