• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CTLineCreateWithAttributedString ignoring font size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >CTLineCreateWithAttributedString ignoring font size (From: Charles Srstka <email@hidden>)
 >Re: CTLineCreateWithAttributedString ignoring font size (From: Alastair Houghton <email@hidden>)
 >Re: CTLineCreateWithAttributedString ignoring font size (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: Aqua animations drawing from separate thread
  • Next by Date: Re: initWithCoder but I do not have nib file
  • Previous by thread: Re: CTLineCreateWithAttributedString ignoring font size
  • Next by thread: boundingRectWithSize and the size height parameter
  • Index(es):
    • Date
    • Thread