> On 24 Aug 2014, at 8:49 am, Raglan T. Tiger <r...@crusaderrabbit.net> wrote:
> 
> 
> On Aug 23, 2014, at 5:43 PM, Kyle Sluder <k...@ksluder.com> wrote:
> 
>> So what if Zöe’s name has an umlaut? As the documentation describes, that 
>> can result in two separate glyphs.
>> 
> 
> apparently -glyphWithName: returns all the paths required to make the unicode 
> character
> 
> at this link you will see Zöe  interpreted from the NSBezierPaths returned by 
> -glyphWithName:  and put into bezier our model
> 
> http://crusaderrabbit.net/zoe.png
> 
> this is what we want but again to the original question how to get glyphs 
> unicode so we don’t have to know the names
> 
> -rags

This is why Apple has CoreText which is deep and gnarly and knows how to 
substitute fonts when glyphs are missing and deal with all aspects of unicode 
including the equivalence of composed characters to other characters (there are 
a lot of ways to write Zôe) and 1000 other things before finally mapping to a 
run of glyphs. Text is hard,  especially when Zôe turns out to be called 高清防 or 
A∉B or 🙈🙉🙊. The idea you can take an NSString, split it up into ‘characters’ 
and look them up in a random NSFont is too simplistic. It’ll work for ASCII, 
that’s about it. 

The last time I did anything like this I used CoreText. You make CTLines they 
have CTRuns, the CTRuns have properties which tell you what CTFont they were 
using. The CTRuns give you CGGlyphs (not a typo, it’s CGGlyph for some reason) 
and let you get the bezier paths for those glyphs. You can make CTLines from 
attributed strings. I seem to recall iOS wrapped some of this stuff up a couple 
of years ago into another framework to stop people having to use CoreText but 
I’m not sure it got a lot easier and I’m fairly sure it’s not on OSX either. 



_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to