Re: mysterious behavior of system font metrics
Re: mysterious behavior of system font metrics
- Subject: Re: mysterious behavior of system font metrics
- From: Alan Snyder <email@hidden>
- Date: Wed, 28 Oct 2015 15:41:16 -0700
The log is showing the NSFont description: NSLog(@"%@", [NSFont systemFontOfSize:1]);
No drawing was performed until after these log messages were written. There was no graphics context.
In fact, no text was drawn using Core Text at all. Java does not use Core Text to draw text, but it does use the native font metrics, so yes, the differences are visible.
The results are not random. Either the space width stays at 0.36 or it changes to 0.28 and stays there. The only thing I cannot predict is whether it will change.
Alan
> On Oct 28, 2015, at 2:13 PM, Quincey Morris <email@hidden> wrote:
>
> On Oct 28, 2015, at 12:17 , Alan Snyder <email@hidden <mailto: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