NSAttributedString から個々の文字のグリフを取得してから、NSBezierPath を取得しappendBezierPathWithGlyphs:count:inFont:
、最終的に平坦化されたパス ポイントを NSArray に出力して (以下のコードを参照)、Quartz Composer で OpenGL を使用して表示します。
標準フォント (American Typewriter、Baskerville など) を含む一部の NSFont では、文字が完全に間違っています(下の画像を参照)。
私はフランス語のキーボードと言語で作業していると言うことが重要かもしれません。
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];
誰かがこの動作の説明を知っていますか? これらのフォントで正しいパスを取得する解決策はありますか?