- (NSBezierPath *) makePathFromString: (NSString *) string forFont: (NSFont *) font { NSTextView *textview; textview = [[NSTextView alloc] init]; [textview setString: string]; [textview setFont: font]; NSLayoutManager *layoutManager; layoutManager = [textview layoutManager]; NSRange range; range = [layoutManager glyphRangeForCharacterRange: NSMakeRange (0, [string length]) actualCharacterRange: NULL]; NSGlyph *glyphs; glyphs = (NSGlyph *) malloc (sizeof(NSGlyph) * (range.length * 2)); [layoutManager getGlyphs: glyphs range: range]; NSBezierPath *path; path = [NSBezierPath bezierPath]; [path moveToPoint: NSMakePoint (20.0, 20.0)]; [path appendBezierPathWithGlyphs: glyphs count: range.length inFont: font]; free (glyphs); [textview release]; return (path); } // makePathFromString