X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mf%2Ffeta-beugel.mf;h=f87c7edbf408d1583156ff7c8d16058ea6a1b92a;hb=c7f9ff0920291af6600970116c289add61e3a852;hp=0deab25aab3ab490cb68cf0be46cf3003b3c843e;hpb=2455c13ea98716c0ca86b8ebb7bba1d8f7004957;p=lilypond.git diff --git a/mf/feta-beugel.mf b/mf/feta-beugel.mf index 0deab25aab..f87c7edbf4 100644 --- a/mf/feta-beugel.mf +++ b/mf/feta-beugel.mf @@ -1,30 +1,60 @@ +% +% feta-beugel.mf -- [Staff] braces +% +% source file of the Feta (not an acronym for Font-En-Tja) +% pretty-but-neat music font +% +% (c) 1997--2005 Han-Wen Nienhuys +% Jan Nieuwenhuizen + +input feta-autometric; input feta-macros; + +staffsize# := 20 pt#; %% arbitrary. + input feta-params; -save code; -code :=0; + +% we must let the design increase for each +% font to make sure that mftrace doesn't jack up the resolution too highly +% for the longer braces. +fet_beginfont ("feta-braces-" & char (97 + font_count), (font_count + 1) * 20, + "fetaBraces"); + +mode_setup; -def draw_brace( expr height_sharp, width_sharp) = - save pendir, height, width, thin, thick; + +save code, braces_per_font; +code := 64; +braces_per_font := 64; + +def draw_brace (expr height_sharp, width_sharp, slt_sharp, brace_number) = + + save pendir, height, width, thin, thick, slt; save penangle; height# := height_sharp; - width# := width_sharp; + width# := width_sharp; + slt# := slt_sharp; + +%% +1 is needed because fet_beginchar increments after dumping the strings. +fet_beginchar ("brace number " & (decimal (brace_number)), + "brace" & decimal(brace_number)) - beginchar(incr code, width#, height#/2, height#/2); - - define_pixels (height, width); - thin = 2 stafflinethickness; - thick = .5 staff_space; + set_char_box (0, width#, height#/2, height#/2); + + define_pixels (height, width, slt); + thin = 2 slt; + thick = .5 width; z2 = .5 [z1, z3]; - y3 = y1 + height/2; + y3l = y1 + height/2; x3 = x1 + width; y1 =0; x3 = - width / 2; pair pendir; - pendir = unitvector(x3 - x1, y3/6 - y1); + pendir = unitvector(x3 - x1, y3l/6 - y1); penangle = angle pendir - 90; penpos3(thin, penangle); penpos2(thick, angle(z3 -z1) -90 ); @@ -35,12 +65,46 @@ def draw_brace( expr height_sharp, width_sharp) = .. z2l .. simple_serif (z1l, z1r, 90) ..cycle; addto currentpicture also currentpicture yscaled -1; -endchar; +fet_endchar; enddef; -for h := 2 staffsize# step 1 pt# until (7 * staffsize#): - % note: define_pixels (x) multiplies x by hppp, - % we must never get bigger than infinity - draw_brace (min (h, infinity/hppp - 1), staff_space#); + +save stafflinethickness; +save increment; + +linethickness := 0.5pt#; +increment := 0.5pt#; +y := 10pt#; + +for i := 0 step 1 until font_count: + + save number; + + number := braces_per_font * i; + + for j := 0 step 1 until (braces_per_font -1): + % message "l: "&decimal l; + % note: define_pixels (x) multiplies x by hppp, + % must never get bigger than infinity + y := y + increment; + if y > infinity/hppp: + message "Resolution and/or magnification is too high"; + error please report: ; + fi + + % x should be about one staff space, taking brace to have + % default height of 3 staffs, this yields height / 3 / 4 = 12 + % but 15 looks better + x := y / 15; + + increment := x / 10; + linethickness := min (0.5pt#, y/150); + if i = font_count: + draw_brace (y, x, linethickness, number); + fi + number := number + 1; + endfor; endfor + +fet_endfont("feta-braces");