Re: What's wrong with this font thing?
Re: What's wrong with this font thing?
- Subject: Re: What's wrong with this font thing?
- From: Randall Meadows <email@hidden>
- Date: Thu, 30 Oct 2008 09:53:10 -0600
On Oct 29, 2008, at 6:05 PM, Aki Inoue wrote:
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.
Cool, I can see I can use this in
boundingRectWithSize:options:attributes: as well as the draw; I'll try
that out (I was using sizeWithAttributes:, but I can switch that). Do
I assume correctly that they perform the same basic functionality?
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:.
Can you give me any more pointers about this? Neither the "String
Programming Guide for Cocoa" nor the "Attributed Strings Programming
Guide" even mention any of the NSStringDrawingOptions flags. This is
definitely sometime I'm dealing with:
My view is made up of many different "fields" which are all drawn
independently from one another. However, the layout of the fields is
predetermined: field A is a label, and field B is the associated
value; however, they are drawn independently, and as I mentioned
before, if the contents of a field don't fit "naturally" then the font
size is reduced until it can fit. This is a case where I need to make
sure that the baselines of both field A and field B are the same.
Thanks!
randy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden