• 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: How to get "colored" font smoothing in a CALayer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get "colored" font smoothing in a CALayer


  • Subject: Re: How to get "colored" font smoothing in a CALayer
  • From: David Duncan <email@hidden>
  • Date: Thu, 6 Jan 2011 10:53:59 -0800

On Jan 6, 2011, at 10:28 AM, James Bucanek wrote:

> Greetings,
>
> The is probably more of a Carbon question than a Cocoa question, but since the problem starts with CALayer, I'll start here first.

Not really since nothing here involves Carbon :).

> So how can I get my text to draw as smoothly as the Finder?

Subpixel antialiasing requires a background to antialias against, and your layer is probably transparent. If you supply a background (by drawing one into the context first) then you should get subpixel antialiasing, assuming it is otherwise enabled.

> Searching the forums I found a reference to "sub-pixel smoothing". The solution was to fix some properties of the CGBitmapContext being drawn into, but CALayer doesn't (as far as I can tell) give you any control over the CGContext used when drawing the content of the layer.


There is actually a way to gain control over the context that is being drawn into, although this is generally not necessary (and can result in inefficiencies in some cases). Basically you can override -displayLayer: (in your layer's delegate) or -display (in a layer subclass) to create your own bitmap context, call -drawInContext: with that context, then create an image from the context and assign it to the layer's contents property. It isn't a generally useful technique, but if you have a case where you want to preserve previous content when redrawing the layer this is one way to do so.
--
David Duncan

_______________________________________________

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

  • Follow-Ups:
    • Re: How to get "colored" font smoothing in a CALayer
      • From: James Bucanek <email@hidden>
References: 
 >How to get "colored" font smoothing in a CALayer (From: James Bucanek <email@hidden>)

  • Prev by Date: Re: Execute a pre-starting script first, when the App bundle is launched, then the main executable
  • Next by Date: Re: How to get "colored" font smoothing in a CALayer
  • Previous by thread: How to get "colored" font smoothing in a CALayer
  • Next by thread: Re: How to get "colored" font smoothing in a CALayer
  • Index(es):
    • Date
    • Thread