0

Possible Duplicate:
How to use glyph from Apple Symbols font?

I need to draw glyph with name "gid5002" from Apple Symbols font in NSImage. This glyph hasn't unicode representation, so it's seems impossible to construct string that contains it. I try:

NSFont* font = [NSFont fontWithName:@"Apple Symbols" size:12.0];
NSGlyph glyph = [font glyphWithName:@"gid5002"]

so, now I have that glyph. What next? I think I can't use NSLayoutManager because lack of unicode representation

Community
  • 1
  • 1
darvin
  • 529
  • 5
  • 17

1 Answers1

5

Construct an NSBezierPath with the outline of the glyph, and then fill/stroke the path into your graphics context.

NSFont *font = [NSFont fontWithName:@"Apple Symbols" size:12.0];
NSBezierPath *path = [NSBezierPath bezierPath];
[path appendBezierPathWithGlyph:[font glyphWithName:@"gid5002"]
                         inFont:font];
// ...
[path stroke];
一二三
  • 21,059
  • 11
  • 65
  • 74