I have a basic understanding of fonts and encoding, but recently I had to do something outside of my comfort zone: Turn the character ✖ (0x2716
"heavy multiplication x") into a CGPathRef
.
I used Core Text's CTFontGetGlyphsForCharacters
to accomplish this job. I understand that a CGGlyph
is effectively an index into the set of glyphs supported by the given font. I soon discovered that this glyph is only supported by a very few fonts on iOS, including Zapf Dingbats, which is the one I chose.
Here's my question: I can use ✖ in any font, simply pasting it in. I did a little experiment in Pages where I pasted ✖ into a document, selected it, and then continually changed the font. I did a similar programmatic experiment. The glyph always displayed properly (and never changed). If very few of these fonts has ✖, how does this work? Is there some set of "fallback glyphs" (which I guess would be a "fallback font") if a given font doesn't have such a symbol? If so, is there any way to get programmatic access to these glyphs?