Re: Modifying glyph storage in NSLayoutManager
Re: Modifying glyph storage in NSLayoutManager
- Subject: Re: Modifying glyph storage in NSLayoutManager
- From: Ross Carter <email@hidden>
- Date: Tue, 18 Mar 2008 16:28:36 -0400
On Mar 17, 2008, at 11:19 PM, Martin Wierschin wrote:
I have some text items whose glyphs cannot be determined until
layout. The text string might contain a marker to draw the current
page number, or to sequentially number paragraphs, etc. The glyphs
can be determined only by the layout manager; different layout
managers for the same text storage might display different page
numbers, for example.
One alternative to the glyph generator is to subclass
NSTextAttachment. The attachment cell can query the text container /
layout manager for any information it needs during cell frame
calculation and drawing.
~Martin
Thanks Martin, that might well be the only solution. I'm going to
fiddle with glyph storage a while longer before I give up and try
NSAttachment. Following Douglas's advice on looking to the typesetter
rather than the glyph generator or layout manager, I've been hitting
NSATSTypesetter with everything I can think of. Maybe I'm just
pushing the text system too hard. For example, the typesetter method -
(void)substituteGlyphsInRange:(NSRange)glyphRange withGlyphs:(NSGlyph
*)glyphs looks mighty promising, and the docs say the method can be
overridden by subclasses, but apparently it works only if you replace
the glyphs on a 1-for-1 basis. Or maybe I'm just not calling it at the
right time.
Ross
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden