Re: Text/Font Size Measurement
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