Re: advancementForGlyph problem
Re: advancementForGlyph problem
- Subject: Re: advancementForGlyph problem
- From: "David F." <email@hidden>
- Date: Sun, 2 May 2010 19:01:41 -0600
On Apr 30, 2010, at 10:37 AM, Dale Miller wrote:
> 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.
Dale -- Thanks for responding. "substituteFontForFont:" didn't fix my problem, but I'm glad you brought font substitution to my attention. One more thing I need to keep my eye on.
> 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.
I would be perfectly happy truncating the advancement (despite the tighter kerning it would give me).
> The Application Services Framework provides a couple of functions for drawing glyphs that give you explicit control over advancement: CGContextShowGlyphsWithAdvancements
> and CGContextShowGlyphsAtLocations.
Hmmm. I'll have to give those functions a look. Do they handle strikethrough/underline?
David_______________________________________________
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