• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: advancementForGlyph problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: advancementForGlyph problem


  • Subject: Re: advancementForGlyph problem
  • From: Graham Cox <email@hidden>
  • Date: Fri, 30 Apr 2010 23:20:19 +1000

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

References: 
 >Re: advancementForGlyph problem (From: steven Hooley <email@hidden>)

  • Prev by Date: Re: test if folder contains file based on NSURLs
  • Next by Date: Design pattern for collection of items and many subsets
  • Previous by thread: Re: advancementForGlyph problem
  • Next by thread: Re: advancementForGlyph problem
  • Index(es):
    • Date
    • Thread