Re: Getting temporary attributes set in NSLayoutManager to print
Re: Getting temporary attributes set in NSLayoutManager to print
- Subject: Re: Getting temporary attributes set in NSLayoutManager to print
- From: Douglas Davidson <email@hidden>
- Date: Wed, 7 Feb 2007 15:47:38 -0800
On Feb 7, 2007, at 3:33 PM, email@hidden wrote:
I have a custom NSTextView where I set the NSLayoutManager
temporary attribute NSBackgroundColorAttributeName for certain
ranges in my string. Everything displays properly on screen.
However, when I try to print onto paper, the text is printed
without the colors - I realise that this is the correct behaviour.
So my question is what is the best way of getting getting these
attributes to print? Has anyone done this?
What you are seeing is the intended behavior, but we understand that
some clients do wish to change it. We have addressed this with new
API for Leopard, but for Tiger you would probably need to override -
[NSLayoutManager drawBackgroundForGlyphRange:atPoint:]. If all
you're interested in is NSBackgroundColorAttributeName, that should
be feasible: call super, check to see if the context is drawing to
the screen, and if not, then for each character range to be colored,
call -
rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:
rectCount: to get a list of rects to color.
Douglas Davidson
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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