On Oct 29, 2008, at 5:15 PM, Peter Ammon wrote:

Trying to find the right font size to just fit the text seems a bit archaic. Here is a different approach:

- Measure the string with some font
- Divide the space available by the measured width to find the scale factor
- Use CGContextScaleCTM() to apply the scale to the current transform
- Draw the string with that font. It will scale nicely and fit into the available space.

Doing that also shifts the rect that I'm trying to draw into. I'm doing multiple NSString drawInRect:withAttributes: calls, all within a single view.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to