If Cairo tries to write text on a system without any fonts installed, it produces an "out of memory" error. I installed Cairo on a minimal FreeBSD jail without fonts and tried to use cairo_show_text to write some text (this was a mistake, obviously). The text didn't appear and Cairo stopped drawing anything at all after the text. I checked what was happening using the "cairo_status" of the "cairo_t" and found it had an "out of memory" error. Since I was running the program OK on the same system outside the jail, I was sure there was no problem with memory. Stepping through the program with a debugger, I found that the "out of memory" error was produced when cairo called "FcFontMatch" on line 1697 of cairo-ft-font.c.
Thanks for the bug report, it reminded that one of the arguments for including a builtin font was precisely so we could fallback and always show text (even if it was completely the wrong font!) The fix is relatively easy for 1.9, but requires a fair bit more backporting for 1.8. I'm not sure the necessity justifies the extra risk. commit d3330d7beba0e0d2543e40a0e0e4d81ea9a78b45 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Jun 19 11:15:30 2009 +0100 [ft] Substitute twin if there are no fonts Fixes bug 22356 -- Spurious "out of memory" error on system without fonts https://bugs.freedesktop.org/show_bug.cgi?id=22356 If FcFontMatch() fails, then it means that there are no fonts available on the system (or it may have been a malloc error, we have no way of telling). Instead of report NO_MEMORY and disabling all drawing, one of the rationales for including a builtin font was so that we could continue even in the face of this error and show *something* to the user. (This being a last resort (and especially important for demos!) and hopefully easier to diagnose than no output at all.)
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.