[cairo] Why would cairo_font/text_extents() return blank?

Marco Quezada mellamanjefe at gmail.com
Mon Nov 19 11:29:02 PST 2012

I am debuggin some code given to me that is using cairo as its graphics
drawing context with a xlib surface. The code crashed at a line that
divides a number by the font x_advance except that this number is 0.

I have a valid cairo_context instantiated and drawing to it works. I can
also call cairo_get_font_face() passing the same valid cairo context and I
get what looks like valid memory back (my cairo does not have debugging
information built in so I can't look into the cairo_font_face_t pointer).

If I call cairo_font/text_extents() right after the context is instantiated
I get good looking values (non are zero). Then some more initialization of
the application goes on and finally I call cairo_font/text_extents later on
and the values in the returned extents are all zero. Is it possible to
"unset" the font in cairo? What else might cause this behavior? At the
point where the code returns the zeroed extents I tried getting the font
matrix and the application segfaulted. I don't know if that is relevant to
my problem or not, I was using it to try and debug my problem.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20121119/5506b051/attachment.html>

More information about the cairo mailing list