Post

Replies

Boosts

Views

Activity

Genmoji is there but doesn't display in NSTextView
I have discovered an odd issue with NSTextView, NSAdaptiveImageGlyph, and NSLayoutManager. (Forgive the Objective-C... I'm old-school.) I can easily display an attributed string containing text and Genmoji NSAdaptiveImageGlyphs with something very basic like this: textView = [[NSTextView alloc] initWithFrame:NSMakeRect(100.0, 100.0, 500.0, 100.0)]; [textView.textStorage setAttributedString:sampleText]; [self addSubview:textView]; //NSLayoutManager *layoutManager = textView.layoutManager; I can even insert or paste new Genmoji into there as well. However, if I uncomment out that last line to retrieve the layoutManager of the text view it breaks the rendering of Genmoji, even if I do nothing with the layoutManager! Just getting it causes the NSTextView to skip past Genmoji glyphs when spacing out glyphs and when rendering. I thought perhaps getting the layoutManager caused an internal cache to break so I tried ensureLayoutForTextContainer but that didn't help. Interestingly if I paste a new Genmoji into the NSTextView it doesn't display either. Yet if I select all, copy, and paste into TextEdit I see all the Genmoji just fine so they are there, just invisible and zero size. Using the arrow keys I have to skip past the invisible Genmoji. But if I comment out that line again I see all Genmoji with no issues. I do need to use a layoutManager to measure things like text bounds and heights. Elsewhere in the code, my existing drawing routines would like to draw the resulting attributed string not with drawAtPoint (which works fine) but with drawGlyphsForGlyphRange but that doesn't work either as it uses NSLayoutManager. Is there a trick to getting NSAdaptiveImageGlyphs working with NSLayoutManager? Thanks for any assistance!
3
0
278
2w