• 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
Text/Font Size Measurement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text/Font Size Measurement


  • Subject: Text/Font Size Measurement
  • From: Dave Smith <email@hidden>
  • Date: Tue, 23 May 2006 10:24:05 -0400

I am having a problem properly measuring text in Cocoa. I have a very simple problem that requires that I render some characters into an image and then measure how large etc. each of the characters are in the final image.

In 10.4 I managed to get something workable using:

[chString boundingRectWithSize:NSZeroSize
	options:NSStringDrawingUsesDeviceMetrics
	attributes: attrs];

That gives me my rect measurements in pixels (at least it appears to be in pixels) which is what I need for my image manipulation.

Now I have to change the code to support 10.2. That particular call is not longer available to be used. Can anyone suggest how to accomplish the same thing in 10.2?

I have tried using the LayoutManager etc. and I can get measurements on characters/string, but they are not in whole pixels. Any ideas?


Dave Smith email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Text/Font Size Measurement
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: Bug in PDFKit's PDFDocument attributes?!
  • Next by Date: how do i force NSArrayController to sort?
  • Previous by thread: Re: Menu and views
  • Next by thread: Re: Text/Font Size Measurement
  • Index(es):
    • Date
    • Thread