-
Notifications
You must be signed in to change notification settings - Fork 9
/
templateh.ps
117 lines (95 loc) · 1.56 KB
/
templateh.ps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/dim 30 def
/d1 dim def
/d2 dim 2 div def
/d3 dim 3 div def
/d4 dim 4 div def
/sc dim def
%radius of target
/r dim 4 div def
%radius of control
/rs dim 10 div def
%line width
/lw 0.02 dim mul def
%font size
%/fs 4 dim 8 div mul def
/fs d2 d4 2 div add def
/control{
d2 d2 neg rmoveto
currentpoint
gsave newpath rs 0 360 arc closepath lw setlinewidth 0 setgray fill grestore
d2 neg d2 rmoveto
}def
/target{
d2 d2 neg rmoveto
currentpoint
gsave newpath r 0 360 arc closepath lw setlinewidth stroke grestore
d2 neg d2 rmoveto
}def
/qwx{
/value exch def
%currentpoint
d2 d2 neg rmoveto
/s value value abs div def
0 value dim mul r s mul add neg rlineto
0 value dim mul r s mul add rmoveto
d2 neg d2 rmoveto
}def
/wire{
/value exch def
currentpoint
dim 0 rmoveto
0 d2 neg rmoveto
value dim mul 0 rlineto
value dim mul neg d2 rmoveto
moveto
}def
/measure{
/value exch def
currentpoint
0 d4 neg rmoveto
0 d2 neg rlineto
d4 2 div 0 rmoveto
0 d2 rlineto
d4 2 div d2 neg rmoveto
gsave
0 d4 4 div rmoveto
/Times-Italic fs selectfont
value show
grestore
d4 neg d2 rmoveto %from text
d4 neg d4 rmoveto %from lines
moveto
}def
/back{
currentpoint
dim neg add
exch pop
sc
exch
moveto
currentpoint
}def
/n{
0 qw
}def
/qw{
/value exch def
value 1 add dim mul 0 rmoveto
}def
/ket{
/value exch def
currentpoint
0 d4 neg rmoveto
0 d2 neg rlineto
d4 2 div 0 rmoveto
gsave
d4 6 div d4 4 div rmoveto
/Times-Italic fs selectfont
value show
grestore
d2 d2 rmoveto
d4 2 div d4 neg rlineto
d4 2 div neg d4 neg rlineto
moveto
}def
newpath