I'm getting glyphs of individual characters from an NSAttributedString, then get the NSBezierPath with appendBezierPathWithGlyphs:count:inFont:
and finally output the flattened path points to a NSArray (see my code below) to display them with OpenGL in Quartz Composer.
For some NSFonts, including standard ones (American Typewriter, Baskerville, ...), the letters are totally wrong (see the image below).
It might be important to say that I'm working with French keyboard and language.
NSBezierPath* path = [NSBezierPath bezierPath];
NSTextStorage *storage = [[[NSTextStorage alloc] initWithString:character] autorelease];
NSLayoutManager *manager = [[[NSLayoutManager alloc] init] autorelease];
NSTextContainer *container = [[[NSTextContainer alloc] init] autorelease];
[storage addLayoutManager:manager];
[manager addTextContainer:container];
NSRange glyphRange = [manager glyphRangeForTextContainer:container];
NSGlyph glyphArray[glyphRange.length];
NSUInteger glyphCount = [manager getGlyphs:glyphArray range:glyphRange];
[manager getGlyphs:glyphArray range:glyphRange];
// ---- Necesary
[path moveToPoint: NSMakePoint(0, 0)];
// STRANGE CHARACTERS
[path appendBezierPathWithGlyphs:glyphArray count:glyphCount inFont:selectedFont];
Does someone knows the explanation of this behavior ? Is there a solution to get the right path with these fonts ?