Problem with NSLayoutManager and ligatures
Problem with NSLayoutManager and ligatures
- Subject: Problem with NSLayoutManager and ligatures
- From: Robert Clair <email@hidden>
- Date: Fri, 8 Apr 2005 09:38:00 -0400
I have a text system set up and I store and restore an attributed
string to the system's text storage. For various reasons I need to
store some of the attributes separate from the attributed string and I
also keep the paths. (Long story - basically the app allows multiple
color models of the same data - so the color attributes have to be
fixed up to be those of the current color model when the string is
loaded.) I also didn't want to store stuff for null glyphs.
On storing the string I loop through it like (simplified):
numGlyphs = [layoutManager numberOfGlyphs];
for ( j=0; j < numGlyphs; j++ )
{
// needed for the path generation
fragmentRect = [layoutManager lineFragmentRectForGlyphAtIndex: j
effectiveRange: nil ];
// needed for getting the attributes
characterIndex = [layoutManager characterIndexForGlyphAtIndex: j];
glyph = [layoutManager glyphAtIndex: j];
... // do stuff
}
when I load the string back I go through essentially the same kind of
loop.
THE PROBLEM:
If you type " the" in the ligature happy Zapafino font you get the
following glyphs when storing the string:
index glyph
0 3 (space)
1 1120 ( ligature for the entire word "the")
2 0 (null)
3 0 (null)
going the other way, doing [textStorage setAttributedString:
myAtttibutedString] and then going through the loop
I get
index glyph
0 3 (space)
1 1119 ( ligature for "th")
2 528 (an alternate "e")
3 0 (null)
Needless to say this causes havoc with my bookkeeping. I've tried
everything I can think of that is supposed to force layout and glyph
generation, including creating an image, locking focus on it, and
calling the textview's drawRect: after loading the string but before
going through the loop with out any luck.
Any suggestions ?
Thanks,
Bob Clair
_______________________________________________
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