determining availability of a given glyph via NSFont
determining availability of a given glyph via NSFont
- Subject: determining availability of a given glyph via NSFont
- From: email@hidden (Jody Fairchild)
- Date: Wed, 06 Feb 2002 20:15:20 +0900
i'm looking for the best and easiest way to determine whether a font can
display a given glyph ... nothing really fancy, right now i'm only
concerned with 7-bit ascii, but it would be cool if the method proved to be
generally robust and unicode-clean.
my search of the docs, etc. has not yet revealed much. there are methods
to determine whether a given glyph is "encoded" in a font, via both
(NSGlyph)number and (NSString)name, but they don't produce the results i
would expect when i test them against known cases.
the description for [NSFont glyphWithName:] in particular contains this
understandable but somewhat frustrating note, "Glyph names in fonts do not
always accurately identify the glyph. If possible, look up the appropriate
glyph on your own."
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?
so, long story somewhat shorter, thanks to the list, searching through my
archives (vol 2, #63 for digest fans), i found this:
>
Message: 15
>
Date: Wed, 23 Jan 2002 20:14:05 +0100
>
Subject: Re: NSGlyph is still a puzzle
>
From: email@hidden
>
>
[deletia]
>
>
Would there be any harm if Apple exposed and documented -[NSFont
>
_rawDefaultGlyphForChar:] which AFAIK just does the lookup of a NSGlyph
>
in a font instance and returns 0 if there is none ?
cool! i tried this and it seems to work for my purposes so far, but ...
of course it's "undocumented", which makes me a little uneasy, and it
generates compile-time warnings about how "`NSFont' does not respond to
`_rawDefaultGlyphForChar:'" ... so my questions are:
1) is there anything better that i should be using instead?
2) are there any real reasons _not_ to use _rawDefaultGlyphForChar:?
3) an easy way to get rid of the warnings?
thanks,
-jf
_______________________________________________
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.