remove tex-filename test, as this creates trouble on MiKTeX where long absolute paths...
[PyX/mjg.git] / manual / pathstyles.py
blobff394528da4e189526a1d1f02c1ac60e62ab30fc
1 #!/usr/bin/env python
2 import sys
3 sys.path[:0] = [".."]
4 from pyx import *
6 text.set(mode="latex")
7 text.preamble(r"\renewcommand{\familydefault}{\ttdefault}")
8 c = canvas.canvas()
10 # positioning is quite ugly ... but it works at the moment
11 x = 0
12 y = 0
13 dx = 6
14 dy = -0.65
15 length = 0.8
17 def drawstyle(name, showpath=0, default=0):
18 global x,y
19 p = path.path(path.moveto(x + 0.1, y+0.1 ),
20 path.rlineto(length/2.0, 0.3),
21 path.rlineto(length/2.0, -0.3))
22 c.stroke(p, [style.linewidth.THIck, eval("style."+name)])
23 if showpath:
24 c.stroke(p, [style.linewidth.Thin, color.gray.white])
25 if default:
26 name = name + r"\rm\quad (default)"
27 c.text(x + 1.5, y + 0.15, name, [text.size.footnotesize])
28 y += dy
29 if y < -16:
30 y = 0
31 x += dx
34 drawstyle("linecap.butt", showpath=1, default=1)
35 drawstyle("linecap.round", showpath=1)
36 drawstyle("linecap.square", showpath=1)
38 y += dy
40 drawstyle("linejoin.miter", showpath=1, default=1)
41 drawstyle("linejoin.round", showpath=1)
42 drawstyle("linejoin.bevel", showpath=1)
44 y += dy
46 drawstyle("linestyle.solid", default=1)
47 drawstyle("linestyle.dashed")
48 drawstyle("linestyle.dotted")
49 drawstyle("linestyle.dashdotted")
51 y += dy
53 drawstyle("linewidth.THIN")
54 drawstyle("linewidth.THIn")
55 drawstyle("linewidth.THin")
56 drawstyle("linewidth.Thin")
57 drawstyle("linewidth.thin")
58 drawstyle("linewidth.normal", default=1)
59 drawstyle("linewidth.thick")
60 drawstyle("linewidth.Thick")
61 drawstyle("linewidth.THick")
62 drawstyle("linewidth.THIck")
63 drawstyle("linewidth.THICk")
64 drawstyle("linewidth.THICK")
66 drawstyle("miterlimit.lessthan180deg", showpath=1)
67 drawstyle("miterlimit.lessthan90deg", showpath=1)
68 drawstyle("miterlimit.lessthan60deg", showpath=1)
69 drawstyle("miterlimit.lessthan45deg", showpath=1)
70 drawstyle("miterlimit.lessthan11deg", showpath=1, default=1)
72 y += dy
74 drawstyle("dash((1, 1, 2, 2, 3, 3), 0)")
75 drawstyle("dash((1, 1, 2, 2, 3, 3), 1)")
76 drawstyle("dash((1, 2, 3), 2)")
77 drawstyle("dash((1, 2, 3), 3)")
78 drawstyle("dash((1, 2, 3), 4)")
79 drawstyle("dash((1, 2, 3), rellengths=1)")
82 c.writeEPSfile("pathstyles")
83 c.writePDFfile("pathstyles")