Re: determining availability of a given glyph via NSFont
Re: determining availability of a given glyph via NSFont
- Subject: Re: determining availability of a given glyph via NSFont
- From: Douglas Davidson <email@hidden>
- Date: Wed, 6 Feb 2002 09:52:23 -0800
On Wednesday, February 6, 2002, at 03:15 AM, Jody Fairchild wrote:
ok ... well how does one go about doing that? i'm not looking for an
answer like, "rip the font apart with hexdump and ...", there's got to
be
something easier. it's axiomatic that there must be some easily
accessable mapping somewhere between the raw numeric value of a
character
in a string and the glyph in the font used to display it. moreover,
there
must also be something internal very close to what i want, or else how
would [NSMutableAttributedString fixFontAttributeInRange:] work?
Well, no, it's not axiomatic. The mapping from characters to glyphs is
not simple and it's not one-to-one. However, I think you may have
answered your own question--if you want to determine whether a
particular string of characters can be represented using a particular
font, fixFontAttributeInRange: will tell you. I say a string of
characters rather than a single character, because the question does
depend on context; for example, there are some characters that do not
stand on their own at all. If you then want to determine what glyphs
they actually map to, NSLayoutManager's glyphAtIndex: will tell you, and
glyphRangeForCharacterRange:actualCharacterRange: and
characterRangeForGlyphRange:actualGlyphRange: will describe which
character(s) map to which glyph(s).
Non-public methods are not public for a reason: they may behave in
peculiar ways, they may have strict requirements and unpredictable
results, and furthermore they may change without warning from release to
release.
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.