tags:

views:

49

answers:

1

There is a class of fonts called Pi fonts whose glyphs, under OS X, get mapped to the private Unicode space 0xF021-0xF0FF such that if you subtract 0xF000 from each unicode character to retrieve the 8-bit version of the character and be able to draw that character as if it were a standard Roman character.

My question is how do I recognize these fonts? It's obvious the system can do so because there is a category on the Special Characters palette called "Pi Fonts" which apparently has the various such fonts installed on my system. In my case they are BookshelSymbolSeven, MSReferenceSpeciality, MT-Extras, Marlett, MonotypeSorts, Webdings, and various Wingdings. If I use the old fashioned QuickDraw routines to ask for the TextEncoding of these fonts, I get a value of 0x20000 which I do not see in the system header file TextCommon.h. Am I supposed to treat any font with a TextEncoding of 0x20000 as a Pi Font? And I'd rather not use any QuickDraw font handling routines for obvious reasons.

A: 

The closest thing I know is NSSymbolicTraits called NSFontSymbolicClass of NSFontDescriptor. The code

NSFontDescriptor*fontDesc=[NSFontDescriptor fontDescriptorWithFontAttributes:nil]; 
fontDesc=[fontDesc fontDescriptorWithSymbolicTraits:NSFontSymbolicClass];
NSArray*foo=[fontDesc matchingFontDescriptorsWithMandatoryKeys:[NSSet setWithObject:NSFontTraitsAttribute]];
NSLog(@"%@",foo);

gives me a list of Pi fonts + Braille + a bit more.

Yuji
Nope, some of the fonts like "Apple Symbols" are not Pi fonts I don't think as they do not render their symbols from their 8-bit representaions. Apple Symbols also returns a Text Encoding of 0x20000 so that blows my idea that I can rely on that.
Glenn Howes