1 % -*- Fundamental -*- (emacs-20 mf mode mucks
2 % feta-schrift.mf -- implement scripts
4 % source file of the Feta (defintively not an abbreviation for Font-En-Tja)
7 % (c) 1997, 1998 Han-Wen Nienhuys <hanwen@stack.nl>
8 % Jan Nieuwenhuizen <janneke@gnu.org>
12 fet_begingroup("scripts")
16 save alpha, radius, crook_thinness, crook_fatness, dot_diam;
18 % [Wanske] and some Baerenreiter editions
19 % suggest ca 80 degrees iso half-circle
22 radius# = 1.25 interline#;
23 crook_thinness# = 1.5stafflinethickness#;
24 crook_fatness# = 4 stafflinethickness#;
26 radius# + crook_fatness#/2 = h#;
27 radius# + crook_thinness#/2 = w#;
28 set_char_box(w#, w#, crook_thinness#/2, h#);
30 define_pixels(radius, crook_thinness, crook_fatness);
31 dot_diam = 4/3 crook_fatness;
34 penpos1(crook_thinness, 0);
35 penpos2(crook_fatness, -90);
39 fill z1l{dir (-alpha-90)}..{dir (90-alpha)}z1r..
40 {right}z2r -- z2l{left} .. cycle;
42 addto currentpicture also
43 currentpicture xscaled -1;
45 pickup pencircle scaled dot_diam;
47 bot y4 = - crook_thinness/2;
51 fet_beginchar("fermata up", "ufermata", "ufermata")
56 fet_beginchar("fermata down", "dfermata", "dfermata")
62 % Thumbs are used in cello music.
63 % TODO : thumbs should look like the finger-font and should be placed in
64 % the same way in the score.
67 fet_beginchar("Thumb", "thumb", "thumb")
68 save thin, height, width, thick;
71 thin = 1.2 stafflinethickness;
73 set_char_box(width#/2, width#/2, height#/2, height#/2);
80 penstroke z1e{up} .. {left}z2e;
81 addto currentpicture also currentpicture xscaled -1;
82 addto currentpicture also currentpicture yscaled -1;
84 pickup pencircle scaled thin;
94 % FIXME: rounded endings
96 % `\accent' is TeX reserved.
97 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
98 set_char_box(.9 interline#, .9 interline#, .5 interline#, .5 interline#);
99 save thickness, diminish;
101 thickness = 3/2 stafflinethickness;
102 pickup pencircle scaled thickness;
104 % prevent blobs at crossing lines
110 y2 = .25 thickness* diminish;
114 z3 = whatever [z1, z4];
116 penpos2(thickness*(2 - diminish)/2 , 90);
117 penpos1(thickness, 90);
118 penpos3(thickness, 90);
121 draw (z1 .. z3) yscaled -1;
123 penstroke z3e .. z2e;
124 penstroke (z3e .. z2e) yscaled -1;
130 fet_beginchar("staccato dot", "staccato", "staccato")
132 radius# = 1.5 stafflinethickness#;
133 define_pixels(radius);
134 pickup pencircle scaled 2 radius;
136 set_char_box(radius#, radius#, radius#, radius#);
139 def draw_staccatissimo =
141 height# = .8 interline#;
142 radius# = 2 stafflinethickness#;
143 define_pixels(radius, height);
145 draw_brush((0,0), stafflinethickness, (0, height),2 radius);
146 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
149 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
155 % FIXEM: scale labels too.
157 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
162 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
164 thick# = 1.4 stafflinethickness#;
165 define_pixels(thick);
167 set_char_box(.6 interline#, .6 interline#, thick#/2,thick#/2);
168 pickup pencircle scaled thick;
177 save fat_factor, thinness;
178 set_char_box(interline#/2, interline#/2, 0, 1.1 interline#);
181 thinness = stafflinethickness;
183 pickup pencircle scaled thinness;
191 z1 - z4 = whatever * (charwd, -charht);
192 z4 = fat_factor [z3, z5];
194 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
198 fet_beginchar("marcato up", "umarcato", "umarcato")
205 % The down marcato char (not very much used).
206 % Contrary to what some MF/TeX `gurus' believe
207 % it is *point*-symmetric with the "up" version
208 fet_beginchar("marcato down", "dmarcato", "dmarcato")
215 % used in french horn music todo
217 % TODO: too light at 20pt
218 fet_beginchar("open (unstopped)", "open", "ouvert")
219 save thin, height, width, thick;
220 height# = 5/4 width#;
221 height# = interline#;
222 thin = 1.2 stafflinethickness;
224 set_char_box(width#/2, width#/2, height#/2, height#/2);
231 penstroke z1e{up} .. {left}z2e;
232 addto currentpicture also currentpicture xscaled -1;
233 addto currentpicture also currentpicture yscaled -1;
237 fet_beginchar("plus (stopped)", "stopped", "plusstop")
239 thick = 2 stafflinethickness;
240 size# = 1.1 interline#;
242 set_char_box(size#/2, size#/2, size#/2, size#/2);
243 pickup pencircle scaled thick;
250 draw (z1 .. z2) rotated 90;
256 fet_beginchar("Upbow", "upbow", "upbow")
259 thick = 1.4 stafflinethickness;
260 wd# = 1.3 interline#;
264 set_char_box(wd#/2, wd#/2, 0, ht#);
265 pickup pencircle scaled thick;
273 draw z2 -- z1 -- (z2 xscaled -1);
277 fet_beginchar("Downbow", "downbow", "downbow")
278 save stemthick, beamheight;
282 wd# = 1.5 interline#;
283 stemthick = 1.2 stafflinethickness;
285 set_char_box(wd#/2, wd#/2, 0, 4/3 interline#);
290 pickup pencircle scaled blot_diameter;
291 top y2 - bot y1 = beamheight;
301 filldraw z1 -- z2 -- z3 -- z4 --cycle;
303 pickup pencircle scaled stemthick;
309 labels(1, 2,3,4,5,6);
310 addto currentpicture also currentpicture xscaled -1;
314 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
318 save thin, thick, ball_diam, darkness;
319 save wd, ht, thick_nibangle, ball_nib_thick;
323 wd# = 35/16 interline#;
324 ht# = 18/17 interline#;
325 darkness = 1.20 stafflinethickness;
327 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
332 ball_nib_thick = 2.7 darkness;
333 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
344 penpos1(1.1 thick, thick_nibangle);
345 penpos2(thick, thick_nibangle);
347 penpos4(ball_nib_thick, -90);
350 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
351 -- z4r .. z3r{down} .. z2r{left} ;
352 fill swoosh .. (swoosh scaled -1) .. cycle;
355 y5r = y4l - ball_diam /2;
358 penpos5(1.6 ball_diam/2, 10);
359 penpos6(ball_diam/2, 150);
361 ploop := z4l{left} .. z5l .. z6l -- cycle;
363 fill ploop scaled -1;
368 fet_beginchar("Reverse turn","reverseturn","reverseturn")
370 currentpicture := currentpicture yscaled -1;
376 fet_beginchar("Turn","turn","turn")
386 % Inspired by a (by now) PD edition of Durand & C'ie edition of
387 % Saint-Saens' Celloconcerto no. 1
389 % FIXME take out hardcoded vars.
390 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
391 % FIXME generic macros for serifs: top of the t and bottom of r
395 fet_beginchar("Trill (`tr')","trill","trill")
397 save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
398 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
399 uitschieter, bulb_size;
403 ascender_extra# = 1/2 ex#;
404 ascender# = ascender_extra# + ex#;
405 ex# = 1.5 interline#;
407 start_nib_angle = 20;
409 define_pixels(ex, ascender_extra, ascender, kerning);
411 t_overshoot = 0.03 ex;
413 t_fatness = 8/10 fatness;
414 r_fatness = .75 fatness;
415 uitschieter = 21/40 ex;
416 hair_thick = blot_diameter;
420 local_copy(transform)(currenttransform);
421 currenttransform := currenttransform slanted slant shifted (- interline, 0) ;
426 penpos1(start_nib_wid, start_nib_angle);
429 penpos2(start_nib_wid, start_nib_angle);
431 z3l = (11/10 t_fatness, - t_overshoot);
433 z4l = (13/6 t_fatness, 5/16 ex);
434 penpos4(hair_thick, 180);
436 1.9 [z3l, z3r] = z4r;
440 path t_p, krul_p, r_p;
443 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
446 .. z4l{up} -- z4r{down}
447 .. z3r{left} .. z2r{up} .. z1r -- cycle;
452 pickup pencircle scaled hair_thick;
454 z5 = (t_fatness/2, 2/3 ex);
456 lft x6 = - uitschieter;
459 z7 = z5 + whatever*dir krul_ang;
462 x7 = 5/10 kerning + x5;
464 penpos7(hair_thick, up_angle + 90);
469 penpos8(2 hair_thick, (up_angle +90)/2);
473 penpos9(r_fatness, 0);
477 penpos10(r_fatness, 0);
479 krul_p := z4{up} .. tension 1.1 .. z5
480 .. tension 1 and .75 .. {down}z6
481 .. tension .85 and 1.1 .. z5 --- z7;
483 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
485 .. z8r{left} .. z7r{z5-z7} -- cycle;
487 set_char_box(interline# , interline#, 0,ascender#);
490 penpos11(1/4 r_fatness, -20);
493 z13 = (x9 + 2 r_fatness, y11 );
494 penpos13(r_fatness, 180);
495 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
496 penlabels(range 1 thru 15);
499 draw_bulb(-1, z13r, z13l, bulb_size * r_fatness, 1.5);
504 save radius, thickness, wall;
506 radius# := .5 interline#;
508 define_pixels(radius);
509 set_char_box(radius#, radius#, radius#, 2/3 interline#);
511 thickness := 1.5 stafflinethickness;
512 pickup pencircle scaled thickness;
522 draw z1{down} .. z2{down} .. z3{left};
523 addto currentpicture also currentpicture xscaled -1;
528 fet_beginchar("left heel", "upedalheel", "upedalheel")
533 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
541 thickness := 1.5 stafflinethickness;
542 ht# := 1.5 interline#;
544 define_pixels(ht,wd);
547 set_char_box(wd#, wd#, 0, ht#);
549 pickup pencircle scaled thickness;
561 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
565 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
570 fet_beginchar("Flageolet", "flageolet", "flageolet")
571 save height,width,thickness;
572 height#=4/15 staffsize#;
574 thickness#=blot_diameter#;
575 define_pixels(height,width,thickness);
576 set_char_box(width#/2,width#/2,height#/2,height#/2);
578 pickup pencircle scaled thickness;
582 rt x4 - lft x2 =width;
589 draw z1..z2..z3..z4..cycle;
594 fet_endgroup("scripts");