]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/stem.cc (print): only produce stemlets if there are no
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 9 Mar 2005 16:03:16 +0000 (16:03 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 9 Mar 2005 16:03:16 +0000 (16:03 +0000)
noteheads on this stem.

* lily/note-spacing.cc (stem_dir_correction): robustness fix:
don't crash on stemlet (visible stem without heads).

* scm/define-grobs.scm (all-grob-descriptions): junk LeftEdge for
unbroken situations.

* scm/output-lib.scm (center-invisible): new function.

* lily/spacing-loose-columns.cc (set_loose_columns): use spacing
wishes to determine loose column space.

ChangeLog
input/mutopia/F.Schubert/morgenlied.ly
input/regression/stem-stemlet.ly
lily/include/system.hh
lily/note-spacing.cc
lily/spacing-loose-columns.cc [new file with mode: 0644]
lily/staff-spacing.cc
lily/stem.cc
lily/system.cc
scm/define-grobs.scm
scm/output-lib.scm

index 64a0b363e1afa1ab74b53d8c4b35c5c14dde6428..049910bdc536d9c248421d6043f3780e45a61b7b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2005-03-09  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/stem.cc (print): only produce stemlets if there are no
+       noteheads on this stem.
+
+       * lily/note-spacing.cc (stem_dir_correction): robustness fix:
+       don't crash on stemlet (visible stem without heads).
+
+       * scm/define-grobs.scm (all-grob-descriptions): junk LeftEdge for
+       unbroken situations. 
+
+       * scm/output-lib.scm (center-invisible): new function.
+
+       * lily/spacing-loose-columns.cc (set_loose_columns): use spacing
+       wishes to determine loose column space.
+
        * lily/font-config.cc (init_fontconfig): add
        fonts/{otf,type1,cff}  to path.
 
index 58d36fe65bc11b47745a674719e9a9e2b4815a0a..ff3416f0f8a86c248c95b244c1aaaacca20dff38 100644 (file)
@@ -172,6 +172,7 @@ pianoLH =  \relative c'' \repeat volta 2 {
            \context {
                \Lyrics
                minimumVerticalExtent = #'(-0.5 . 2.5)
+               \override LyricText #'font-size = #-1
            }
            \context {
                \Score
index 72c7433603f9e41372bcbb4d48a55b373808d68e..4c49a8dfc96fb7030db60cf6c2b2dfdd459a57bc 100644 (file)
@@ -11,4 +11,5 @@ length can be set with @code{stemlet-length}."
 \relative {
     \override Stem #'stemlet-length = #0.75
     c8[ r8 c16 r16 c8]
+    c4
 }
index bf30fa237643a04a5032f81043ea31a7e0b79a2c..d8aa5a087f9d20a9c2a03ac7b9c0ba936a07f056 100644 (file)
@@ -47,5 +47,7 @@ public:
 protected:
 };
 
+
+void set_loose_columns (System* which, Column_x_positions const *posns);
 #endif /* SYSTEM_HH */
 
index 9f698361ab3ec9e3df26e4d08b1b66e72adcfb4b..f8924576e2699bed1a183bef8e55e1cd7eaeab9a 100644 (file)
@@ -318,11 +318,14 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn,
            }
          
          Interval hp  = Stem::head_positions (stem);
-         Real chord_start = hp[sd];      
-         Real stem_end = Stem::stem_end_position (stem);
+         if (!hp.is_empty())
+           {
+             Real chord_start = hp[sd];          
+             Real stem_end = Stem::stem_end_position (stem);
          
-         stem_posns[d] = Interval (chord_start<?stem_end, chord_start>? stem_end);
-         head_posns[d].unite (hp);
+             stem_posns[d] = Interval (chord_start <? stem_end, chord_start>? stem_end);
+             head_posns[d].unite (hp);
+           }
        }
     }
   while (flip (&d) != LEFT);
diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc
new file mode 100644 (file)
index 0000000..329a77a
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+  spacing-loose-columns.cc --  implement loose column spacing.
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "system.hh"
+#include "paper-column.hh"
+#include "column-x-positions.hh"
+#include "staff-spacing.hh"
+
+
+/* Find the loose columns in POSNS, and drape them around the columns
+   specified in BETWEEN-COLS.  */
+void
+set_loose_columns (System* which, Column_x_positions const *posns)
+{
+  int loose_col_count = posns->loose_cols_.size ();
+  for (int i = 0; i < loose_col_count; i++)
+    {
+      int divide_over = 1;
+      Item *loose = dynamic_cast<Item*> (posns->loose_cols_[i]);
+      Paper_column* col = dynamic_cast<Paper_column*> (loose);
+      
+      if (col->system_)
+       continue;
+      
+      Item *left = 0;
+      Item *right = 0;
+      while (1)
+       {
+         SCM between = loose->get_property ("between-cols");
+         if (!scm_is_pair (between))
+           break;
+
+         Item *le = dynamic_cast<Item*> (unsmob_grob (scm_car (between)));
+         Item *re = dynamic_cast<Item*> (unsmob_grob (scm_cdr (between)));
+
+         if (!(le && re))
+           break;
+         
+         if (!left && le)
+           {
+             left = le->get_column ();
+             if (!left->get_system ())
+               left = left->find_prebroken_piece (RIGHT);
+           }
+
+         divide_over++;
+         loose = right = re->get_column ();
+       }
+
+      if (!right->get_system ())
+       right = right->find_prebroken_piece (LEFT);
+      
+      Grob *common = right->common_refpoint (left, X_AXIS);
+
+      int count = 0;
+      Real total_space = 0.0;  
+      Real total_fixed = 0.0; 
+      for (SCM wish = col->get_property ("spacing-wishes"); scm_is_pair (wish); wish = scm_cdr (wish))
+       {
+         Grob *spacing = unsmob_grob (scm_car (wish));
+         if (Staff_spacing::has_interface (spacing))
+           {
+             Real space = 0.0;
+             Real fixed = 0.0;
+             Staff_spacing::get_spacing_params (spacing, &space, &fixed);
+
+             total_fixed += fixed;
+             total_space += space;
+             count ++;
+           }
+       }
+
+      Real right_point = 0.0;
+      Real distance_to_next = 0.0;
+      if (count)
+       {
+         total_space /= count;
+         total_fixed /= count;
+
+         distance_to_next = total_space;
+         right_point = right->relative_coordinate (common, X_AXIS);
+       }
+      else
+       {
+         Interval my_extent = col->extent (col, X_AXIS);
+         distance_to_next = my_extent[RIGHT] + 1.0;
+         right_point = right->extent (common, X_AXIS)[LEFT];
+       }
+#if 0
+      Real left_point = left->extent (common, X_AXIS)[RIGHT];
+
+      Real space_left = ((right_point - left_point) >? 0.0)
+       - (my_extent.is_empty() ? 0.0 : my_extent.length ());
+
+      Real padding = (space_left / 2) <? 1.0;
+      /*
+       Put it just left of the right column, with a bit of extra space 
+       */
+#endif
+      Real my_offset = right_point - distance_to_next;
+
+      col->system_ = which;
+      col->translate_axis (my_offset - col->relative_coordinate (common, X_AXIS), X_AXIS);
+    }
+}
+
index 75e6fbedd3bb5f8eae39ed282e68a53556cf2e20..623e27176634eb69bd6bb7257e37415f8d74f223 100644 (file)
@@ -180,7 +180,7 @@ Staff_spacing::get_spacing_params (Grob *me, Real * space, Real * fixed)
        */
       
       /*
-       we used to have a warning here, but itgenerates a lot of
+       we used to have a warning here, but it generates a lot of
        spurious error messages.
       */
       return ;
index f3ed96697595dd6e2aa92ab9d4ecfd3f12e54b7e..07fe67029079a126a353efd7bbf921e1d3f5d543 100644 (file)
@@ -647,13 +647,13 @@ Stem::print (SCM smob)
   Grob *lh =
     to_boolean (me->get_property ("avoid-note-head"))
     ? last_head (me)
-    : lh = first_head (me);
+    : first_head (me);
   Grob *beam = get_beam (me);
 
   if (!lh && !stemlet)
     return SCM_EOL;
 
-  if (stemlet && !beam)
+  if (!lh && stemlet && !beam)
     return SCM_EOL;
     
   if (is_invisible (me))
index 2cb82cb99f8036a7d0345912ea7eee50b82f5708..8f1e907f4e93a6a156dfaa92cf34adcefbafb81f 100644 (file)
@@ -165,71 +165,6 @@ System::get_lines ()
   return lines;
 }
 
-/* Find the loose columns in POSNS, and drape them around the columns
-   specified in BETWEEN-COLS.  */
-static void
-set_loose_columns (System* which, Column_x_positions const *posns)
-{
-  int loose_col_count = posns->loose_cols_.size ();
-  for (int i = 0; i < loose_col_count; i++)
-    {
-      int divide_over = 1;
-      Item *loose = dynamic_cast<Item*> (posns->loose_cols_[i]);
-      Paper_column* col = dynamic_cast<Paper_column*> (loose);
-      
-      if (col->system_)
-       continue;
-      
-      Item *left = 0;
-      Item *right = 0;
-      while (1)
-       {
-         SCM between = loose->get_property ("between-cols");
-         if (!scm_is_pair (between))
-           break;
-
-         Item *le = dynamic_cast<Item*> (unsmob_grob (scm_car (between)));
-         Item *re = dynamic_cast<Item*> (unsmob_grob (scm_cdr (between)));
-
-         if (!(le && re))
-           break;
-         
-         if (!left && le)
-           {
-             left = le->get_column ();
-             if (!left->get_system ())
-               left = left->find_prebroken_piece (RIGHT);
-           }
-
-         divide_over++;
-         loose = right = re->get_column ();
-       }
-
-      if (!right->get_system ())
-       right = right->find_prebroken_piece (LEFT);
-      
-      /* Divide the remaining space of the column over the left and
-       right side.  At the moment,  FIXME  */
-      Grob *common = right->common_refpoint (left, X_AXIS);
-      
-      Real right_point = right->extent (common, X_AXIS)[LEFT];
-      Real left_point = left->extent (common, X_AXIS)[RIGHT];
-      Interval my_extent = col->extent (col, X_AXIS);
-
-      Real space_left = (right_point - left_point)
-       - (my_extent.is_empty() ? 0.0 : my_extent.length ());
-
-      Real padding = (space_left / 2) <? 1.0;
-      /*
-       Put it just left of the right column, with a bit of extra space 
-       */
-      Real my_offset = right_point - my_extent[RIGHT] - padding;
-
-      col->system_ = which;
-      col->translate_axis (my_offset - col->relative_coordinate (common, X_AXIS), X_AXIS);
-    }
-}
-
 void
 System::break_into_pieces (Array<Column_x_positions> const &breaking) 
 {
index e2650a18899bed98fbee2c3b9bf7e1a22b93dd03..7973045b7b9e65329d4f96892d572c5140775760 100644 (file)
        ))
     (DynamicTextSpanner
      . ((print-function . ,Dynamic_text_spanner::print)
-       (font-series . bold)
+
+;; rather ugh with NCSB
+;      (font-series . bold)
        (font-shape . italic)
        (style . dashed-line)
 
        ; need to blend with dynamic texts.
-       (font-size . 2)
+       (font-size . 1)
        (bound-padding . 0.75)
        (dash-fraction . 0.2)
        (dash-period . 3.0)
        (break-align-symbol . left-edge)
        (X-extent . (0 . 0))
        (breakable . #t)
+       (break-visibility . ,center-invisible)
        (space-alist . (
                        (custos . (extra-space . 0.0))
                        (ambitus . (extra-space . 2.0))
index dd4fe7b955eacafe0ffee3c1543d8323df488942..6180d86454eb55d0b1fffba1275ddc41bb4d9854 100644 (file)
@@ -223,6 +223,7 @@ centered, X==1 is at the right, X == -1 is at the left."
 (define-safe-public (all-visible d) '(#f . #f))
 (define-safe-public (all-invisible d) '(#t . #t))
 (define-safe-public (begin-of-line-invisible d) (if (= d 1) '(#t . #t) '(#f . #f)))
+(define-safe-public (center-invisible d) (if (= d 0) '(#t . #t) '(#f . #f)))
 (define-safe-public (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))