• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting glyphs and their outlines
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting glyphs and their outlines


  • Subject: Re: Getting glyphs and their outlines
  • From: John Labovitz <email@hidden>
  • Date: Mon, 5 Apr 2004 21:32:22 -0700

On Mar 29, 2004, at 9:01 AM, Steve Sims wrote:

I want to do something that I feel is fairly simple, namely get a glyph for a character in a particular font, and then grab its outline.

(Sorry to respond late, but I'm behind on the mailing list.)

I just did this yesterday, when I wrote my first screensaver. Here's more or less what I did (consolidated from several methods, so I may have typos):

// get the glyph for the "g" character from Helvetica

NSFont *font = [NSFont fontWithName:@"Helvetica" size:100.0];
NSGlyph glyph = [font glyphWithName:@"g"];

// render the glyph into a bezier path

NSBezierPath *path = [NSBezierPath bezierPath];
[path moveToPoint:NSMakePoint(0, 0)];
[path appendBezierPathWithGlyph:glyph inFont:font];

// go through each point in the path (if you need to)

for (i = 0; i < [path elementCount]; i++) {
NSBezierPathElement elemType;
NSPoint points[3];

elemType = [path elementAtIndex:i associatedPoints:points];

// look at the point -- see docs for above call for details
}

Hope this helps.

--
John Labovitz Consulting, LLC
http://mac.johnlabovitz.com
email@hidden
+1 503.949.3492
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Getting glyphs and their outlines
      • From: Steve Sims <email@hidden>
  • Prev by Date: Localized nib will only load english
  • Next by Date: Re: Localized nib will only load english
  • Previous by thread: Re: Localized nib will only load english
  • Next by thread: Re: Getting glyphs and their outlines
  • Index(es):
    • Date
    • Thread