#include #include #include int main(int argc, char *argv[]) { gchar *text = (argc > 1 ? argv[1] : "Text and an empty line\n"); cairo_surface_t *surface; cairo_t *cr; PangoLayout *layout; PangoLanguage *language; PangoFontDescription *font; setlocale(LC_ALL, NULL); g_type_init(); surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 100); cr = cairo_create(surface); cairo_set_source_rgb(cr, 1, 1, 1); cairo_rectangle(cr, 0, 0, 100, 100); cairo_fill(cr); layout = pango_cairo_create_layout(cr); language = pango_language_from_string("de-de"); // pango_context_set_language(pango_layout_get_context(layout), language); font = pango_font_description_from_string("sans italic bold 20"); pango_layout_set_font_description(layout, font); pango_font_description_free(font); pango_layout_set_width(layout, 100 * PANGO_SCALE); pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); pango_layout_set_text(layout, text, -1); cairo_set_source_rgb(cr, 0, 0, 0); pango_cairo_show_layout(cr, layout); g_object_unref(G_OBJECT(layout)); cairo_destroy(cr); cairo_surface_write_to_png(surface, "pango-empty.png"); cairo_surface_destroy(surface); return 0; }