How to work out if a font supports a character?
How to work out if a font supports a character?
- Subject: How to work out if a font supports a character?
- From: Andy <email@hidden>
- Date: Mon, 31 Dec 2001 20:21:13 -0500
I'm making good progress with my font inspection app - still haven't
solved any of the problems I wrote about the other day, so I'm just
displaying "Unknown" for the cases where I can't get Carbon to talk to Cocoa.
I also filed bugs on the NSFont methods which return garbage or useless values.
Speaking of which, I'm trying to work out how I can know which
characters in a font are valid.
eg, this code:
m_illegal = [[NSCharacterSet illegalCharacterSet] retain];
followed by the test:
[m_illegal characterIsMember: currentChar[0]]
Allows me to determine if the contents of currentChar[0] is just plain
"out of range" for Unicode (2.0, according to the docs).
*but* that doesn't tell me if a particular font supports the glyph at a
given index. ie, the index is a valid unichar, so it passes the
illegalCharacterSet test above, but the font is missing that glyph.
I assumed
[m_currentFont glyphIsEncoded: currentChar[0]]
would answer that question, but it appears to *always* return YES for
everything I've thrown at it so far (that passes the illegalCharacterSet
test) :(
Again, am I missing something or does this stuff have really serious bugs?
--
AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside
I think we finally found the killer app for Flash: animated stick men