The "threshold" being discussed here is the boundary between the screen font vs printer font in NSFont jargon.

For font size smaller than 16pt, we automatically substitute the default printer font to its corresponding screen font.
The metrics gap is caused by the substitution.

You can disable the auto-substitution with NSStringDrawingDisableScreenFontSubstitution flag.

When you change the scale/font size, the baseline shifts naturally when you layout from the top. In order to keep it fixed at the baseline, you need to layout/render on it.
-drawInRect:withAttributes: always render from the top.

To render with the baseline, use -drawWithRect:options:attributes:.

Aki

On 2008/10/29, at 16:37, Randall Meadows wrote:

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/aki%40apple.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

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