Check hb_font_create return value

There are very few ways that hb_font_create can fail. It will do minimal
sanitization if the data begins with a known magic signature, but will
otherwise return a valid hb_font which more or less looks like a valid
font with no glyphs and upem of 1000. This appears to be the reason gfx
is only using hb_face_create_for_tables to avoid the issue where a
system font may be understood by FreeType and otherwise be valid, but
not recognized by HarfBuzz.

Keep the efficiency of hb_font_create when it can be used, but check if
the resulting hb_font has no glyphs. If it has no glyphs attempt to use
hb_face_create_for_tables instead.


Change-Id: Iaf82127152cdf6de160274234bcb19b5ccbccc1b
Reviewed-by: Herb Derby <>
Reviewed-by: Mike Reed <>
Commit-Queue: Ben Wagner <>
1 file changed