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

Re: Text/Font Size Measurement


  • Subject: Re: Text/Font Size Measurement
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 26 May 2006 11:46:31 -0700


On May 23, 2006, at 7:24 AM, Dave Smith wrote:

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?


If you want the glyph image bounds rather than the typographic bounds, and boundingRectWithSize:options:attributes: is not available, then you would need to use a layout manager to obtain the positions of the individual glyphs, and NSFont to obtain the bounding rect for each glyph. For each glyph, take the bounding rect and move it to the appropriate position, then you can combine the resulting rects to get the image bounds.


Douglas Davidson

_______________________________________________
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


References: 
 >Text/Font Size Measurement (From: Dave Smith <email@hidden>)

  • Prev by Date: Core data dependent attributes
  • Next by Date: Re: Newbie Q : Not-so-simple encoding&decoding example
  • Previous by thread: Text/Font Size Measurement
  • Next by thread: how do i force NSArrayController to sort?
  • Index(es):
    • Date
    • Thread