Re: Getting glyphs and their outlines
Re: Getting glyphs and their outlines
- Subject: Re: Getting glyphs and their outlines
- From: Douglas Davidson <email@hidden>
- Date: Mon, 29 Mar 2004 10:27:46 -0800
On Mar 29, 2004, at 9:01 AM, Steve Sims wrote:
Of course outline graphics are represented as NSBezierPath objects.
Getting outlines the ATSUICurveAccessDemo way would seem to be a
virtual duplication of NSBezierPath's
appendBezierPathWithGlyph:inFont: call and I hate to reinvent the
wheel. The only problem is this call takes an NSGlyph, and I can't
see how to get the glyph for a particular character. I've looked
everywhere I can think this would be, like NSGlyph, NSFont, NSString,
etc., but haven't found it. I'm probably overlooking the obvious...
So my question is simply how do I, in a Cocoa-friendly manner, get a
glyph for a single character?
The problem is that there isn't necessarily a single glyph for a single
character. Glyphs are generated for text in context, and depending on
the font the mapping from characters to glyphs may be simple or
complex. Multiple characters may map to a single glyph, or a single
character to multiple glyphs. The AppKit has a class, NSLayoutManager,
that is designed to handle all of this complexity for you, and to
generate glyphs for arbitrary text. The CircleView example isn't
directly aimed at what you're doing, but it shows how to set up a
layout manager and its associated machinery; once you have that, it is
simple to obtain the glyphs from the layout manager.
Douglas Davidson
_______________________________________________
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.