On 15/05/2009, at 1:59 AM, Benjamin Stiglitz wrote:

How should NSFont's -underlinePosition and -underlineThickness values be interpreted? Are they fixed values, indicating an absolute offset, or are
they some proportion of the pointSize or something else?

In the optimal case (I’ll explain shortly), the underlinePosition is the
number of points below the baseline to position the center of the line
with width underlineThickness.

Ok, that's what I plumped for, and the results are OK for many fonts, but not all.

However (and this is a big however), many fonts report an invalid
underline thickness and/or position.

What is "invalid"? A value of 0?

Using the NSFontExplorer sample code, I notice that for example, Zapfino reports an offset of -2.25 for the 12 point font, but positioning the underline here is not where NSLayoutManager puts it, -2.25 being much closer. Some fonts do report 0 for the offset... so treating 0 as invalid is not the real story it seems.

In this case, both the Cocoa and
CoreText rendering paths cook up values based on the average of the
metrics of Helvetica and Times, scaled to fit the metrics of the
selected font. (Please do file a bug for API to access these computed
values.)

Will do, though if someone in the know could tell me how to perform a similar computation I'd be happy to roll my own for now.

I ask because the results I'm getting by treating it as an absolute
value differ from Apple's rendition, but the docs are unenlightening on
this point.

An image with a comparison would go a long way to helping us diagnose
this issue.

Ok, I'll send something to you off-list.

--Graham



_______________________________________________

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