File: opussps.mf

package info (click to toggle)
opustex 0.84-3
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 1,916 kB
  • ctags: 240
  • sloc: ansic: 1,221; perl: 504; sh: 121; makefile: 62
file content (221 lines) | stat: -rw-r--r-- 5,437 bytes parent folder | download | duplicates (4)
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
%% This file is part of the OpusTeX system.
%% You are not allowed to change this file.
%% For distribution see the copyright notice in 00readme.txt

font_identifier := "opus_special_symbols";

% Here are two types of pianobrackets available, they are absolute compatible,
% so choose this one you prefer (search for '%!!!')

% free pos: 0,

mode_setup;

font_size 20pt#;

nhh#:=5pt#;
nhw#:=6pt#;

qqs#=.4pt#; %width of lines

thin#:=1/50designsize;
med#:=1/33designsize;
thick#:=1/16designsize;

thinwidth:=0.125pt;

define_pixels(nhh,nhw);
define_blacker_pixels(thin,med,thick);

qqs:=ceiling(qqs#*hppp); % the way rule widths are calculated

pair sw;
sw = down+left;

path p;
picture pic;

pen line_pen, thin_pen;
thin_pen:= pencircle scaled thin;
line_pen:= pencircle scaled qqs;

def med_ = max(1, med) enddef;

%%%%%%%
message ("<guitar chords>");
%%%%%%%

def tabulatur (expr nd)=
  u:=1/5w;
  x1=x2=y2=y3=0; x3=w; y1=-nd;
  fill unitsquare xscaled (w+2thinwidth) yscaled (med+.2pt)
       shifted(-thinwidth,0);
  pickup pencircle scaled max(1,.2pt+blacker);
  for v=1 upto 5 :
    draw (z2--z3) shifted (0,v*-u);
  endfor;

  for v=0 upto 5 :
    draw (z1--z2) shifted (v*u,0);
  endfor;
  labels (1,2,3);
enddef;

beginchar(1, 3nhw#, 0, 0);" small grid";
  tabulatur (108/25nhh);
endchar;

beginchar(2, 3/2nhw#, 0, 0); " small dot";
  fill fullcircle scaled .54nhh shifted (w,-.36nhh);
endchar;

beginchar(3, 3nhw#, 0, 0); " small bar";
  fill unitsquare xscaled w yscaled .24nhh shifted (0,-.48nhh);
endchar;

beginchar(4, 3/5nhw#, 0, 0); " small circle";
  x1l=.1w; x2=x4=.5w; x3l=.9w;
  y1=y3=.51nhh; y2=.22nhh; y4=.8nhh;
  penpos1(med, 0);
  penpos2(thinwidth,90);
  penpos3(med,180);
  penpos4(thinwidth, 270);
  penstroke z1e..z2e..z3e..z4e..cycle;
  pickup pencircle; draw z1..z2..z3..z4..cycle;
endchar;

beginchar(5, 3/5nhw#, 0, 0); " small cross";
  x1=x3=.2w; x2=x4=.8w;
  y1=y4=.29nhh; y2=y3=.725nhh;
  pickup pencircle scaled med;
  draw z1--z2; draw z3--z4;
  labels (1,2,3,4);
endchar;

% the next seems to be senseless, but it isn't

beginchar(6, 3/5nhw#, 0, 0); " small blank";
endchar;

%%%%%%%
message ("<circles>");
%%%%%%%

for n:=1 upto 12:
  beginchar(8+n-1, 0, 0, 0);
  " fullcircle diameter "&decimal ((n+2)*2)&"pt";
    diameter:=(n+2)*2pt;
    pickup line_pen;
    draw fullcircle scaled diameter;
  endchar;
endfor;

%%%%%%%
message ("<glissandi-elements>");
%%%%%%%

def glissando (expr theta)=
  x1=-1; y1=0; z2=z1+(.5nhw,0); z3=z1+(nhw+1,0);
  p:= z1{1.25up+right}..{1.25down+right}z2{1.25down+right}..{1.25up+right}z3;
  pickup penrazor scaled (.075nhw+thick) rotated (theta+65);
  draw p rotated theta;
  labels (1,2,3);
enddef;

for slope=1 upto 8:

  beginchar(20+slope-1, (cosd(10slope))*nhw#,(sind(10slope))*nhw#, 0);
  " glissando element slope "&decimal (10slope)&" degree";
    glissando (10slope);
    pic:= currentpicture;
  endchar;

  beginchar(28+slope-1, (cosd(10slope))*nhw#, (sind(10slope))*nhw#, 0);
  " glissando element slope "&decimal (-10slope)&" degree";
    currentpicture:= pic reflectedabout (origin, right);
  endchar;

endfor;

%%%%%%%
message ("<sinuous lines>");
%%%%%%%

for n:=5 upto 15+5:
  beginchar(36+n-5, 0, 0, 0); " sinuous line height"&decimal(2*n)&"pt";
    v:=n*pt; u:=.5v;
    x1=x5+max(.4pt,.1u); y1=x4=y5=0; x2=.44u; y2=-.18v; x3=.2u; y3=-.25v;
    y4=-.1v; x5=.05u; x6=u-x1; y6=v; x7=u-x2; y7=v-y2; x8=u-x3; y8=v-y3;
    x9=u; y9=v-y4; x10=u-x5; y10=y6;
    fill z1{z1-z10}..{right}z2--z2..z3..z4..{z6-z5}z5
         ..z6{z6-z5}..{left}z7--z7..z8..z9..{z1-z10}z10..cycle;
    labels(range 1 thru 10);
  endchar;
endfor;

%%%%%%%
message ("<piano brackets>");
%%%%%%%

% lastbrace is adjustable

firstbrace:=20;  % smallest brace is 2*20 pt (\simeq 14mm)
lastbrace:=67;   % largest brace is 2*67 pt (\simeq 47mm)

%%% from Stanislav Kneifl

def drawpianobracket (expr height) =
  u# := 1nhh#/5pt# * 1pt#;
  v# := (height/40) * 1pt#;
  define_pixels (u, v);
  beginchar (height-firstbrace+52, 0, 0, 0);
  " brace height "&decimal round(2height*pt#)&"pt";
    z1 = origin;
    z2 = (4.7u, 7v);
    z3 = (3.6u, 16.5v);
    z4 = (1.9u, 25v);
    z5 = (2.28u, 32v);
    z6 = (1.25nhh, 40v);
    penpos1 (max(1,0.1u), 125);
    penpos2 (1.2u, 180);
    penpos3 (3.2u, 195);
    penpos4 (2.5u, 180);
    penpos5 (1.14u, 180);
    penpos6 (max(2,0.3u), 150);
    penstroke z1e{dir 35}..z2e..z3e..z4e..z5e..{dir 60}z6e;
    addto currentpicture also currentpicture reflectedabout (origin, right);
    currentpicture:=currentpicture shifted (round(-1.75nhh), 0);
  endchar;
enddef;

def bigbrace (expr height) =
  beginchar (height-firstbrace+52, 0, 0, 0);
  " brace height "&decimal round(2height*pt#)&"pt";
    v:=height*pt;
    u:=max(.1v,3.25pt);
    u:=min(u,6.5pt);
    actwidth:=.035v;
    x1=.25nhw; y1=v;
    x2l=-.8u;  y2=2/3v;
    x3r=.2u;   y3=1/3v;
    x4=-u;     y4=0;
    penpos1(max(1,.25pt),-35);
    penpos2(1.5med+actwidth,40);
    penpos3(1.75med+actwidth,45);
    penpos4(max(1,.2pt),-90);
    penstroke z1e..z2e..z3e..{left+sw}z4e;
    currentpen:= pencircle; draw z1..z2..z3..{left+sw}z4;
    addto currentpicture also currentpicture reflectedabout (origin, right);
    penlabels(1,2,3,4);
    currentpicture:= currentpicture shifted (round(-.75nhh), 0);
  endchar;
enddef;

%!!! comment the line 'bigbrace' and uncomment the line 'drawpianobracket'

for v=firstbrace upto lastbrace :
  bigbrace (v);
%  drawpianobracket (v);
endfor;

end