[cairo] Unable to view Pango Cairo Layout
Rabia Sirhindi
rabia.sirhindi at nu.edu.pk
Fri Jun 26 04:48:59 PDT 2009
Hi,
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.
#include <pango/pango.h>
#include <pango/pangocairo.h>
//#include <cairo/cairo.h>
#define FONT "Sans Bold 20"
int main (int argc, char *argv[]){
PangoFontMap *fontmap;
PangoContext *context;
PangoLayout *layout;
PangoFontDescription *font_desc;
const char * text = "Display text in Arabic
\330\247\331\204\330\263\331\204\330\271\331\204\331\212\331\203\331\205\n";
cairo_surface_t *surface =
cairo_image_surface_create(CAIRO_FORMAT_ARGB32,0,0);
cairo_t *cr = cairo_create (surface);
cairo_set_source_rgb (cr,0.0,0.0,0.0);
font_desc = pango_font_description_from_string(FONT);
//fontmap = pango_cairo_font_map_get_default();
//context = pango_cairo_font_map_create_context((PangoCairoFontMap
*)fontmap);
layout = pango_cairo_create_layout(cr);
pango_layout_set_text (layout, text, -1);
pango_layout_set_font_description (layout, font_desc);
pango_font_description_free(font_desc);
pango_cairo_show_layout(cr,layout);
g_print("Last line!");
return 0;
}
Can anyone point out what am I missing? Thanks in advance.
--
Regards,
Rabia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20090626/57457b3b/attachment.htm
More information about the cairo
mailing list