Re: Overriding text size in NSTextStorage
Re: Overriding text size in NSTextStorage
- Subject: Re: Overriding text size in NSTextStorage
- From: Jens Alfke <email@hidden>
- Date: Mon, 10 May 2010 08:50:13 -0700
On May 10, 2010, at 4:54 AM, Gideon King wrote:
> Hi, I am trying to override the setting of text size in my text storage subclass. I have overridden the setAttributes:range: method, and told the text to use a standard font size (keeping the other font attributes), but when I am editing, and use the font panel to set the font, although the correct font size is used, the text is moved up or down depending on the size of the font selected.
That sounds like a dangerous thing to do — you’re violating the expected behavior of the class (i.e. what goes in is the same as what comes out.)
If you want to alter the characteristics of the text, you should do so before it goes into the text view, or in one of the explicit NSTextView delegate hooks. I’m pretty sure at least one delegate call allows you to alter the text (including its style) that’s about to be inserted.
—Jens_______________________________________________
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