Re: CTLineCreateWithAttributedString ignoring font size
Re: CTLineCreateWithAttributedString ignoring font size
- Subject: Re: CTLineCreateWithAttributedString ignoring font size
- From: Alastair Houghton <email@hidden>
- Date: Sat, 15 Aug 2009 15:13:07 +0100
On 15 Aug 2009, at 10:28, Charles Srstka wrote:
Now I'm just trying to figure out why it's ignoring the
NSBackgroundColorAttributeName attribute.
Well I think the problem is that NSBackgroundColorAttributeName is a
higher level thing. In the Cocoa text system, the NSLayoutManager is
responsible for drawing it, and that's done with separate methods, in
the same way as rendering the selection highlight.
While I haven't used Core Text myself, I imagine it's architected in a
similar manner, so CTDrawLine() is very unlikely to render anything
other than the glyphs. CTFrame *may* be able to render the
background, so if you need that functionality and don't want to draw
it yourself you could try creating a CTFramesetter rather than a
CTLine and using that to generate a CTFrame that you then draw.
Otherwise I think you'll just have to draw the background manually.
For the time being, I've got a workaround in just drawing the
background color with NSRectFill, but this feels like a kludge, and
that I really should be doing something differently to draw the
background the "right" way.
I guess my only comment there is that it might be more consistent to
use CGContextFillRect(). Not that it really matters either way :-)
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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