On 30/04/2010, at 9:08 PM, steven Hooley wrote:

>> From your later response it seems like your question is really
> regarding drawing strikethroughs and underlines. If so, the strike
> through and underline are not part of the glyph or font - they are
> just a line drawn from the start point of a range of glyphs to the end
> point of a range of glyphs. You cannot draw them piecemeal, a glyph at
> a time, and expect them to perfectly match up without overlap or
> underlap (apologies for making up a word), as the amount that any 2
> glyphs overlap is particular to those 2 glyhps. ie. The strikethrough
> of an 'A' followed by a 'V' would need to be a different length than
> that of an 'A' followed by a 'j'.


Not that this will tell you anything about what Cocoa does, but when I had to 
implement underlines and strikethroughs for text-on-path in DrawKit, I did so 
by working a line at a time and knocking out any places where descenders would 
hit the line. For text-on-path, drawing a line per glyph looks absolutely 
terrible, being straight and not curved, and having gaps where the character 
curves away from its neighbour.

I would imagine that for performance reasons as well as aesthetic, Cocoa draws 
whole lines for strikethroughs and underlines as well.

I did also discover that relying on the values exactly returned by a font 
didn't always give similar results to Cocoa's underline positioning - I never 
did quite work out its metrics but arrived at certain fudge factors empirically 
that gave almost identical results with most fonts.


--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