Re: How to obtain paths of laid-out text
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: Wed, 12 Nov 2014 08:38:21 +1100
> On 12 Nov 2014, at 3:27 am, Kyle Sluder <email@hidden> wrote:
>
> On Fri, Nov 7, 2014, at 04:40 PM, Graham Cox 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).
>
> What are you actually trying to do?
Get the bezier path(s) of some laid-out text. From this I do further operations on the paths to create special text effects.
> That is, why and to what degree does
> it matter when and how often -showPackedGlyphs: is called?
That's a good question. I'm not sure. The way I was capturing the paths was to use this method to copy the glyph paths to a bezier path using -appendPackedGlyphs: I did assume the method was being called only once for a given piece of text, though if it is called more than once, I'm not sure of the consequences for the bezier path - would characters be appended to the end of the run (i.e. is there some sort of internal advancement for each appended glyph?) or would it just add a path on top of an existing one? The documentation for -appendPackedGlyphs isn't very enlightening.
I'll look into this, it could be the issue.
> Also, have you tried disabling discontiguous layout?
No, I'll try that as well.
But some basic questions remain:
1. What is the relationship between CGGlyph and NSGlyph?
2. Given that the old -showPackedGlyphs: method is deprecated, and its replacement -showCGGlyphs: doesn't seem to have a natural match to a NSBezierPath method, what is the correct general approach when using this newer method to capture paths?
--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