From: Jürgen Reuter <j@web.de>
Date: Sat, 14 Oct 2006 19:13:34 +0000 (+0000)
Subject: 	* Documentation/user/instrument-notation.itely: Cleanup: Remove
X-Git-Tag: release/2.10.0-2~172
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=77d49282ce7a1579f34509c1badf0902dac0d3fd;p=lilypond.git

	* Documentation/user/instrument-notation.itely: Cleanup: Remove
	annoying skip notes from mensural ligature example.  Update
	@refbugs for ligatures and mensural ligatures.

	* lily/coherent-ligature-engraver.cc,
	lily/include/coherent-ligature-engraver.hh,
	lily/mensural-ligature-engraver.cc,
	lily/vaticana-ligature-engraver.cc: Revise code for item
	reparentizing.  There should now be less programming_error
	messages.

	* lily/mensural-ligature-engraver.cc: Improve placement of dots.

	* lily/mensural-ligature.cc, lily/vaticana-ligature.cc:
	Maintenance bugfix: Don't create empty Stencil (), but empty box
	instead.  This fix should eliminate some programming_error
	messages.

	* ly/engraver-init.ly (MensuralStaff): Set default accidental
	style.

	* input/regression/mensural-ligatures.ly: Maintenance bugfix: Move
	\layout block _before_ score.
---

diff --git a/ChangeLog b/ChangeLog
index 4459c006c5..86c06fc2c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2006-10-14  Jürgen Reuter  <reuter@ipd.uka.de>
+
+	* Documentation/user/instrument-notation.itely: Cleanup: Remove
+	annoying skip notes from mensural ligature example.  Update
+	@refbugs for ligatures and mensural ligatures.
+
+	* lily/coherent-ligature-engraver.cc,
+	lily/include/coherent-ligature-engraver.hh,
+	lily/mensural-ligature-engraver.cc,
+	lily/vaticana-ligature-engraver.cc: Revise code for item
+	reparentizing.  There should now be less programming_error
+	messages.
+
+	* lily/mensural-ligature-engraver.cc: Improve placement of dots.
+
+	* lily/mensural-ligature.cc, lily/vaticana-ligature.cc:
+	Maintenance bugfix: Don't create empty Stencil (), but empty box
+	instead.  This fix should eliminate some programming_error
+	messages.
+
+	* ly/engraver-init.ly (MensuralStaff): Set default accidental
+	style.
+
+	* input/regression/mensural-ligatures.ly: Maintenance bugfix: Move
+	\layout block _before_ score.
+
 2006-10-14  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
 	* GNUmakefile.in (PATCH_FILES): remove darwin.patch.
diff --git a/Documentation/user/instrument-notation.itely b/Documentation/user/instrument-notation.itely
index 880d26909e..488485ccd5 100644
--- a/Documentation/user/instrument-notation.itely
+++ b/Documentation/user/instrument-notation.itely
@@ -3101,8 +3101,6 @@ correctly align with ligatures.
 Accidentals must not be printed within a ligature, but instead need to
 be collected and printed in front of it.
 
-Augmentum dots within ligatures are not handled correctly.
-
 The syntax still uses the deprecated infix style @code{\[ music expr
 \]}.  For consistency reasons, it will eventually be changed to
 postfix style @code{note\[ ... note\]}.  Alternatively, the file
@@ -3158,11 +3156,8 @@ For example,
 \override Staff.TimeSignature #'style = #'neomensural
 \clef "petrucci-g"
 \[ c'\maxima g \]
-s4
 \[ d\longa c\breve f e d \]
-s4
 \[ c'\maxima d'\longa \]
-s4
 \[ e'1 a g\breve \]
 @end example
 @lilypond[quote,ragged-right]
@@ -3174,11 +3169,8 @@ s4
     \override Staff.TimeSignature #'style = #'neomensural
     \clef "petrucci-g"
     \[ c'\maxima g \]
-    s4
     \[ d\longa c\breve f e d \]
-    s4
     \[ c'\maxima d'\longa \]
-    s4
     \[ e'1 a g\breve \]
   }
   \layout {
@@ -3203,19 +3195,15 @@ to the following
   \override Staff.TimeSignature #'style = #'neomensural
   \clef "petrucci-g"
   \[ c'\maxima g \]
-  s4
   \[ d\longa c\breve f e d \]
-  s4
   \[ c'\maxima d'\longa \]
-  s4
   \[ e'1 a g\breve \]
 }
 @end lilypond
 
 @refbugs
 
-The invisible rests (@code{s4}) in the example are used to compensate
-for the poor horizontal spacing.
+Horizontal spacing is poor.
 
 @node Gregorian square neumes ligatures
 @subsubsection Gregorian square neumes ligatures
diff --git a/input/regression/mensural-ligatures.ly b/input/regression/mensural-ligatures.ly
index ef95c1d262..23092e5332 100644
--- a/input/regression/mensural-ligatures.ly
+++ b/input/regression/mensural-ligatures.ly
@@ -6,6 +6,17 @@
 }
 
 
+\layout {
+  ragged-right = ##t
+  packed = ##t
+  indent = 0.0
+  \context {
+    \Voice
+    \remove Ligature_bracket_engraver
+    \consists Mensural_ligature_engraver
+  }
+}
+
 \context Voice{
   \clef "petrucci-c4"
   \set Staff.printKeyCancellation = ##f
@@ -314,17 +325,6 @@
 				%  \]
 }
 
-\layout {
-  ragged-right = ##t
-  packed = ##t
-  indent = 0.0
-  \context {
-    \Voice
-    \remove Ligature_bracket_engraver
-    \consists Mensural_ligature_engraver
-  }
-}
-
 
 % Litterae:
 %
diff --git a/lily/coherent-ligature-engraver.cc b/lily/coherent-ligature-engraver.cc
index 96ff842d0c..198b954b98 100644
--- a/lily/coherent-ligature-engraver.cc
+++ b/lily/coherent-ligature-engraver.cc
@@ -77,44 +77,36 @@
  * TODO: move this function to class Item?
  */
 void
-Coherent_ligature_engraver::get_set_column (Item *item, Paper_column *column)
+Coherent_ligature_engraver::move_related_items_to_column
+(Item *item, Paper_column *target_column, Real offset)
 {
-  Item *parent = dynamic_cast<Item *> (item->get_parent (X_AXIS));
-  if (!parent)
+  Paper_column *source_column = item->get_column ();
+  Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (item);
+  extract_item_set (source_column, "elements", elements);
+  for (vsize i = elements.size (); i--;)
     {
-      programming_error ("failed tweaking paper column in ligature");
-      return;
-    }
-
-  string name = parent->name ();
-  if (name != "PaperColumn")
-    {
-      // Change column not only for targeted item (NoteColumn), but
-      // also for all associated grobs (NoteSpacing, SeparationItem).
-      Grob *sl = Staff_symbol_referencer::get_staff_symbol (item);
+      Item *sibling = elements[i];
+      if (!sibling)
+	// should not occur, but who knows... -jr
+	continue;
 
-      extract_item_set (parent, "elements", elements);
+      if (Staff_symbol_referencer::get_staff_symbol (sibling) != staff_symbol)
+	// sibling is from a staff different than that of the item of
+	// interest
+	continue;
 
-      for (vsize i = elements.size (); i--;)
-	{
-	  Item *sibling = elements[i];
-	  if ((sibling)
-	      && (Staff_symbol_referencer::get_staff_symbol (sibling) == sl))
-	    {
 #if 0 /* experimental code to collapse spacing after ligature */
-	      Grob *sibling_parent = sibling->get_parent (X_AXIS);
-	      sibling_parent->warning (_f ("Coherent_ligature_engraver: "
-					   "setting `spacing-increment="
-					   "0.01': ptr=%ul", parent));
-	      sibling_parent->set_property ("forced-spacing",
-					    scm_from_double (0.01));
+      Grob *sibling_parent = sibling->get_parent (X_AXIS);
+      sibling_parent->warning (_f ("Coherent_ligature_engraver: "
+				   "setting `spacing-increment="
+				   "0.01': ptr=%ul", parent));
+      sibling_parent->set_property ("forced-spacing",
+				    scm_from_double (0.01));
 #endif
-	      sibling->set_parent (column, X_AXIS);
-	    }
-	}
+
+      sibling->set_parent (target_column, X_AXIS);
+      sibling->translate_axis (offset, X_AXIS);
     }
-  else
-    get_set_column (parent, column);
 }
 
 /*
diff --git a/lily/include/coherent-ligature-engraver.hh b/lily/include/coherent-ligature-engraver.hh
index e8422d9eb1..89eb6b9e32 100644
--- a/lily/include/coherent-ligature-engraver.hh
+++ b/lily/include/coherent-ligature-engraver.hh
@@ -21,7 +21,7 @@ protected:
 			       vector<Grob_info> primitives) = 0;
   virtual void typeset_ligature (Spanner *ligature,
 				 vector<Grob_info> primitives);
-  virtual void get_set_column (Item *, Paper_column *);
+  virtual void move_related_items_to_column (Item *, Paper_column *, Real);
 private:
   void collect_accidentals (Spanner *, vector<Grob_info>);
 };
diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc
index f40ce004b0..af2d5b0e6b 100644
--- a/lily/mensural-ligature-engraver.cc
+++ b/lily/mensural-ligature-engraver.cc
@@ -31,9 +31,6 @@
  * TODO: prohibit ligatures having notes differing only in accidentals
  * (like \[ a\breve g as \])
  *
- * TODO: dotted heads: avoid next note colliding with the dot, e.g. by
- * putting it *above* (rather than after) the affected ligature head.
- *
  * TODO: do something with multiple voices within a ligature.  See
  * for example:
  * Ockeghem: Missa Ecce ancilla domini, bassus part, end of Christe.
@@ -366,21 +363,45 @@ void
 Mensural_ligature_engraver::fold_up_primitives (vector<Grob_info> primitives)
 {
   Item *first = 0;
-  Real distance = 0;
+  Real distance = 0.0;
+  Real dot_shift = 0.0;
   for (vsize i = 0; i < primitives.size (); i++)
     {
       Item *current = dynamic_cast<Item *> (primitives[i].grob ());
       if (i == 0)
-	first = current;
-
-      get_set_column (current, first->get_column ());
+	{
+	  first = current;
+	  dot_shift = 1.5 * Staff_symbol_referencer::staff_space (first);
+	}
 
-      if (i > 0)
-	current->translate_axis (distance, X_AXIS);
+      move_related_items_to_column (current, first->get_column (),
+				    distance);
 
       distance
 	+= scm_to_double (current->get_property ("head-width"))
 	- scm_to_double (current->get_property ("thickness"));
+
+      if (Rhythmic_head::dot_count (current) > 0)
+	// Move dots above/behind the ligature.
+	{
+	  if (i < primitives.size () - 1)
+	    // dot in the midst => move above head
+	    {
+	      // FIXME: Amount of vertical dot-shift should depend on
+	      // pitch.
+	      //
+	      // FIXME: dot placement is horizontally slightly off.
+	      Rhythmic_head::get_dots (current)->translate_axis (dot_shift, Y_AXIS);
+	    }
+	  else
+	    // trailing dot => move behind head
+	    {
+	      double head_width =
+		scm_to_double (current->get_property ("head-width"));
+	      Rhythmic_head::get_dots (current)->
+		translate_axis (head_width, X_AXIS);
+	    }
+	}
     }
 }
 
diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc
index 5f1d0e6df1..a351494325 100644
--- a/lily/mensural-ligature.cc
+++ b/lily/mensural-ligature.cc
@@ -96,7 +96,7 @@ internal_brew_primitive (Grob *me)
     {
       programming_error ("Mensural_ligature: "
 			 "undefined primitive -> ignoring grob");
-      return Stencil ();
+      return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
     }
   int primitive = scm_to_int (primitive_scm);
 
@@ -121,7 +121,7 @@ internal_brew_primitive (Grob *me)
   switch (primitive & MLP_ANY)
     {
     case MLP_NONE:
-      return Stencil ();
+      return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
     case MLP_LONGA: // mensural brevis head with right cauda
       out = Font_interface::get_default_font (me)->find_by_name
 	("noteheads.s-2mensural");
@@ -140,7 +140,7 @@ internal_brew_primitive (Grob *me)
     default:
       programming_error (_f ("Mensural_ligature: "
 			     "unexpected case fall-through"));
-      return Stencil ();
+      return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
     }
 
   Real blotdiameter
diff --git a/lily/vaticana-ligature-engraver.cc b/lily/vaticana-ligature-engraver.cc
index 8660ed6e01..94fe3f293d 100644
--- a/lily/vaticana-ligature-engraver.cc
+++ b/lily/vaticana-ligature-engraver.cc
@@ -344,8 +344,7 @@ Vaticana_ligature_engraver::align_heads (vector<Grob_info> primitives,
       /*
        * Horizontally line-up this head to form a ligature.
        */
-      get_set_column (primitive, column);
-      primitive->translate_axis (ligature_width, X_AXIS);
+      move_related_items_to_column (primitive, column, ligature_width);
       ligature_width += head_width;
 
       prev_primitive = primitive;
diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc
index 6c0beaf387..411953ea87 100644
--- a/lily/vaticana-ligature.cc
+++ b/lily/vaticana-ligature.cc
@@ -176,7 +176,7 @@ vaticana_brew_join (Grob *me, int delta_pitch,
     {
       me->programming_error (_f ("Vaticana_ligature: "
 				 "zero join (delta_pitch == 0)"));
-      return Stencil ();
+      return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
     }
   Interval x_extent = Interval (0, join_thickness);
   Interval y_extent = (delta_pitch > 0)
@@ -194,7 +194,7 @@ vaticana_brew_primitive (Grob *me)
     {
       me->programming_error ("Vaticana_ligature: "
 			     "undefined glyph-name -> ignoring grob");
-      return Stencil ();
+      return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
     }
 
   string glyph_name = ly_scm2string (glyph_name_scm);
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index 2687de00ff..4e04bfe847 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -866,6 +866,13 @@ AncientRemoveEmptyStaffContext = \context {
   \override Custos #'style = #'mensural
   \override Custos #'neutral-position = #3
   \override Custos #'neutral-direction = #DOWN
+
+  %% Accidentals are valid only once (same as
+  %% #(set-accidental-style 'forget))
+  extraNatural = ##f
+  autoAccidentals = #'(Staff (same-octave . -1))
+  autoCautionaries = #'()  
+  printKeyCancellation = ##f
 }