From 67d5dc667ab368ea970c55722d4714452e71eb82 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 21 Nov 2004 23:01:54 +0000 Subject: [PATCH] * mf/feta-bolletjes.mf: merge solfa heads into main note heads. * mf/feta-generic.mf (else): remove solfa. * mf/feta-bolletjes.mf (tishape): remove unicode test. * scm/define-context-properties.scm (all-user-translation-properties): add shapeNoteStyles property. --- ChangeLog | 16 ++ mf/feta-bolletjes.mf | 344 ++++++++++++++++++++++++++++-- mf/feta-generic.mf | 1 - mf/feta-solfa.mf | 316 +-------------------------- scm/define-context-properties.scm | 3 +- 5 files changed, 342 insertions(+), 338 deletions(-) diff --git a/ChangeLog b/ChangeLog index de7107aeb7..9f28fca257 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2004-11-21 Han-Wen Nienhuys + + * mf/feta-bolletjes.mf: merge solfa heads into main note heads. + + * mf/feta-generic.mf (else): remove solfa. + + * mf/feta-bolletjes.mf (tishape): remove unicode test. + + * scm/define-context-properties.scm + (all-user-translation-properties): add shapeNoteStyles property. + + * lily/shape-note-heads-engraver.cc (process_music): new file. + + * lily/event.cc (transpose): call Event::transpose() for + transposing the tonic. + 2004-11-21 Jan Nieuwenhuizen * scm/output-gnome.scm: Save some pointers about pango/fontconfig diff --git a/mf/feta-bolletjes.mf b/mf/feta-bolletjes.mf index ba3da5509b..9747bda49e 100644 --- a/mf/feta-bolletjes.mf +++ b/mf/feta-bolletjes.mf @@ -24,6 +24,7 @@ save black_notehead_width, noteheight, slash_thick, slash_slope, overdone_heads; numeric black_notehead_width, noteheight, slash_thick; + fet_begingroup("noteheads"); @@ -188,7 +189,6 @@ fet_endchar; %%%%%%%%%%%%%%%% %% testing shapes. - if 0 = 1 : @@ -529,30 +529,332 @@ fet_beginchar("X-Circled notehead", "2xcircle", "xcircledhead") fet_endchar; -fet_endgroup("noteheads"); -% what is this doing here? -define_pixels(black_notehead_width); +%%%%%%%% +% +% +% SOLFA SHAPED NOTES +% +% -if 0 = 1: -% free space: ascii a-i -code:=106; +def generic_draw_solfa_note_shape = + save a,beta,black,white; + path black, white; -% -% testing unicode/gnome-canvas -% -savecode:=code; -code:=96; -%fet_beginchar("Whole notehead", "0", "wholehead") -fet_beginchar("Ascii a", "a", "a") - draw_outside_ellipse (1.80 - puff_up_factor / 3.0, 0, 0.707, 0); - undraw_inside_ellipse (1.30, 125 - puff_up_factor *10, - 0.68, 2 stafflinethickness#, - (w /2, 0)); -% draw_staff_outline (-2, 2, 0.5); + pickup pencircle scaled stafflinethickness; + 2 beta# = noteheight#; + a# = a_b*beta#; + wid# := 2a#+stafflinethickness#; + hei# := noteheight#+stafflinethickness#; + set_char_box(0, wid#,0.5 hei#, 0.5 hei#); + + define_pixels(a,beta); + + black = noteshape xscaled a yscaled beta shifted (a+stafflinethickness/2,0); + filldraw black; + + if (solid=false): + white = noteishape xscaled (a*ai_a) yscaled (beta*bi_b) + shifted ((dx+1)*(a+stafflinethickness/2),dy*(beta+stafflinethickness/2)); + unfill white; + fi; +enddef; + +def draw_solfa_note_shape = + save solid; boolean solid; + solid=false; + generic_draw_solfa_note_shape; +enddef; +def draw_solfa_quarter_note_shape = + save solid; boolean solid; + solid=true; + generic_draw_solfa_note_shape; +enddef; + +% do - equilateral triangle: (0,-h/2) -- (w/2,h/2) -- (w,-h/2) -- cycle; +% stem attachment: -h/2 + +save triangle; path triangle; +triangle := (-1,-1) -- (0,1) -- (1,-1) -- cycle; + +def drawdoshape = + save noteshape, noteishape, dx, dy, ai_a, bi_b; + path noteshape, noteishape; + noteshape = noteishape = triangle; + (dx,dy)=(0,0.05); + (ai_a,bi_b)=(i_o,i_o); + draw_solfa_note_shape; +enddef; + +fet_beginchar("Whole dohead", "0do", "wholedohead") + pickup pencircle scaled blot_diameter; + save a_b, i_o; + a_b = 1.8; + i_o = 0.6; + + drawdoshape; +fet_endchar; + +fet_beginchar("Half dohead", "1do", "halfdohead") + save a_b, i_o; + a_b = 1.5; + i_o = 0.6; + + drawdoshape; +fet_endchar; + +fet_beginchar("Quart dohead", "2do", "dohead") + save a_b, noteshape; + path noteshape; + a_b = 1.54; + + noteshape = triangle; + draw_solfa_quarter_note_shape; + +fet_endchar; + +% re - flat top, curved bottom: +% (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle; +% (broader along the base and with more vertical sides for half and +% whole notes) +% stem attachment: h/2 + +save reshape; path reshape; +reshape = (-1,1)--(-1,0.2){down} ... (0,-1) ... {up}(1,0.2)--(1,1)--cycle; + +fet_beginchar("Whole rehead", "0re", "wholerehead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = reshape; + noteishape = reshape; + a_b = 1.8; + bi_b = 0.65; + ai_a = 0.8; + (dx,dy)=(0,-0.1); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Half rehead", "1re", "halfrehead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = reshape; + noteishape = reshape; + a_b = 1.5; + bi_b = 0.65; + ai_a = 0.8; + (dx,dy)=(0,-0.1); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Quart rehead", "2ro", "rehead") + save a_b, noteshape; + path noteshape; + a_b = 1.54; + + noteshape = reshape; + draw_solfa_quarter_note_shape; +fet_endchar; + +% me - diamond: (0,0) -- (w/2,h/2) -- (w,0) -- (w/2,-h/2) -- cycle; +% similar to existing diamond shaped head, but not quite the same +% stem attachment: 0 + +save mishape; path mishape; +mishape = (-1,0)--(0,1)--(1,0)--(0,-1)--cycle; + +fet_beginchar("Whole mihead", "0mi", "wholemihead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = mishape; + noteishape = (mishape slanted -0.35) rotated -10.5; + a_b = 1.8; + bi_b = 0.65; + ai_a = 0.7; + (dx,dy)=(0,0); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Half mihead", "1mi", "halfmihead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = mishape; + noteishape = (mishape slanted -0.35) rotated -10.5; + a_b = 1.5; + bi_b = 0.65; + ai_a = 0.7; + (dx,dy)=(0,0); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Quart mihead", "2mi", "mihead") + save a_b, noteshape; + path noteshape; + a_b = 1.54; + + noteshape = mishape; + draw_solfa_quarter_note_shape; +fet_endchar; + + +% fa - scalene triangle: +% for stem up: (0,h/2) -- (w,h/2) -- (w,-h/2) -- cycle; +% for stem down: (w,-h/2) -- (0,1h/2) -- (0,h/2) -- cycle; +% (one is a 180 degree rotation of the other) +% stem attachment: (doesn't much matter) + +save fashape; path fashape; +fashape = (-1,1)--(1,1)--(1,-1)--cycle; + +fet_beginchar("Whole fahead", "0fa", "wholefahead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = fashape; + noteishape = fashape; + a_b = 1.8; + bi_b = 0.6; + ai_a = 0.6; + (dx,dy)=(0.2,.05); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Half stemup fahead", "1fau", "halffauhead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = fashape; + noteishape = fashape; + a_b = 1.5; + bi_b = 0.6; + ai_a = 0.6; + (dx,dy)=(0.2,.05); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Quart stemup fahead", "2fau", "fauhead") + save a_b, noteshape; + path noteshape; + a_b = 1.54; + + noteshape = fashape; + draw_solfa_quarter_note_shape; +fet_endchar; + +fet_beginchar("Half stemdn fahead", "1fad", "halffadhead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = fashape rotated 180; + noteishape = fashape rotated 180; + a_b = 1.5; + bi_b = 0.6; + ai_a = 0.6; + (dx,dy)=(-0.2,-.05); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Quart stemdn fahead", "2fad", "fadhead") + save a_b, noteshape; + path noteshape; + a_b = 1.54; + + noteshape = fashape rotated 180; + draw_solfa_quarter_note_shape; +fet_endchar; + + +% sol - oval ... the standard "round" note + +% la - rectangle: (0,h/2)--(w,h.2)--(w,-h/2)--(0,-h/2)--cycle; +% stem attachment: (doesn't much matter) +save lashape; path lashape; +lashape = (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; + +fet_beginchar("Whole lahead", "0la", "wholelahead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = lashape; + noteishape = lashape; + a_b = 1.8; + bi_b = 0.6; + ai_a = 0.85; + (dx,dy)=(0,0); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Half lahead", "1la", "halflahead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = lashape; + noteishape = lashape; + a_b = 1.5; + bi_b = 0.6; + ai_a = 0.85; + (dx,dy)=(0,0); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Quart lahead", "2la", "lahead") + save a_b, noteshape; + path noteshape; + a_b = 1.54; + + noteshape = lashape; + draw_solfa_quarter_note_shape; +fet_endchar; + + +% ti - an "icecream cone" with about 2/3 of +% the height in the cone and only 1/3 in the curved top: +% (0,h/6)--(w/2,-h/2)--(w,h/6)..(w/2,h/2)..cycle; +% stem attachment: h/6 +save tishape; path tishape; +tishape = (0,-1)--(-1,0.3)..(0,1)..(1,0.3)--cycle; + +fet_beginchar("Whole tihead", "0ti", "wholetihead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = tishape; + noteishape = tishape; + a_b = 1.8; + bi_b = 0.75; + ai_a = 0.75; + (dx,dy)=(0,-.02); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Half tihead", "1ti", "halftihead") + save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; + path noteshape, noteishape; + noteshape = tishape; + noteishape = tishape; + a_b = 1.5; + bi_b = 0.75; + ai_a = 0.75; + (dx,dy)=(0,-.02); + draw_solfa_note_shape; +fet_endchar; + +fet_beginchar("Quart tihead", "2ti", "tihead") + save a_b, noteshape; + path noteshape; + a_b = 1.54; + + noteshape = tishape; + draw_solfa_quarter_note_shape; fet_endchar; -code:=savecode; -fi + + +fet_endgroup("noteheads"); + + +% +% we derive black_notehead_width# from the quarter head, +% so we have to define black_notehead_width (pixel qty) +% after the black_notehead_width# itself. Let's keep it outside the group as well. +% +define_pixels(black_notehead_width); + + + + diff --git a/mf/feta-generic.mf b/mf/feta-generic.mf index 99f02ed528..956cfb8d92 100644 --- a/mf/feta-generic.mf +++ b/mf/feta-generic.mf @@ -35,7 +35,6 @@ if test = 0: input feta-timesig; input feta-pendaal; input feta-accordion; - input feta-solfa; else: input feta-test-generic.mf; diff --git a/mf/feta-solfa.mf b/mf/feta-solfa.mf index d5f5468002..661614e983 100644 --- a/mf/feta-solfa.mf +++ b/mf/feta-solfa.mf @@ -8,321 +8,7 @@ fet_begingroup("solfa"); -noteheight#:=staff_space#+ (overdone_heads) *stafflinethickness#; +noteheight#:=staff_space# + overdone_heads * stafflinethickness#; define_pixels(noteheight); -%%%%%%%% -% -% -% SOLFA SHAPED NOTES -% -% -save pent; -pent# = stafflinethickness#; -define_pixels(pent); - -def generic_drawnoteshape = - save a,beta,black,white; - path black, white; - - pickup pencircle scaled pent; - 2 beta# = noteheight#; - a# = a_b*beta#; - wid# := 2a#+pent#; - hei# := noteheight#+pent#; - set_char_box(0, wid#,0.5 hei#, 0.5 hei#); - - define_pixels(a,beta); - - black = noteshape xscaled a yscaled beta shifted (a+pent/2,0); - filldraw black; - - if (solid=false): - white = noteishape xscaled (a*ai_a) yscaled (beta*bi_b) - shifted ((dx+1)*(a+pent/2),dy*(beta+pent/2)); - unfill white; - fi; -enddef; - -def drawnoteshape = - save solid; boolean solid; - solid=false; - generic_drawnoteshape; -enddef; -def drawquarternoteshape = - save solid; boolean solid; - solid=true; - generic_drawnoteshape; -enddef; - -% do - equilateral triangle: (0,-h/2) -- (w/2,h/2) -- (w,-h/2) -- cycle; -% stem attachment: -h/2 - -save triangle; path triangle; -triangle := (-1,-1) -- (0,1) -- (1,-1) -- cycle; - -def drawdoshape = - save noteshape, noteishape, dx, dy, ai_a, bi_b; - path noteshape, noteishape; - noteshape = noteishape = triangle; - (dx,dy)=(0,0.05); - (ai_a,bi_b)=(i_o,i_o); - drawnoteshape; -enddef; - -fet_beginchar("Whole dohead", "0do", "wholedohead") - pickup pencircle scaled blot_diameter; - save a_b, i_o; - a_b = 1.8; - i_o = 0.6; - - drawdoshape; -fet_endchar; - -fet_beginchar("Half dohead", "1do", "halfdohead") - save a_b, i_o; - a_b = 1.5; - i_o = 0.6; - - drawdoshape; -fet_endchar; - -fet_beginchar("Quart dohead", "2do", "dohead") - save a_b, noteshape; - path noteshape; - a_b = 1.54; - - noteshape = triangle; - drawquarternoteshape; - -fet_endchar; - -% re - flat top, curved bottom: -% (0,h/2) {dir -90} .. (w/2,-h/2) .. {dir 90} (w,h/2) -- cycle; -% (broader along the base and with more vertical sides for half and -% whole notes) -% stem attachment: h/2 - -save reshape; path reshape; -reshape = (-1,1)--(-1,0.2){down} ... (0,-1) ... {up}(1,0.2)--(1,1)--cycle; - -fet_beginchar("Whole rehead", "0re", "wholerehead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = reshape; - noteishape = reshape; - a_b = 1.8; - bi_b = 0.65; - ai_a = 0.8; - (dx,dy)=(0,-0.1); - drawnoteshape; -fet_endchar; - -fet_beginchar("Half rehead", "1re", "halfrehead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = reshape; - noteishape = reshape; - a_b = 1.5; - bi_b = 0.65; - ai_a = 0.8; - (dx,dy)=(0,-0.1); - drawnoteshape; -fet_endchar; - -fet_beginchar("Quart rehead", "2ro", "rehead") - save a_b, noteshape; - path noteshape; - a_b = 1.54; - - noteshape = reshape; - drawquarternoteshape; -fet_endchar; - -% me - diamond: (0,0) -- (w/2,h/2) -- (w,0) -- (w/2,-h/2) -- cycle; -% similar to existing diamond shaped head, but not quite the same -% stem attachment: 0 - -save meshape; path meshape; -meshape = (-1,0)--(0,1)--(1,0)--(0,-1)--cycle; - -fet_beginchar("Whole mehead", "0me", "wholemehead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = meshape; - noteishape = (meshape slanted -0.35) rotated -10.5; - a_b = 1.8; - bi_b = 0.65; - ai_a = 0.7; - (dx,dy)=(0,0); - drawnoteshape; -fet_endchar; - -fet_beginchar("Half mehead", "1me", "halfmehead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = meshape; - noteishape = (meshape slanted -0.35) rotated -10.5; - a_b = 1.5; - bi_b = 0.65; - ai_a = 0.7; - (dx,dy)=(0,0); - drawnoteshape; -fet_endchar; - -fet_beginchar("Quart mehead", "2me", "mehead") - save a_b, noteshape; - path noteshape; - a_b = 1.54; - - noteshape = meshape; - drawquarternoteshape; -fet_endchar; - - -% fa - scalene triangle: -% for stem up: (0,h/2) -- (w,h/2) -- (w,-h/2) -- cycle; -% for stem down: (w,-h/2) -- (0,1h/2) -- (0,h/2) -- cycle; -% (one is a 180 degree rotation of the other) -% stem attachment: (doesn't much matter) - -save fashape; path fashape; -fashape = (-1,1)--(1,1)--(1,-1)--cycle; - -fet_beginchar("Whole fahead", "0fa", "wholefahead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = fashape; - noteishape = fashape; - a_b = 1.8; - bi_b = 0.6; - ai_a = 0.6; - (dx,dy)=(0.2,.05); - drawnoteshape; -fet_endchar; - -fet_beginchar("Half stemup fahead", "1fau", "halffauhead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = fashape; - noteishape = fashape; - a_b = 1.5; - bi_b = 0.6; - ai_a = 0.6; - (dx,dy)=(0.2,.05); - drawnoteshape; -fet_endchar; - -fet_beginchar("Quart stemup fahead", "2fau", "fauhead") - save a_b, noteshape; - path noteshape; - a_b = 1.54; - - noteshape = fashape; - drawquarternoteshape; -fet_endchar; - -fet_beginchar("Half stemdn fahead", "1fad", "halffadhead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = fashape rotated 180; - noteishape = fashape rotated 180; - a_b = 1.5; - bi_b = 0.6; - ai_a = 0.6; - (dx,dy)=(-0.2,-.05); - drawnoteshape; -fet_endchar; - -fet_beginchar("Quart stemdn fahead", "2fad", "fadhead") - save a_b, noteshape; - path noteshape; - a_b = 1.54; - - noteshape = fashape rotated 180; - drawquarternoteshape; -fet_endchar; - - -% sol - oval ... the standard "round" note - -% la - rectangle: (0,h/2)--(w,h.2)--(w,-h/2)--(0,-h/2)--cycle; -% stem attachment: (doesn't much matter) -save lashape; path lashape; -lashape = (-1,-1)--(-1,1)--(1,1)--(1,-1)--cycle; - -fet_beginchar("Whole lahead", "0la", "wholelahead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = lashape; - noteishape = lashape; - a_b = 1.8; - bi_b = 0.6; - ai_a = 0.85; - (dx,dy)=(0,0); - drawnoteshape; -fet_endchar; - -fet_beginchar("Half lahead", "1la", "halflahead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = lashape; - noteishape = lashape; - a_b = 1.5; - bi_b = 0.6; - ai_a = 0.85; - (dx,dy)=(0,0); - drawnoteshape; -fet_endchar; - -fet_beginchar("Quart lahead", "2la", "lahead") - save a_b, noteshape; - path noteshape; - a_b = 1.54; - - noteshape = lashape; - drawquarternoteshape; -fet_endchar; - - -% te - an "icecream cone" with about 2/3 of -% the height in the cone and only 1/3 in the curved top: -% (0,h/6)--(w/2,-h/2)--(w,h/6)..(w/2,h/2)..cycle; -% stem attachment: h/6 -save teshape; path teshape; -teshape = (0,-1)--(-1,0.3)..(0,1)..(1,0.3)--cycle; - -fet_beginchar("Whole tehead", "0te", "wholetehead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = teshape; - noteishape = teshape; - a_b = 1.8; - bi_b = 0.75; - ai_a = 0.75; - (dx,dy)=(0,-.02); - drawnoteshape; -fet_endchar; - -fet_beginchar("Half tehead", "1te", "halftehead") - save a_b, ai_a, bi_b, dx, dy, noteshape, noteishape; - path noteshape, noteishape; - noteshape = teshape; - noteishape = teshape; - a_b = 1.5; - bi_b = 0.75; - ai_a = 0.75; - (dx,dy)=(0,-.02); - drawnoteshape; -fet_endchar; - -fet_beginchar("Quart tehead", "2te", "tehead") - save a_b, noteshape; - path noteshape; - a_b = 1.54; - - noteshape = teshape; - drawquarternoteshape; -fet_endchar; - fet_endgroup("solfa") diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index d41d0797b3..04334c50e5 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -302,7 +302,8 @@ context.") (restNumberThreshold ,number? "If a multimeasure rest takes less than this number of measures, no number is printed. ") - + (shapeNoteStyles ,vector? "Vector of symbols, listing style for each note +head relative to the tonic (qv.) of the scale.") (skipBars ,boolean? "If set to true, then skip the empty bars that are produced by multimeasure notes and rests. These bars will not appear on the printed output. If not set (the -- 2.39.2