Re:Calculating the size of NSFont...
Re:Calculating the size of NSFont...
- Subject: Re:Calculating the size of NSFont...
- From: Dale Miller <email@hidden>
- Date: Sun, 4 Mar 2007 13:25:18 -0700
I asked the same question a couple of months ago and got zero
response. However, i was able to find, by experiment, an answer which
seems to work. Caveat: no documentation exists to verify this. In
fact all the documentation contradicts it. However the actual
behavior of the Apple typesetter contradicts the documentation, and
agrees with my experiments, at least for the sizes and fonts I have
tried. The following code works for me:
float adv = [termFont advancementForGlyph:
[termFont glyphWithName:@"space"]].width;
charSize.width = (int)(adv+0.5); /* font size must be < 17. */
charSize.height = [layoutMgr defaultLineHeightForFont:termFont];
Note that if the Font Size is 17 or greater, the fractional floating
advance seems to be used. Go Figure!
Dale Miller
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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