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 Han-Wen Nienhuys <hanwen@stack.nl>
8 % Jan Nieuwenhuizen <jan@digicash.com>
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")
63 % FIXME: rounded endings
65 % `\accent' is TeX reserved.
66 fet_beginchar("> accent", "sforzato", "sforzatoaccent")
67 set_char_box(.9 interline#, .9 interline#, .5 interline#, .5 interline#);
68 save thickness, diminish;
70 thickness = 3/2 stafflinethickness;
71 pickup pencircle scaled thickness;
73 % prevent blobs at crossing lines
79 y2 = .25 thickness* diminish;
83 z3 = whatever [z1, z4];
85 penpos2(thickness*(2 - diminish)/2 , 90);
86 penpos1(thickness, 90);
87 penpos3(thickness, 90);
90 draw (z1 .. z3) yscaled -1;
93 penstroke (z3e .. z2e) yscaled -1;
99 fet_beginchar("staccato dot", "staccato", "staccato")
101 radius# = 1.5 stafflinethickness#;
102 define_pixels(radius);
103 pickup pencircle scaled 2 radius;
105 set_char_box(radius#, radius#, radius#, radius#);
108 def draw_staccatissimo =
110 height# = .8 interline#;
111 radius# = 2 stafflinethickness#;
112 define_pixels(radius, height);
114 draw_brush((0,0), stafflinethickness, (0, height),2 radius);
115 set_char_box(radius#,radius#, blot_diameter#/2, height# + radius#);
118 fet_beginchar("staccatissimo/martellato up", "ustaccatissimo",
124 % FIXEM: scale labels too.
126 fet_beginchar("staccatissimo/martellato down", "dstaccatissimo", "dstaccatissimo")
131 fet_beginchar("portato/single tenuto", "tenuto", "tenuto")
133 thick# = 1.2 stafflinethickness#;
134 define_pixels(thick);
136 set_char_box(.9 interline#, .9 interline#, thick#/2,thick#/2);
137 pickup pencircle scaled thick;
146 save fat_factor, thinness;
147 set_char_box(interline#/2, interline#/2, 0, 1.1 interline#);
150 thinness = stafflinethickness;
152 pickup pencircle scaled thinness;
160 z1 - z4 = whatever * (charwd, -charht);
161 z4 = fat_factor [z3, z5];
163 filldraw z1 -- z2 -- z3 -- z4 -- cycle;
167 fet_beginchar("marcato up", "umarcato", "umarcato")
174 % The down marcato char (not very much used).
175 % Contrary to what some MF/TeX `gurus' believe
176 % it is *point*-symmetric with the "up" version
177 fet_beginchar("marcato down", "dmarcato", "dmarcato")
183 % used in french horn music todo
185 % TODO: too light at 20pt
186 fet_beginchar("open (unstopped)", "open", "ouvert")
187 save thin, height, width, thick;
188 height# = 5/4 width#;
189 height# = interline#;
190 thin = 1.2 stafflinethickness;
192 set_char_box(width#/2, width#/2, height#/2, height#/2);
199 penstroke z1e{up} .. {left}z2e;
200 addto currentpicture also currentpicture xscaled -1;
201 addto currentpicture also currentpicture yscaled -1;
205 fet_beginchar("plus (stopped)", "stopped", "plusstop")
207 thick = 2 stafflinethickness;
208 size# = 1.1 interline#;
210 set_char_box(size#/2, size#/2, size#/2, size#/2);
211 pickup pencircle scaled thick;
218 draw (z1 .. z2) rotated 90;
224 fet_beginchar("Upbow", "upbow", "upbow")
227 thick = 1.4 stafflinethickness;
228 wd# = 1.3 interline#;
232 set_char_box(wd#/2, wd#/2, 0, ht#);
233 pickup pencircle scaled thick;
241 draw z2 -- z1 -- (z2 xscaled -1);
245 fet_beginchar("Downbow", "downbow", "downbow")
246 save stemthick, beamheight;
250 wd# = 1.5 interline#;
251 stemthick = 1.2 stafflinethickness;
253 set_char_box(wd#/2, wd#/2, 0, 4/3 interline#);
258 pickup pencircle scaled blot_diameter;
259 top y2 - bot y1 = beamheight;
269 filldraw z1 -- z2 -- z3 -- z4 --cycle;
271 pickup pencircle scaled stemthick;
277 labels(1, 2,3,4,5,6);
278 addto currentpicture also currentpicture xscaled -1;
282 % Inspired by a computer-set version of Auf dem Strom by Baerenreiter.
284 fet_beginchar("Turn","turn","turn")
285 save thin, thick, ball_diam, darkness;
286 save wd, ht, thick_nibangle, ball_nib_thick;
290 wd# = 35/16 interline#;
291 ht# = 18/17 interline#;
292 darkness = 1.20 stafflinethickness;
294 set_char_box(wd#/2, wd#/2, ht#/2, ht#/2);
299 ball_nib_thick = 2.7 darkness;
300 ball_diam = ball_nib_thick + (h - ball_nib_thick) / 10;
311 penpos1(1.1 thick, thick_nibangle);
312 penpos2(thick, thick_nibangle);
314 penpos4(ball_nib_thick, -90);
317 swoosh := z1l{curl 0} .. z2l .. z3l{up} .. {left}z4l
318 -- z4r .. z3r{down} .. z2r{left} ;
319 fill swoosh .. (swoosh scaled -1) .. cycle;
323 y5r = y4l - ball_diam /2;
326 penpos5(1.6 ball_diam/2, 10);
327 penpos6(ball_diam/2, 150);
329 ploop := z4l{left} .. z5l .. z6l -- cycle;
331 fill ploop scaled -1;
341 % Inspired by a (by now) PD edition of Durand & C'ie edition of
342 % Saint-Saens' Celloconcerto no. 1
344 % FIXME take out hardcoded vars.
345 % FIXME the two loops on the `t' should be smoother (and the left one bigger).
346 % FIXME generic macros for serifs: top of the t and bottom of r
350 fet_beginchar("Trill (`tr')","trill","trill")
352 save start_nib_angle, ascender_extra, ex, hair_thick, fatness,
353 slant_angle, slant, t_fatness, r_fatness, kerning, t_overshoot,
354 uitschieter, bulb_size;
358 ascender_extra# = 1/2 ex#;
359 ascender# = ascender_extra# + ex#;
360 ex# = 1.5 interline#;
362 start_nib_angle = 20;
364 define_pixels(ex, ascender_extra, ascender, kerning);
366 t_overshoot = 0.03 ex;
368 t_fatness = 8/10 fatness;
369 r_fatness = .75 fatness;
370 uitschieter = 21/40 ex;
371 hair_thick = blot_diameter;
375 local_copy(transform)(currenttransform);
376 currenttransform := currenttransform slanted slant shifted (- interline, 0) ;
381 penpos1(start_nib_wid, start_nib_angle);
384 penpos2(start_nib_wid, start_nib_angle);
386 z3l = (11/10 t_fatness, - t_overshoot);
388 z4l = (13/6 t_fatness, 5/16 ex);
389 penpos4(hair_thick, 180);
391 1.9 [z3l, z3r] = z4r;
395 path t_p, krul_p, r_p;
398 t_p := z1l -- z2l{down} .. tension (1 + .5 slant)
401 .. z4l{up} -- z4r{down}
402 .. z3r{left} .. z2r{up} .. z1r -- cycle;
407 pickup pencircle scaled hair_thick;
409 z5 = (t_fatness/2, 2/3 ex);
411 lft x6 = - uitschieter;
414 z7 = z5 + whatever*dir krul_ang;
417 x7 = 5/10 kerning + x5;
419 penpos7(hair_thick, up_angle + 90);
424 penpos8(2 hair_thick, (up_angle +90)/2);
428 penpos9(r_fatness, 0);
432 penpos10(r_fatness, 0);
434 krul_p := z4{up} .. tension 1.1 .. z5
435 .. tension 1 and .75 .. {down}z6
436 .. tension .85 and 1.1 .. z5 --- z7;
438 r_p := z7l{z7-z5} .. z8l{right} .. z9l{down} --- z10l -- z10r
440 .. z8r{left} .. z7r{z5-z7} -- cycle;
442 set_char_box(interline# , interline#, 0,ascender#);
445 penpos11(1/4 r_fatness, -20);
448 z13 = (x9 + 2 r_fatness, y11 );
449 penpos13(r_fatness, 180);
450 fill z11r{dir 70} .. z13r{down} -- z13l{up} .. z11l{dir 250} -- cycle;
451 penlabels(range 1 thru 15);
454 draw_bulb(-1, z13r, z13l, bulb_size * r_fatness, 1.5);
459 save radius, thickness, wall;
461 radius# := .5 interline#;
463 define_pixels(radius);
464 set_char_box(radius#, radius#, radius#, 2/3 interline#);
466 thickness := 1.5 stafflinethickness;
467 pickup pencircle scaled thickness;
477 draw z1{down} .. z2{down} .. z3{left};
478 addto currentpicture also currentpicture xscaled -1;
483 fet_beginchar("left heel", "upedalheel", "upedalheel")
488 fet_beginchar("right heel", "dpedalheel", "dpedalheel")
496 thickness := 1.5 stafflinethickness;
497 ht# := 1.5 interline#;
499 define_pixels(ht,wd);
502 set_char_box(wd#, wd#, 0, ht#);
504 pickup pencircle scaled thickness;
516 fet_beginchar("left toe", "upedaltoe", "upedaltoe")
520 fet_beginchar("right toe", "dpedaltoe", "dpedaltoe")
525 fet_beginchar("Flageolet", "flageolet", "flageolet")
526 save height,width,thickness;
527 height#=4/15 staffsize#;
529 thickness#=blot_diameter#;
530 define_pixels(height,width,thickness);
531 set_char_box(width#/2,width#/2,height#/2,height#/2);
533 pickup pencircle scaled thickness;
537 rt x4 - lft x2 =width;
544 draw z1..z2..z3..z4..cycle;
549 fet_endgroup("scripts");