Actually, you're right that merely suppressing display is all I need. I was assuming this would have to be done with temporary attributes, but is there an easier way?
THank you, Adam Solove On Fri, May 2, 2008 at 7:57 AM, Ross Carter <[EMAIL PROTECTED]> wrote: > I'm not sure whether you need to change a particular set of attributes > (font, line spacing, tabs, etc) in each layout manager or merely suppress > the display of text in other series. If the former, I would think that the > layout manager is not best place to handle the attribute fixing. I'd think > about either subclassing NSTextStorage and have it modify the attributes > that it receives from and sends to the various layout managers, or > subclassing the typesetter and overriding setAttributedString: to change the > attributes as needed. I haven't ever done either of those things, mind you, > so I don't know whether they would work. > > It just seems to me that by the time the layout manager goes to work, it's > difficult to change the attributes (except for things that don't affect the > layout, such as underlining) because of the complex interaction between the > layout manager and the typesetter. You probably want to intervene before the > attributedString gets converted into glyphs. > > > On May 1, 2008, at 8:25 PM, Adam C.M. Solove wrote: > > > > > > > > > > Hello all, > > > > In the episode of Late Night Cocoa on the text system, [ > > > http://www.macdevnet.com/index.php/shows/latenightcocoa/37-latenightcocoa/93-lnc005 > > ] Juan Pablo Claude described a setup with multiple NSLayoutManagers > > editing text from the same NSTextStorage and then said, off-hand, that > > you might do this if you wanted to display the same text with > > different fonts. I am curious if anyone could discuss how this might > > be done: displaying the same underlying attributed string, but > > formatting it before the NSLayoutManager tries to lay it out and > > formatting it back when the NSTextView sends back changes. I cannot > > find specific information on subclassing NSLayoutManager to make these > > sorts of changes. > > > > (I know there is an Apple demo [TextViewConfig, > > http://developer.apple.com/samplecode/TextViewConfig/index.html] which > > shows multiple layout managers, but these both render the exact same > > attributed string (except that one view has been essentially zoomed to > > twice the size). I am curious if it is possible to actually change > > temporary attributes in one LayoutManager but not the other, and then > > change them back appropriately before sending events to the > > NSTextStorage.) > > > > End technical discussion > > ---- > > Begin back story for those interested: > > > > I am a relatively new Cocoa developer working on an open-source > > project for academics. I recently spent considerable time working on > > a web-based version of this application before learning that the > > hardest part was technically infeasible because of some limitations in > > HTML's designmode. In starting with Cocoa, I will be happy if the > > project and required learning takes many years, so long as there is an > > answer in advance to this one difficult question. > > > > The application is an editor for a specific subset of the TEI XML > > guidelines for encoding literary works and scholarly commentaries on > > them. The underlying data maps very nicely into an attributed string, > > because it is a single text divided up into separate 'series' (main > > text, footnotes, cross-links) The series are all anchored together, > > but would best be displayed apart, with first the main text, then each > > series of notes. I believe the easiest way to do this would be to have > > a single underlying NSTextStorage, to attribute every range of text to > > one series, and then to create various subclasses (or formatters) for > > NSLayoutManager that each display only text in one particular series. > > I suspect this could also be done with a custom Typesetter and the > > method setNotShownAttribute:forGlyphAtIndex:, but am curious if there > > is a more general hook to set attributes on the string before layout. > > > > Thank you, > > > > Adam Solove > > > > _______________________________________________ > > > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > > > 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: > > http://lists.apple.com/mailman/options/cocoa-dev/rosscarter%40mac.com > > > > This email sent to [EMAIL PROTECTED] > > > > > > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]