How does the OS X font fallback system work

fontunicode

I'm trying to design a font containing symbols for internal use in our organisation.

I've created a font using this tutorial, and I've assigned a symbol to the unicode position 0xF600. This lies within the 'Private use area', and doesn't appear to have any fonts which are supplying it.

I've created my font and installed it. I've tried with the font in either ~/Library/Fonts or /System/Library/Fonts.

If I insert this character () in TextEdit or any system text box I get either a box or some kind of mark contained within a box. Either way, not my character.

If I manually set the font to my font, the character is displayed.

However, I notice that other characters don't work like this. If I'm using Helvetica, and I insert a Chinese character, the symbol is taken from a different font which can display that glyph. So clearly there's a mechanism to fallback to a font which contains the character.

Are some fonts blessed by the system? How would I get my font to be the fallback?

EDIT: I've tried clearing the font cache with sudo atsutil databases -remove, didn't affect it.

EDIT 2: After poking around a bit and doing some reading, there's a font called LastResort.ttf that is the final fallback for all the unicode characters, there must be a precedence set somewhere in the system, so that that is always last. I wonder where that is…

Best Answer

OS X normally will not display a character in the Private Use Area unless you manually set the font in the app. I understand this is intentional, since every font could have a different glyph at the same PUA code point, and it only makes sense to display something when the user specifies the font.

I think it should also work when the right font is selected via CSS or other markup in a document being read.

Some earlier versions of OS X did not have this "feature" and did display PUA stuff. I don't know how they chose which font to use when more than one had something at the code point selected.