Re: Drawing custom text attributes
Re: Drawing custom text attributes
- Subject: Re: Drawing custom text attributes
- From: Douglas Davidson <email@hidden>
- Date: Mon, 22 Dec 2003 10:10:31 -0800
On Dec 21, 2003, at 9:31 AM, Reni Puls wrote:
does anyone have some quick examples how to use custom attributes with
the Cocoa text system? I know that I can just set arbitrary attributes
on an NSAttributedString, but where do I go if I want these attributes
to actually change the appearance of my text in an NSTextView?
I gave an example of this at the last WWDC; I'll see if it has been
distributed generally, and if not try to make it so. Basically you
override -[NSLayoutManager drawGlyphsForGlyphRange:atPoint:], convert
the glyph range back to a character range, look for subranges with your
custom attribute, and do your special drawing, in addition to calling
the super method.
Douglas Davidson
_______________________________________________
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.