From: Jan Nieuwenhuizen Date: Thu, 28 Jun 2001 09:15:22 +0000 (+0200) Subject: patch::: 1.4.4.jcn2 X-Git-Tag: release/1.4.5~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7392541771117e940b88118e5b9e62d7b6ed7267;p=lilypond.git patch::: 1.4.4.jcn2 1.4.4.jcn2 ========== --- diff --git a/CHANGES b/CHANGES index 0ccd47a168..ed0d052378 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,15 @@ +1.4.4.jcn2 +========== + +* Beam and stem fixes: + - Stems drawn in PostScript (should do all filledbox'es in PS?). + - Fixes for draw_box and draw_beam PostScript routines. + - Stems reach to top (or bottom) of beam. + - Beam uses correct stem thickness (only right beams, left TODO). + - testing code in effect: only outlines are drawn. +1.4.4 +===== 1.4.3.jcn2 ========== diff --git a/VERSION b/VERSION index 112a1d937a..31dbd0d4c7 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=4 PATCH_LEVEL=4 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=jcn2 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/bugs/beam.ly b/input/bugs/beam.ly new file mode 100644 index 0000000000..44e7dfee39 --- /dev/null +++ b/input/bugs/beam.ly @@ -0,0 +1,15 @@ +\header { + texidoc="beam-stem attachment test" +} + +\score { + \context RhythmicStaff \notes { + \stemUp [c8 c] + \stemDown [c8 c] + \stemUp [c8. c16] + } + \paper { + linewidth = -1.0 + magnification = 64 + } +} \ No newline at end of file diff --git a/lily/beam.cc b/lily/beam.cc index 77186ed8e2..57f5a508bf 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -670,6 +670,9 @@ Beam::set_stem_lengths (Grob *me) Real stem_y = calc_stem_y_f (me, s, y, dy); + stem_y += Stem::get_direction (s) + * gh_scm2double (me->get_grob_property ("thickness")) / 2; + /* caution: stem measures in staff-positions */ Real id = me->relative_coordinate (common, Y_AXIS) - stems[i]->relative_coordinate (common, Y_AXIS); @@ -762,7 +765,6 @@ Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev, (prev && ! (prev->relative_coordinate (0, X_AXIS) < here->relative_coordinate (0, X_AXIS)))) programming_error ("Beams are not left-to-right"); - Real staffline_f = me->paper_l ()->get_var ("stafflinethickness"); int multiplicity = get_multiplicity (me); SCM space_proc = me->get_grob_property ("space-function"); @@ -772,8 +774,7 @@ Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev, Real interbeam_f = gh_scm2double (space) ; Real bdy = interbeam_f; - Real stemdx = staffline_f; - + #if 0 // ugh -> use commonx Real dx = visible_stem_count (me) ? @@ -811,6 +812,8 @@ Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev, Half beam should be one note-width, but let's make sure two half-beams never touch */ + + // FIXME: TODO stem width Real w = here->relative_coordinate (0, X_AXIS) - prev->relative_coordinate (0, X_AXIS); w = w/2 relative_coordinate (0, X_AXIS) - here->relative_coordinate (0, X_AXIS); - Molecule a = Lookup::beam (dydx, w + stemdx, thick); - a.translate_axis (- stemdx/2, X_AXIS); + Real w = next->relative_coordinate (0, X_AXIS) + - here->relative_coordinate (0, X_AXIS); + + Real stem_w = gh_scm2double (next->get_grob_property ("thickness")) + // URG + * me->paper_l ()->get_var ("stafflinethickness"); + + Molecule a = Lookup::beam (dydx, w + stem_w, thick); + a.translate_axis (- stem_w/2, X_AXIS); int j = 0; Real gap_f = 0; - + SCM gap = me->get_grob_property ("gap"); if (gh_number_p (gap)) { @@ -853,7 +864,7 @@ Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev, else gap_f = nw_f / 2; w -= 2 * gap_f; - a = Lookup::beam (dydx, w + stemdx, thick); + a = Lookup::beam (dydx, w + stem_w, thick); } for (; j < rwholebeams; j++) diff --git a/lily/stem.cc b/lily/stem.cc index 7eac4dfe63..aca140aaf7 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -511,6 +511,7 @@ Stem::brew_molecule (SCM smob) Interval stem_y (y1,y2); stem_y.unite (Interval (y2,y1)); + // dy? Real dy = Staff_symbol_referencer::staff_space (me)/2.0; if (Grob *hed = support_head (me)) @@ -524,7 +525,10 @@ Stem::brew_molecule (SCM smob) if (!invisible_b (me)) { - Real stem_width = gh_scm2double (me->get_grob_property ("thickness")) * me->paper_l ()->get_var ("stafflinethickness"); + Real stem_width = gh_scm2double (me->get_grob_property ("thickness")) + // URG + * me->paper_l ()->get_var ("stafflinethickness"); + Molecule ss =Lookup::filledbox (Box (Interval (-stem_width/2, stem_width/2), Interval (stem_y[DOWN]*dy, stem_y[UP]*dy))); mol.add_molecule (ss); diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps index f1b9fa0fd8..aa3c2cc382 100644 --- a/ps/music-drawing-routines.ps +++ b/ps/music-drawing-routines.ps @@ -1,7 +1,14 @@ -%!PS-Adobe-1.0: lily.ps +%!PS-Adobe-1.0: music-drawing-routines.ps % % Functions for direct and embedded PostScript + +%% +/testing true def + + + +% FIXME: set with individual symbols % round cappings 1 setlinecap @@ -10,36 +17,32 @@ 1 copy mul exch 1 copy mul add sqrt } bind def -/simpledraw_box % breapth width depth height -{ - /h exch def - /d exch def - /w exch def - /b exch def - - 0.01 setlinewidth - 1 setlinejoin - 0 0 moveto - b neg d neg rmoveto - b w add 0 rlineto - 0 d h add rlineto - b w add neg 0 rlineto - %closepath gsave stroke grestore fill - closepath fill -} bind def - - % FIXME. translate to middle of box. % Nice rectangle with rounded corners +% FIXME: linewidth hardcoded. check: too round? /draw_box % breapth width depth height { - 1 setlinejoin - /l 0.05 def + %% FIXME: hardcoded + currentdict /testing known { + %% real thin lines for testing + /l 0.005 def + }{ + /l 0.05 def + } ifelse + + 0 setlinecap l setlinewidth 1 setlinejoin l 2 div sub /h exch def l 2 div sub /d exch def + + %% UGH huh? + %% Where does this correction come from? + %% Why don't we need this in x direction? + h l 2 div sub /h exch def + d l 2 div sub /d exch def + l 2 div sub /w exch def l 2 div sub /b exch def @@ -48,34 +51,31 @@ 0 d h add rlineto b w add neg 0 rlineto 0 d h add neg rlineto - closepath gsave stroke grestore fill -} bind def - -% ugh, see rectfill -/simpledraw_beam % slope width thick -{ - /t exch def - /w exch def - w mul /h exch def - 1 setlinejoin - % ugh? - 0.05 setlinewidth - 0 t 2 div neg moveto - w h rlineto - 0 t rlineto - w neg h neg rlineto - 0 t neg rlineto - closepath gsave stroke grestore fill -} bind def + currentdict /testing known { + %% outline only, for testing: + stroke + }{ + closepath gsave stroke grestore fill + } ifelse +} bind def % Nice beam with rounded corners +% FIXME: linewidth hardcoded. check: too round? /draw_beam % slope width thick { - % ugh? - /l 0.1 def + %% FIXME: hardcoded + currentdict /testing known { + %% real thin lines for testing + /l 0.01 def + }{ + /l 0.1 def + } ifelse l 2 div setlinewidth + + 0 setlinecap 1 setlinejoin + l sub /t exch def l sub /w exch def w mul /h exch def @@ -85,7 +85,13 @@ 0 t rlineto w neg h neg rlineto 0 t neg rlineto - closepath gsave stroke grestore fill + + currentdict /testing known { + %% outline only, for testing: + stroke + }{ + closepath gsave stroke grestore fill + } ifelse } bind def /draw_repeat_slash % width slope thick