• 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: How to obtain paths of laid-out text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to obtain paths of laid-out text


  • Subject: Re: How to obtain paths of laid-out text
  • From: Graham Cox <email@hidden>
  • Date: Tue, 11 Nov 2014 18:20:04 +1100

Anyone? Surely there's a supported way to do this? Sample code?

--Graham


> On 8 Nov 2014, at 9:40 am, Graham Cox <email@hidden> wrote:
>
> In the past, I've obtained bezier paths from laid out text using a subclass of NSLayoutManager that overrode the deprecated -showPackedGlyphs:length:... method. This method had a nice smooth impedance match with [NSBezierPath appendPackedGlyphs:]. The method has been deprecated since 10.7, but was still working fine in 10.9. In 10.10, this approach broke. The method is still called, but the resulting glyph runs include all sorts of extraneous characters which seem to be relics of earlier layouts (possibly NSLayoutManager does more aggressive caching in 10.10).
>
> I'm wondering what the modern replacement for doing this is. There's a new method in NSLayoutManager, -showCGGlyphs:positions:count:... which seems to be the modern override point, but it no longer has a smooth match to the NSBezierPath methods that accept glyphs. For one thing, it supplies CGGlyph values, not NSGlyph values, and I can't determine from documentation whether these two are really the same thing, or whether a conversion is required (and if so how to do it). But trying to use the NSBezierPath method -appendGlyphs:count:inFont: by simply casting CGGlyph to NSGlyph doesn't produce the right outcome either - I'm still getting extraneous characters as well as some within the expected laid-out text that just seem random. The effect is worse than before.
>
> What's the modern supported way to do this?
>
> --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


_______________________________________________

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: 
 >How to obtain paths of laid-out text (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Add target-action to AVPlayerViewController Done or subclass instead?
  • Next by Date: Re: WWDC App
  • Previous by thread: How to obtain paths of laid-out text
  • Next by thread: Re: How to obtain paths of laid-out text
  • Index(es):
    • Date
    • Thread