NSLayoutManager strangeness
NSLayoutManager strangeness
- Subject: NSLayoutManager strangeness
- From: Thomas Immich <email@hidden>
- Date: Tue, 9 Aug 2005 13:32:02 +0200
Hello,
we are currently using NSLayoutManager to retrieve and draw glyphs
manually. We set up a NSTextStorage instance containing the string
"Zapfino" using the font Zapfino. We expected the - (unsigned)
numberOfGlyphs selector to return 6, since the characters "pf" should
be presented as a ligature, i.e. a single glyph. However, the
selector returns 7.
If we process each glyph in the TextStorage object individually, by
looping from 0 to numberOfGlyphs and calling
characterRangeForGlyphRange:acutalGlyphRange: we get an
actualGlyphRange length of 2 for the "pf" ligature as expected. This
seems to be a contradiction.
for (int i=0; i< [layoutManager numberOfGlyphs]; ++i) {
NSRange actualGlyphRange;
NSRange characterRange = [nativeLayoutManager
characterRangeForGlyphRange:NSMakeRange(i,1)
actualGlyphRange:&actualGlyphRange];
// actual glyph range is two for i = 2
}
We build up the NSTextStorage, NSTextContainer, NSLayoutManager
instances manually as it is explained in the Apple documentation
("Assembling the Text System by Hand") with the exception that we do
not use an NSTextView, since the glyphs are only used to create
OpenGL textures.
Can anybody explain this strange behaviour?
Regards,
Thomas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden