Tizen 2.0 Release
[framework/graphics/cairo.git] / doc / tutorial / src / twin.c
1 /**
2  * Put this file in cairo/doc/tutorial/src and type "make"
3  */
4
5 #define WIDTH 1350
6 #define HEIGHT 900
7
8 #include "cairo-tutorial.h"
9
10
11 static void
12 draw (cairo_t *cr, int width, int height)
13 {
14     int i, j, h;
15     unsigned char s[2] = {0, 0};
16
17     /* clear background */
18     cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
19     cairo_paint (cr);
20
21     cairo_set_source_rgb (cr, 0, 0, 0);
22     cairo_select_font_face (cr,
23                             "@cairo:",
24                             CAIRO_FONT_SLANT_NORMAL,
25                             CAIRO_FONT_WEIGHT_NORMAL);
26
27     h = 2;
28     for (i = 8; i < 48; i >= 24 ? i+=3 : i++) {
29         cairo_set_font_size (cr, i);
30         for (j = 33; j < 128; j++) {
31             if (j == 33 || (j == 80 && i > 24)) {
32                 h += i + 2;
33                 cairo_move_to (cr, 10, h);
34             }
35             s[0] = j;
36             cairo_show_text (cr, (const char *) s);
37         }
38     }
39 }