Can I control Font Substitution in Cocoa?
Can I control Font Substitution in Cocoa?
- Subject: Can I control Font Substitution in Cocoa?
- From: Andy <email@hidden>
- Date: Sun, 06 Jan 2002 14:49:42 -0500
Hi all,
It seems that Cocoa aggressively substitutes fonts, and I'd like to find
a way to control that - specifically, I'd like to turn it off.
I have a bunch of NSButtonCells, each of which displays a single
character in its title, and has a particular font. I'm going to great
lengths to try to determine if the font supports the character before
setting the title[*].
However, it is plain to see that sometimes my code is told a font does
encode a particular character, however, on screen, the character is
obviously being subsituted in from some other font.
I'd like to defeat this behaviour - I need to know if the font in
question actually supports the character. If it doesn't I don't want to
see a subsitute. From much time reading the docs, this seems to be fully
supported in MLTE, but I can't find any such feature in Cocoa.
If there's another option (eg, can I back an NSCell directly with my own
NSTextStorage rather than use setTitle: ? ) then I'd love to hear about
that too.
[*] (specifically, I have an NSLayoutManager I use to generate glyphs,
then I'm calling NSFont glyphIsEncoded for each character before trying
to use it - it works somewhat but its not very reliable)
--
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