warn for text as path being impossible without a font
[PyX.git] / manual / rects.py
blob39a5dcc82c651f8c6e7726514f8c268227607888
1 from pyx import *
3 c = canvas.canvas()
5 rect1 = path.path(path.moveto(0, 0), path.lineto(1, 0),
6 path.moveto(1, 0), path.lineto(1, 1),
7 path.moveto(1, 1), path.lineto(0, 1),
8 path.moveto(0, 1), path.lineto(0, 0))
10 rect2 = path.path(path.moveto(0, 0), path.lineto(0, 1),
11 path.lineto(1, 1), path.lineto(1, 0),
12 path.lineto(0, 0))
14 rect3 = path.path(path.moveto(0, 0), path.lineto(0, 1),
15 path.lineto(1, 1), path.lineto(1, 0),
16 path.closepath())
18 c.stroke(rect1, [trafo.scale(2), style.linewidth.THICK])
19 c.text(1, -0.7, "(a)", [text.halign.center])
21 c.stroke(rect2, [trafo.scale(2).translated(4, 0), style.linewidth.THICK])
22 c.text(5, -0.7, "(b)", [text.halign.center])
24 c.stroke(rect3, [trafo.scale(2).translated(8, 0), style.linewidth.THICK])
25 c.text(9, -0.7, "(c)", [text.halign.center])
27 c.stroke(rect3, [trafo.scale(2).translated(12, 0), style.linewidth.THICK, deco.filled([color.grey(0.5)])])
28 c.text(13, -0.7, "(d)", [text.halign.center])
30 c.writePDFfile()