[cairo] Unable to view Pango Cairo Layout

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Fri Jun 26 05:12:28 PDT 2009


On Fri, 26 Jun 2009, Rabia Sirhindi wrote:

> I am working on pango and using cairo as a rendering backend. I wrote a
> small program using some pango-cairo layout functions. The problem is that
> even when I am able to compile the program successfully on an FC5 machine,
> it does not show anything on screen. below is the code.

[snip code]

>         cairo_surface_t  *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,0,0);

This line creates an image surface without any width or height.  An 
image surface represents an array of pixels in memory only and it is 
never displayed by cairo onto a screen or window.  You probably want a 
platform specific surface such as an xlib surface or something 
similar.  For example, GDK has a gdk_cairo_create() function to create 
a cairo context for a window.  Alternately, you could use 
cairo_surface_write_to_png() at the end of your code and use an image 
viewer to display the rendered results.

Cheers,

Joonas


More information about the cairo mailing list