Re: Suggestions on text display problem
Re: Suggestions on text display problem
- Subject: Re: Suggestions on text display problem
- From: Ryan Stevens <email@hidden>
- Date: Sun, 28 Mar 2004 18:05:43 -0800
Grab the [textStorage string], make a new NSAttributedString with the
string and the proper attributes then toss it into your other textview.
...maybe?
On Mar 28, 2004, at 5:00 PM, Scott Thompson wrote:
I've got a unusal text editing situation that I'm trying to set up and
I was hoping for some guidance on how to set it up.
What I want is two text views that are both displaying the same string
(the same NSTextStorage object) but I want the attributes displayed
differently in each view. For example, one of the views might display
all the text attributes except fix the font to 12 point Time while the
other view will display the text in it's full glory with arbitrary
font changes in the glyph range.
From reading the Text System documentation, I gather that what I want
to do is have a single NSTextStorage that has more than one
NSLayoutManager. Each Layout Manager, in turn, will have it's own
NSTextContainer and NSTextView. No problem it was almost spooky how
easy it was to set up a pair of views that both display the same
NSTextStorage object so that the changes in one view are reflected,
magically, in the other.
Now what I think I want to do is change one of the layout managers so
that, as it is laying out the text, it selectively changes the
attributes that it uses to draw the text.
This behavior is VERY similar to that provided by
addTemporaryAttributes:forCharacterRange:, but the documentation
claims that that method is only useful for the colors and underlines
of the text. I would like to change other attributes (the font used
for example).
Other than the temporary attributes, I didn't really see any
bottleneck that I could replace between the NSTextStorage and the
NSLayoutManager so that I could modify the attributes that the layout
manager uses?
Can anyone provide guidance as to how I might implement this behavior?
Scott
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.