On Mar 10, 2010, at 12:42 PM, David wrote:

> Phillip -- Have you made any progress on this?  I am trying to draw glyphs 
> onto an NSBitmapImageRep using drawGlyphsForGlyphRange:atPoint: and having 
> similar problems.  In my case the symptoms are that underline and 
> strikethrough are not being drawn correctly.
> 
> Right now, my guess is that some component of the text system is confused 
> about where the baseline should be.  That's the angle I am pursuing right now.
> 
> David


Hi David,
        I gave up using the drawGlyphsForGlyphRange: method as I just couldn't 
figure why it was drawing the glyphs were it was. I'm getting decent results 
now using NSBezierPath's appendBezierPathWithGlyph:inFont:. I set up the text 
system as though I were going to use NSLayoutManager to draw it. I use 
boundingRectForGlyphRange: to help size my font to fit the image width I want 
and then use glyphAtIndex: to get the glyph I want to draw.

        If you decide to go this route you could add the underline and 
strikethrough manually to the bezier path without much difficulty.

        I use the ascender and descender font metrics to determine where to 
start drawing the bezier path relative to image origin. You could also use 
these metrics to determine where to draw your marks.

-Philip
_______________________________________________

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