Re: mysterious behavior of system font metrics
Re: mysterious behavior of system font metrics
- Subject: Re: mysterious behavior of system font metrics
- From: Quincey Morris <email@hidden>
- Date: Wed, 28 Oct 2015 14:13:10 -0700
- Feedback-id: 167118m:167118agrif8a:167118sX94-pK7Ve:SMTPCORP
On Oct 28, 2015, at 12:17 , Alan Snyder <email@hidden> wrote:
>
> The mysterious behavior that I observe is that the result of [NSFont systemFontOfSize:1] can change over time. For example:
>
> 2015-10-28 10:22:15.033 java[19620:15284886] ".HelveticaNeueDeskInterface-Regular 1.00 pt. P [] (0x7f8232e2a460) fobj=0x7f8232e2a2e0, spc=0.36"
> 2015-10-28 10:22:15.193 java[19620:15284886] ".HelveticaNeueDeskInterface-Regular 1.00 pt. P [] (0x7f8232e2a460) fobj=0x7f823504b5b0, spc=0.36"
> 2015-10-28 10:22:15.257 java[19620:15284886] ".HelveticaNeueDeskInterface-Regular 1.00 pt. P [] (0x7f8232e2a460) fobj=0x7f8232d157a0, spc=0.28"
>
> Note that the space width changes from 0.36 (the normal value) to 0.28 (a value that works much better when scaled to 12 points).
I dunno either, but it’s interesting that the NSFont object is (apparently) the same each time, and there is (apparently) a secondary object that’s different each time. (I may be off-base, though, since you don’t say how these log messages are generated.)
My guess is that the secondary object is something that’s cached for a particular spacing value, and that a new spacing value is calculated each time you actually draw text (and, if different, causes a new secondary object to be created). IIRC, the Helvetica Neue system font drawing is tweaked to try to match metrics of Lucida Grande *per string drawn* (as is San Francisco relative to past system fonts), so it’s not outside the bounds of possibility that different spacing is used for each drawing call.
So were you actually drawing different text between the above log messages, and were you actually seeing different spacing if you drew the same text string repeatedly?
The other possibility that occurs to me is that NSFont objects may have *multiple* secondary fobj objects, and that the log message is only reporting a random one of them.
_______________________________________________
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