• 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
Measuring aliased text for drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Measuring aliased text for drawing


  • Subject: Measuring aliased text for drawing
  • From: Jonah Petri <email@hidden>
  • Date: Thu, 15 Apr 2010 12:35:35 -0400

Hello,

I need to measure and draw some text in a non-antialiased NSGraphicsContext.  Drawing is no problem: just setShouldAntialias:NO in the context, and I'm good.  Measuring, however, is proving more difficult.  I've been using the simple -[NSString sizeWithAttributes:] method, which works great for antialiased text, but doesn't seem to provide me a way to measure my non-antialiased text, and can't take a graphics context as a parameter.

On a whim, I've tried using non-antialiased screen fonts in the font attribute via screenFontWithRenderingMode:NSFontIntegerAdvancementsRenderingMode. That doesn't seem to change the measurement.

Is there a Cocoa-level solution?  It seems like CTLineGetImageBounds gives me what I want, so I could go that route, but I'd rather not go through the trouble of pushing all of my drawing down to the CT layer.  Or is the CT layer compatible with cocoa-level Fonts/String Attributes in some way that I've not seen yet?

Thanks for any insights.

-Jonah

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Prev by Date: How can we Pause And Play the Animations on UIView
  • Next by Date: program termination after releasing self defined NSXMLParser class
  • Previous by thread: Re: How can we Pause And Play the Animations on UIView
  • Next by thread: program termination after releasing self defined NSXMLParser class
  • Index(es):
    • Date
    • Thread