summaryrefslogtreecommitdiff
path: root/fonts/musixtex-fonts/source/xadfgen.mf
blob: 51a5375374f48d59211bfdcdb5e255a375fb61c2 (plain)
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% basic def's -- taken from musixgen.mf     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

pair pone, ptwo;
transform t;
path p;

hlthick=.2pt;
lthick=.4pt;

pen line_pen, med_pen, coda_pen, thin_pen;
med_pen:= pencircle scaled med;
line_pen:= pencircle scaled lthick;
coda_pen:= pencircle xscaled 1.25thick yscaled max(1,.75med);
%thin_pen:= pencircle scaled max(1,.25pt);
thin_pen:= pencircle scaled max(1,.4pt);

apog_fact=.75;
apog_nhw#=apog_fact*nhw#;

picture save_pic, elem_pic;

def savepic = save_pic:= currentpicture enddef;
def save_elempic = elem_pic:= currentpicture enddef;
def callpic = currentpicture:= save_pic enddef;

def mirror (expr pone, ptwo) =
  currentpicture:=currentpicture reflectedabout(round(pone),round(ptwo))
enddef;

def add_mirror (expr pone, ptwo) =
  addto currentpicture also currentpicture
        reflectedabout (round(pone), round(ptwo))
enddef;

def call_mirror (expr pone, ptwo) = callpic; mirror (pone, ptwo) enddef;

def add_shift (expr pone, ptwo) =
  addto currentpicture also currentpicture shifted (pone, ptwo)
enddef;

def call_add_shift (expr pone, ptwo) =
  callpic; add_shift (pone, ptwo)
enddef;

def add_elempic (expr pone, ptwo) =
  addto currentpicture also elem_pic shifted (pone, ptwo)
enddef;

def call_add_save_elempic (expr pone, ptwo) =
  callpic; add_elempic(pone, ptwo); savepic
enddef;

def shift_pic (expr pone, ptwo) =
  currentpicture:=currentpicture shifted (round(pone),round(ptwo))
enddef;

def fill_circle (expr diameter, zshift) =
  fill fullcircle scaled diameter shifted zshift
enddef;

def fill_square (expr xwidth, ywidth, zshift) =
  fill unitsquare xscaled xwidth yscaled ywidth shifted zshift
enddef;

%

def staff=
  for i=0 upto 4:
    pickup pencircle yscaled lthick;
    draw (-5nhw,i*nhh)--(5nhw,i*nhh);
  endfor
enddef;

def Staff=
  for i=0 upto 4:
    pickup pencircle yscaled lthick;
    draw (-5nhw,(i*nhh-.5nhh))--(5nhw,(i*nhh-.5nhh));
  endfor
enddef;

def upstem=
  fill_square (lthick, 5nhh, (0,-5nhh))
enddef;

def downstem=
  fill_square (lthick, 5nhh, (nhw-hlthick,0))
enddef;



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% character definitions      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% so-called Miyoshi accent ...something like <>
% (give me the true name of this!)
%
beginchar(30, 0, 2.25nhh#, 0); "upper Miyoshi accent";
  pickup med_pen;
  draw (.15nhw, 1.9nhh)--(1.15nhw, 1.5nhh)--(.15nhw, 1.1nhh);
  add_mirror (origin, down);
  shift_pic (.5nhw, 0);
  savepic;
endchar;

beginchar(31, 0, 0, 2.25nhh#); "lower Miyoshi accent";
  call_mirror (origin, right);
endchar;

%
% size-balanced (a little large) sforzato
%
beginchar(20, 0, 2.25nhh#, 0); "upper sforzato (size-balanced)";
  x1=-.05nhw; x2=.5nhw; x3=nhw-x1; x3=x4+.28nhw; x6=x1+med;
  y1=y6=y4=y3=nhh; y2=y1+1.4nhh;
  z5-z6=whatever*(z2-z1);
  z5-z4=whatever*(z2-z3);
  fill z1--z2--z3--z4--z5--z6--cycle;
  savepic;
endchar;

beginchar(21, 0, 0, 2.25nhh#); "lower sforzato (size-balanced)";
  call_mirror (origin, right);
endchar;

%
% coda with serif
%
beginchar(85, 0, 3.25nhh#, 0); "coda with serif";
  mh:=3nhh;
  x2 = 2nhw-x4 = 1/6mh; y2 = y4 = 1/2mh;
  x3 = x5 = nhw; y3 = mh-y5 = 5/6mh;
%  pickup thin_pen;
  pickup thin_pen;
  draw (0,mh/2)--(2nhw,mh/2);
  draw (nhw-.3nhw,0 )--(nhw+.3nhw,0 );
  draw (nhw-.3nhw,mh)--(nhw+.3nhw,mh);
  draw (nhw,0)--(nhw,mh);
  draw (0   ,mh/2-.3nhw)--(0   ,mh/2+.3nhw);
  draw (2nhw,mh/2-.3nhw)--(2nhw,mh/2+.3nhw);
  savepic;
  pickup coda_pen;
  draw z2..z3..z4..z5..cycle;
  shift_pic (-nhw, 0);
  labels (1,2,3,4);
endchar;

%
% upright segno
%
beginchar(86, 0, 3.25nhh#, 0); "upright segno";
  x1:= 0; y1:=0;
  x4:=-.69nhw; y4:=y1;
  x5:=.36nhw;  y5:=.9nhh;
  x6:=-.28nhw; y6:=.97nhh;
  x7:=-x5;  y7:=-y5;
  x8:=-x6;  y8:=-y6;
  z1'= (x1+1,y1);
  penpos1'(.5nhh+blacker, 75);
  penpos6(max(1,thin), -45);
  penpos5(max(1,thin), -180);
  penpos8(max(1,thin), -45);
  penpos7(max(1,thin), -180);
  fill_circle (.45nhh, (x5-.15nhh, y5l-.12nhh));
  fill_circle (.42nhh, (x4, y4));
%  pickup thin_pen;
  pickup thin_pen;
  draw ( ( (x4-.2nhh)+(2x1-x5) )/2, y1-(y5l-y4)/2-.05nhh)--z1;
  addto currentpicture also currentpicture rotatedaround (z1, 180);
  penstroke z7e..{ne}z8e..z1'e{dir135}..{ne}z6e..z5e;
%  penlabels (1,4,5,6,7,8);
  shift_pic (.5nhw, 1.5nhh);
endchar;

%
% V-shaped breath
%
beginchar(33, 0, 1.5nhh#, 0); "V-shaped breath (up)";
  pickup thin_pen;
  draw (.1nhw, 1.5nhh)--(.5nhw, .05nhh);
  add_mirror ((.5nhw,0),(.5nhw,1));
  savepic;
endchar;
beginchar(34, 0, 0, 1.5nhh#); "V-shaped breath (down)";
  call_mirror (origin, right);
endchar;


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

NHW=nhw+hlthick;

beginchar(7, 0, .5nhh#, .5nhh#); "quarter note";
% makeshift, expedience
  corNHW=1.065*NHW;
    fill fullcircle xscaled corNHW yscaled 1.85h
         rotated 20 shifted (.5NHW, 0);
endchar;

beginchar(8, 0, .5nhh#, .5nhh#); "half note";
  penpos1(max(1,2hlthick), 0);
  penpos3(max(1,2hlthick), 180);
  penpos2(thick,-90);
  penpos4(thick, 90);
  -x1l = .53NHW;
  x3l = .5NHW;
  x2 = x4 = y1 = y3 = 0;
  y2l =-y4l = h;
  penstroke (z1e{up}..z2e{right}..z3e{down}..z4e{left}..cycle)
             rotated 20 shifted (.5NHW, 0);
endchar;

beginchar(9, 0, .5nhh#, .5nhh#); "whole note";
  x1= y1 = y3 = y5 = y7 = 0;
  x3= 2x2 = 2x4 = 2x6 = 2x8 = 5/4nhw;
  y2=-y4 = h;
  x5= x3-x7 = x1+.375nhw-blacker;
  y6=-y8 = y2-.1thin;
  fill z1{curl3}..z2..{curl3}z3{curl3}..z4..{curl3}cycle;
  unfill (z5..z6..z7..z8..cycle) rotatedaround ((x2,0), 45) shifted (.5,.5);
%{{{
  currentpen:= pencircle;
  draw rt z1{curl3}..bot z2..{curl3}lft z3{curl3}..top z4..{curl3}cycle;
%}}}
  labels(range 1 thru 8);
  savepic;
endchar;



end.