Doesn't always use the notdef glyph for missing glyph in TTF font #79
Description
In a TTF font, ttfunk doesn't seem to always use the notdef glyph when a glyph cannot be found.
This is a tricky bug to reproduce because it largely depends on what other characters are present and what glyphs the font provides. For certain fonts, when certain combinations of characters are used, the notdef glyph gets replaced with what appears to be a random glyph.
Here's an example that uses a font in the prawn data folder:
Prawn::Document.generate 'out.pdf' do
def register_font data
font_families.update(data.each_with_object({}) do |(key, val), accum|
accum[key.to_s] = val
end)
end
register_font Custom: { normal: 'PRAWN_DIR/data/fonts/Dustismo_Roman.ttf' }
font 'Custom' do
text "ĂĄǺ\u0200\u0202ÆǼĆÇĈĊČĎĐÐḌDZDzDŽDžÈÉÊËĒĔĖĘẼĚẸ\u0204\u0206ƏǴĜĞĠĢĤĦḤĬÌÍÎÏİĨĪĮỊ\u0208\u020aĹ"
end
end
In the generated PDF, we see an "L" in the position of the second to last character. If you copy that and paste it into an editor, you'll see the correct glyph. (See https://www.fileformat.info/info/unicode/char/020a/index.htm). So the problem appears to be what's being displayed from the font, not the text that's stored.