-input feta-macros;
-input feta-params;
+% feta-haak.mf -- implement bracket tips -*-Fundamental-*-
+%
+% part of LilyPond's pretty-but-neat music font
+%
+% source file of the Feta (not the Font-En-Tja) music font
+%
+% (c) 2005--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
-save code;
-code :=0;
+fet_begingroup ("brackettips");
+def draw_bracket (expr thick_sharp, width_sharp, updown) =
+begingroup;
+ save p, thin, thick, flattening, width, hair, flare;
+ path p;
+ pair tipdir;
-def draw_bracket( expr height_sharp, width_sharp) =
- save alpha, height, p, width, thin, thick;
- height# := height_sharp;
- width# := width_sharp;
+ flattening = 0.72;
+ thick# = thick_sharp;
+ flare# = flattening * width#;
+ width# = width_sharp;
+
+ define_pixels (thick, width, flare);
+ if updown = 1:
+ set_char_box (0, width#,
+ .5 thick#, flare#);
+ else:
+ set_char_box (0, width#,
+ flare#, .5 thick#);
+ fi;
+
+ thin = 2 linethickness;
+ hair = 1.25 linethickness;
- beginchar(incr code, width#, height#/2, height#/2);
-
- define_pixels (height, width);
- thin = 2 stafflinethickness;
- thick = .5 interline;
-
pickup pencircle scaled thin;
- lft x1 = 0;
- top y1 = height/2 + thick + thin;
+ y7 = y1;
+ x7 = x2;
+ z2 = z4r + (thin, 0);
+
+ penpos3 (thin, 0);
+ penpos4 (thin, 90);
+
+ z3 = z4;
- x2 = x1;
- z2 = (x1, 0);
- rt x3 = thick;
- y3 = y2;
+ top y3 = 0.5 thick;
+ lft x3 = 0.0;
+ x1 = x3l;
+ y1 = -0.5 thick;
- x4 = x3;
- bot y4 = y1 - thick + thin/2;
+ z8 = .5 [z2, z7];
+ top y5 = flare;
+ rt x5 = width;
- alpha = 50;
- z5 = z1 + (width, 3/4interline);
+ p := z8{right}
+ ..tension 1.2.. z5{curl 0};
+ tipdir := direction 1 of p;
- % need silly z6?
- % strange turning path when invoked via MakeTeXTFM...?
- % mf "\\mode:=ljfour; mag:=1; scrollmode; input feta-brackets16"
- z6 = z5 - (0, thin/16);
+ penpos5 (hair, angle tipdir);
+ penpos6 (hair, 90 + angle tipdir);
- filldraw z5{dir(180+alpha)}..{left}z1--z2--z3..{up}z4{right}
- ..{dir(alpha)}z6..cycle;
+ z5 = z6;
- labels(1,2,3,4,5,6);
- addto currentpicture also currentpicture yscaled -1;
-endchar;
+ pickup pencircle scaled 1;
+
+ fill (z1
+ -- z3l{up}
+ .. z4r{right}
+ -- z2{right}
+ .. z6r{tipdir}
+ .. z5r
+ .. z6l{-tipdir}
+ ..tension 1.1.. z7{left}
+ & z7
+ -- z1
+ & cycle) yscaled updown;
+
+ if updown = 1:
+ penlabels (1, 2, 3, 4, 5, 6, 7, 8);
+ fi;
+endgroup;
enddef;
-% for h := staffsize# step 1 pt# until (2 * staffsize#):
-for h := staffsize# step 1 pt# until (7 * staffsize#):
- draw_bracket(h, 2interline# );
-endfor
+fet_beginchar ("bracket tip up", "up");
+ draw_bracket (0.45 staff_space#, 1.9 staff_space#, 1);
+fet_endchar;
+
+
+fet_beginchar ("bracket tip down", "down");
+ draw_bracket (0.45 staff_space#, 1.9 staff_space#, -1);
+fet_endchar;
+fet_endgroup ("brackettips");