]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.4.4.jcn2
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 28 Jun 2001 09:15:22 +0000 (11:15 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 28 Jun 2001 09:15:22 +0000 (11:15 +0200)
1.4.4.jcn2
==========

CHANGES
VERSION
input/bugs/beam.ly [new file with mode: 0644]
lily/beam.cc
lily/stem.cc
ps/music-drawing-routines.ps

diff --git a/CHANGES b/CHANGES
index 0ccd47a1684286713f841344bc5b01c34058190b..ed0d05237876f4b5c567c60e524008904f2178a3 100644 (file)
--- 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 112a1d937ab779cd535ae976793fae8e32d3c7e6..31dbd0d4c761c85817723b3a4f8ebf307d240d4f 100644 (file)
--- 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 (file)
index 0000000..44e7dfe
--- /dev/null
@@ -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
index 77186ed8e26575a251c1ba26e7d5c9fbd8d0d92c..57f5a508bf1224e017f7aad1e48a1ffe8604b796 100644 (file)
@@ -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 <? nw_f;
       Molecule a;
@@ -827,15 +830,23 @@ Beam::stem_beams (Grob*me,Item *here, Item *next, Item *prev,
 
   if (next)
     {
-      int rhalfs  = Stem::beam_count (here,RIGHT) - Stem::beam_count (next,LEFT);
-      int rwholebeams= Stem::beam_count (here,RIGHT) <? Stem::beam_count (next,LEFT) ;
+      int rhalfs  = Stem::beam_count (here,RIGHT)
+       - Stem::beam_count (next,LEFT);
+      int rwholebeams= Stem::beam_count (here,RIGHT)
+       <? Stem::beam_count (next,LEFT) ;
 
-      Real w = next->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++)
index 7eac4dfe63b9a5912f059ab9ed0ce7c9505e1a5f..aca140aaf755545963d80bdf519985a22db24e29 100644 (file)
@@ -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);
index f1b9fa0fd8a3ee56b9dca59bde15e02c3ab848e5..aa3c2cc3824680b9a9f4841b99c6c74c8b148186 100644 (file)
@@ -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
 
        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
 
        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
        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