#include #include #define TEXTCYRILLICS "Здравей, свят!" #define TEXTASCII "Hello, world!" #define WIDTH 350 #define HEIGHT 50 #define STRIDE (WIDTH * 4) unsigned char image[STRIDE*HEIGHT]; int main (int argc, char **argv) { int i; cairo_surface_t *surface; cairo_t *cr; cairo_matrix_t matrix; double angle; surface = cairo_image_surface_create_for_data (image, CAIRO_FORMAT_ARGB32, WIDTH, HEIGHT, STRIDE); cr = cairo_create (surface); cairo_set_source_rgb (cr, 0., 0., 0.); cairo_select_font_face (cr, "serif", 0, 0); cairo_set_font_size (cr, 40); cairo_translate (cr, 40, 40); cairo_save (cr); if( argc > 1 && strcmp(argv[1], "ascii" ) == 0 ) { cairo_show_text (cr, TEXTASCII); } else { cairo_show_text (cr, TEXTCYRILLICS); } cairo_restore (cr); cairo_surface_write_to_png (surface, "text-cyrillics.png"); cairo_destroy (cr); cairo_surface_destroy (surface); return 0; }