Debian Codegraph @

examples/cairo_snippets/snippets/glyph_path.py

raw symbols SCIP
1 import cairo
2
3
4 def draw(cr, width, height):
5 cr.scale(width, height)
6 cr.set_line_width(0.04)
7
8 cr.select_font_face("Sans", cairo.FONT_SLANT_NORMAL,
9 cairo.FONT_WEIGHT_NORMAL)
10 # draw 0.16 glyphs in 0.20 squares, at (0.02, 0.04) from left corner
11 cr.set_font_size(0.16)
12
13 glyphs = []
14 index = 20
15 for y in range(5):
16 for x in range(5):
17 glyphs.append((index, x / 5.0 + 0.02, y / 5.0 + 0.16))
18 index += 1
19
20 cr.glyph_path(glyphs)
21 cr.set_source_rgb(0.5, 0.5, 1.0)
22 cr.fill_preserve()
23 cr.set_source_rgb(0, 0, 0)
24 cr.set_line_width(0.005)
25 cr.stroke()