>> Also, you should disable screen font substitution via -[NSLayoutManager 
>> setUsesScreenFont:NO].
>> 
>> This is the main source of glyph advancement differences you're seeing.
> 
> Thanks Aki, indeed this has removed the small horizontal offset that was 
> there.
> 
> I am however unable to figure out where the small vertical offset comes from. 
>  Using NSLayoutManager's defaultBaselineOffsetForFont method, I have tried 
> getting the default baseline offset for the text at the max zoom level, and 
> the baseline offset for the text at the current zoom, then find the 
> difference and set the NSBaselineOffsetAttributeName attribute accordingly. 
> However, this approach works at certain zoom levels and not at others! 

My apologies, I just realized I explained this incorrectly.  I'm basically just 
getting the default baseline offset for the font at the max zoom, then multiply 
it by (currentZoomFactor/maxZoomFactor), then finally subtracting the default 
baseline offset for the font at the current zoom.  So it looks something like 
this:

float baselineAtMaxZoom = [layoutManager 
defaultBaselineOffsetForFont:fontAtMaxZoom];
float interpolatedBaselineAtCurrentZoom = baselineAtMaxZoom * factor / 
kWorkspaceMaxZoomFactor;
float offset = baselineAtCurrentZoom - [layoutManager 
defaultBaselineOffsetForFont:fontAtCurrentZoom];


> I've also tried using the same approach for line height, where I interpolate 
> what the line height should be given the line height at the max zoom level 
> (with the help of NSLayoutManager's defaultLineHeightForFont method), then 
> set the minimum and maximum line height of the paragraph style accordingly. 
> At some zoom levels, this works, but at other zoom levels, this make the 
> vertical offset even worse.
> 
> Could anyone shed some light as to what the issue might be here?

_______________________________________________

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 arch...@mail-archive.com

Reply via email to