For character measurements, if you are using the Cocoa text system, use the font returned by the NSLayoutManager method "subtituteFontForFont:" in order to get the screen font used by Cocoa text. However, experimentally, I found that for font sizes greater than 17, non-integral values are still returned. I've not found any documentation as to how Cocoa text (or Quartz text or CoreText) arrive at the values they actually use.

If you're not using Cocoa text, you will have to do some rounding to integral values: e.g. floor(value+0.5) or truncating: floor(value). Experimentally, Cocoa text seems to use rounding for advancement, and truncation for line height, at least with the fonts/sizes I've tried.

The Application Services Framework provides a couple of functions for drawing glyphs that give you explicit control over advancement: CGContextShowGlyphsWithAdvancements
and CGContextShowGlyphsAtLocations.

Dale Miller
dalelmil...@comcast.net




_______________________________________________

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