]> git.donarmstrong.com Git - lilypond.git/commitdiff
Improved implementation of dashed slurs.
authorCarl Sorensen <c_sorensen@byu.edu>
Fri, 17 Apr 2009 03:45:13 +0000 (21:45 -0600)
committerCarl Sorensen <c_sorensen@byu.edu>
Fri, 17 Apr 2009 15:19:10 +0000 (09:19 -0600)
Update dashed slurs to have variable thickness.

Dashed slurs are now written as bezier sandwiches, like regular
slurs.

Moved dash-period and dash-fraction from properties for slurs,
phrasingSlurs, and ties.  Created new property dash-definition
that contains a list of dash-descriptions for each segment of the
slur.

Defined new commands \slurHalfDashed, \slurHalfSolid,
\phrasingSlurHalfDashed, \phrasingSlurHalfSolid,
\tieHalfDashed, and \tieHalfSolid.

Defined new commands \slurDashPattern,
\phrasingSlurDashPattern, and \tieDashPattern.

Changed bezier-sandwich interface to include thickness parameter
that is used for slurs.  This required changes to vaticana=ligature.

Added extract and split to Bezier class.

Adjusted header files to reflect new calling lists.

arpeggio.cc is changed because there is a slur-arpeggio type.

Adjusted documentation to reflect changes.

Fix regression tests for dashed ties, slurs, phrasing slurs

17 files changed:
Documentation/user/expressive.itely
Documentation/user/rhythms.itely
input/new/making-slurs-with-complex-dash-structure.ly [new file with mode: 0644]
input/regression/phrasing-slur-dash.ly
input/regression/slur-dash.ly
input/regression/tie-dash.ly [new file with mode: 0644]
lily/arpeggio.cc
lily/bezier.cc
lily/include/bezier.hh
lily/include/lookup.hh
lily/lookup.cc
lily/slur.cc
lily/tie.cc
lily/vaticana-ligature.cc
ly/property-init.ly
python/convertrules.py
scm/define-grob-properties.scm

index 23ca4faba3522bb527914181799699247cf00210..cf1a09547c55f1a9e8d025fcccaea77389dc1bbc 100644 (file)
@@ -575,6 +575,37 @@ c4( e g2)
 g4( e c2)
 @end lilypond
 
+@funindex \slurHalfDashed
+@funindex slurHalfDashed
+@funindex \slurHalfSolid
+@funindex slurHalfSolid
+
+Slurs can also be made half-dashed (the first half dashed, the
+second half solid) or half-solid (the first half solid, the second
+half dashed):
+
+@lilypond[verbatim,quote,relative=1]
+\slurHalfDashed
+g4( e c2)
+\slurHalfSolid
+c4( e g2)
+\slurSolid
+g4( e c2)
+@end lilypond
+
+Custom dash patterns for slurs can be defined:
+
+@lilypond[verbatim,quote,relative=1]
+\slurDashPattern #0.7 #0.75
+g4( e c2)
+\slurDashPattern #0.5 #2.0
+c4( e g2)
+\slurSolid
+g4( e c2)
+@end lilypond
+
+
+
 @funindex \slurUp
 @funindex slurUp
 
@@ -585,6 +616,9 @@ g4( e c2)
 @code{\slurNeutral},
 @code{\slurDashed},
 @code{\slurDotted},
+@code{\slurHalfDashed},
+@code{\slurHalfSolid},
+@code{\slurDashPattern},
 @code{\slurSolid}.
 @endpredefined
 
@@ -597,6 +631,9 @@ g4( e c2)
 @lilypondfile[verbatim,lilyquote,texidoc,doctitle]
 {positioning-text-markups-inside-slurs.ly}
 
+@lilypondfile[verbatim,lilyquote,texidoc,doctitle]
+{making-slurs-with-complex-dash-structure.ly}
+
 @seealso
 Music Glossary:
 @rglos{slur}.
@@ -640,12 +677,6 @@ e2) d\)
 @funindex phrasingSlurDown
 @funindex \phrasingSlurNeutral
 @funindex phrasingSlurNeutral
-@funindex phrasingSlurDashed
-@funindex \phrasingSlurDashed
-@funindex \phrasingSlurDotted
-@funindex phrasingSlurDotted
-@funindex \phrasingSlurSolid
-@funindex phrasingSlurSolid
 
 Typographically, a phrasing slur behaves almost exactly like a
 normal slur.  However, they are treated as different objects; a
@@ -668,6 +699,13 @@ c4\( g' c,( b) | c1\)
 
 Simultaneous or overlapping phrasing slurs are not permitted.
 
+@funindex phrasingSlurDashed
+@funindex \phrasingSlurDashed
+@funindex \phrasingSlurDotted
+@funindex phrasingSlurDotted
+@funindex \phrasingSlurSolid
+@funindex phrasingSlurSolid
+
 Phrasing slurs can be solid, dotted, or dashed.  Solid is the default
 style for phrasing slurs:
 
@@ -681,6 +719,42 @@ c4\( e g2\)
 g4\( e c2\)
 @end lilypond
 
+@funindex phrasingSlurHalfDashed
+@funindex \phrasingSlurHalfDashed
+@funindex \phrasingSlurHalfSolid
+@funindex phrasingSlurHalfSolid
+
+Phrasing slurs can also be made half-dashed (the first half dashed, the
+second half solid) or half-solid (the first half solid, the second
+half dashed):
+
+@lilypond[verbatim,quote,relative=1]
+\phrasingSlurHalfDashed
+g4( e c2)
+\phrasingSlurHalfSolid
+c4( e g2)
+\phrasingSlurSolid
+g4( e c2)
+@end lilypond
+
+@funindex \phrasingSlurDashPattern
+@funindex phrasingSlurDashPattern
+
+
+Custom dash patterns for phrasing slurs can be defined:
+
+@lilypond[verbatim,quote,relative=1]
+\phrasingSlurDashPattern #0.7 #0.75
+g4( e c2)
+\phrasingSlurDashPattern #0.5 #2.0
+c4( e g2)
+\phrasingSlurSolid
+g4( e c2)
+@end lilypond
+
+Dash pattern definitions for phrasing slurs have the same structure
+as dash pattern definitions for slurs.  For more information about
+complex dash patterns, see the snippets under @ref{Slurs}.
 
 @predefined
 @code{\phrasingSlurUp},
@@ -688,6 +762,9 @@ g4\( e c2\)
 @code{\phrasingSlurNeutral},
 @code{\phrasingSlurDashed},
 @code{\phrasingSlurDotted},
+@code{\phrasingSlurHalfDashed},
+@code{\phrasingSlurHalfSolid},
+@code{\phrasingSlurDashPattern},
 @code{\phrasingSlurSolid}.
 @endpredefined
 
@@ -697,7 +774,8 @@ Learning Manual:
 @rlearning{On the un-nestedness of brackets and ties}.
 
 Notation Reference:
-@ref{Direction and placement}.
+@ref{Direction and placement},
+@ref{Slurs}.
 
 Snippets:
 @rlsr{Expressive marks}.
index 2c63d75d21e59d95780f750000a5c84d16231c2e..dd4745a96ad71193751af6d4ab75c374670a1f55 100644 (file)
@@ -383,7 +383,7 @@ indicate articulation, or @emph{phrasing slurs}, which indicate
 musical phrasing.  A tie is just a way of extending a note
 duration, similar to the augmentation dot.}
 
-A tie is entered using the tilde symbol @code{~}
+A tie is entered using the tilde symbol (@code{~}).
 
 @lilypond[quote,verbatim,relative=2]
 a2 ~ a
@@ -481,9 +481,37 @@ Predefined commands, or for details, see
 @funindex \tieSolid
 @funindex tieSolid
 
-Solid, dotted or dashed ties may be specified, see Predefined
-commands.
+Ties may be made dashed, dotted, or a combination of solid and
+dashed.
 
+@lilypond[quote, verbatim, relative=1]
+\tieDotted
+c2 ~ c
+\tieDashed
+c2 ~ c
+\tieHalfDashed
+c2 ~ c
+\tieHalfSolid
+c2 ~ c
+\tieSolid
+c2 ~ c
+@end lilypond
+
+Custom dash patterns can be specified:
+
+@lilypond[quote, verbatim, relative=1]
+\tieDashPattern #0.3 #0.75
+c2 ~ c
+\tieDashPattern #0.7 #1.5
+c2 ~ c
+\tieSolid
+c2 ~ c
+@end lilypond
+
+Dash pattern definitions for ties have the same structure as 
+dash pattern definitions for slurs.
+For more information about complex dash patterns,
+see the snippets under @ref{Slurs}. 
 
 @predefined
 @code{\tieUp},
@@ -491,6 +519,9 @@ commands.
 @code{\tieNeutral},
 @code{\tieDotted},
 @code{\tieDashed},
+@code{\tieDashPattern},
+@code(\tieHalfDashed),
+@code{\tieHalfSolid),
 @code{\tieSolid}.
 @endpredefined
 
@@ -509,7 +540,9 @@ Music Glossary:
 @rglos{tie},
 @rglos{laissez vibrer}.
 
-Notation Reference: @ref{Automatic note splitting}.
+Notation Reference: 
+@ref{Slurs},
+@ref{Automatic note splitting}.
 
 Snippets:
 @rlsr{Rhythms}.
diff --git a/input/new/making-slurs-with-complex-dash-structure.ly b/input/new/making-slurs-with-complex-dash-structure.ly
new file mode 100644 (file)
index 0000000..fd41dd7
--- /dev/null
@@ -0,0 +1,37 @@
+\version "2.13.1"
+
+\header{
+  texidoc = "
+Slurs can be made with complex dash patterns by defining
+the @code{dash-definition} property.  @code{dash-definition}
+is a list of @code{dash-elements}.  A @code{dash-element} is a
+list of parameters defining the dash behavior for a segment of
+the slur.
+
+The slur is defined in terms of the bezier parameter t
+which ranges from 0
+at the left end of the slur to 1 at the right end of the slur.
+@code{dash-element} is a list @code{(start-t stop-t dash-fraction
+dash-period)}.  The region of the slur from @code{start-t} to
+@code{stop-t} will have a fraction @code{dash-fraction}
+of each @code{dash-period} black.  @code{dash-period} is
+defined in terms of staff spaces.  @code{dash-fraction} is
+set to 1 for a solid slur.
+"
+  doctitle = "Making slurs with complex dash structure"
+}
+
+\relative c' {
+  \once \override 
+    Slur #'dash-definition = #'((0 0.3 0.1 0.75)
+                                (0.3 0.6 1 1)
+                                (0.65 1.0 0.4 0.75))
+  c( d e f)
+  \once \override 
+    Slur #'dash-definition = #'((0 0.25 1 1)
+                                (0.3 0.7 0.4 0.75)
+                                (0.75 1.0 1 1))
+  c( d e f)
+}
+
+
index f8b13f57d9dc6fd971359115002766723e29c786..d37053264da9d183fa5544b183a808f31d371083 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.12.0"
+\version "2.13.1"
 \header { texidoc = "
 The appearance of phrasing slurs may be changed from solid to dotted or dashed.
 "
@@ -10,8 +10,15 @@ The appearance of phrasing slurs may be changed from solid to dotted or dashed.
   c\( d e  c\) |
   \phrasingSlurDashed
   c\( d e  c\) |
-  \override PhrasingSlur #'dash-period = #2.0
-  \override PhrasingSlur #'dash-fraction = #0.4
+  \phrasingSlurHalfDashed
+  c\( d e  c\) |
+  \phrasingSlurHalfSolid
+  c\( d e  c\) |
+  \phrasingSlurDashPattern #0.4 #2.0
+  c\( d e  c\) |
+  \once \override Slur #'dash-definition = #'((0 0.25 1 1)
+                                              (0.3 0.7 0.4 0.75)
+                                              (0.75 1.0 1.0 1.0))
   c\( d e  c\) |
   \phrasingSlurSolid
   c\( d e  c\) |
index cd80e244b85e89565eee59a317893b10bfd78e1e..b1d111d2285338ca3dddbdbc1b5d9bea6a104871 100644 (file)
@@ -1,4 +1,4 @@
-\version "2.12.0"
+\version "2.13.1"
 \header {texidoc = "@cindex Slur, dotted, dashed
 The appearance of slurs may be changed from solid to dotted or dashed.
 "
@@ -7,16 +7,23 @@ The appearance of slurs may be changed from solid to dotted or dashed.
 
 
 \relative c'{
-  c( d e  c) |
+  c( d e c) |
   \slurDotted
-  c( d e  c) |
+  c( d e c) |
   \slurDashed
-  c( d e  c) |
-  \override Slur #'dash-period = #2.0
-  \override Slur #'dash-fraction = #0.4
-  c( d e  c) |
+  c( d e c) |
+  \slurHalfDashed
+  c( d e c) |
+  \slurHalfSolid
+  c( d e c) |
+  \slurDashPattern #0.4 #2.0
+  c( d e c) |
+  \once \override Slur #'dash-definition = #'((0 0.25 1 1)
+                                              (0.3 0.7 0.4 0.75)
+                                              (0.75 1.0 1.0 1.0))
+  c( d e c) |
   \slurSolid
-  c( d e  c) |
+  c( d e c) |
 }
 
 
diff --git a/input/regression/tie-dash.ly b/input/regression/tie-dash.ly
new file mode 100644 (file)
index 0000000..7ad1815
--- /dev/null
@@ -0,0 +1,33 @@
+\version "2.13.1"
+\header {texidoc = "@cindex Tie, dotted, dashed
+The appearance of ties may be changed from solid to dotted or dashed.
+"
+} 
+\layout{ ragged-right=##t }
+
+
+\relative c'{
+  c2 ~ c |
+  \tieDotted
+  c2 ~ c |
+  \tieDashed
+  c2 ~ c |
+  \tieHalfDashed
+  c2 ~ c |
+  \tieHalfSolid
+  c2 ~ c |
+  \tieDashPattern #0.4 #2.0
+  c2 ~ c |
+  \once \override Tie #'dash-definition = #'((0 0.25 1 1)
+                                             (0.3 0.7 0.4 0.75)
+                                             (0.75 1.0 1.0 1.0))
+  c2 ~ c |
+  \tieSolid
+  c2 ~ c |
+}
+
+
+
+
+
+
index 7873b5f39cc807bfe7055c9eb972855a26dd092e..0265b3deddeb5d8a94f4488c1bffb84de3dca00b 100644 (file)
@@ -165,7 +165,7 @@ Arpeggio::brew_chord_slur (SCM smob)
   Bezier curve = slur_shape (dy, height_limit, ratio);
   curve.rotate (M_PI / 2);
 
-  Stencil mol (Lookup::slur (curve, lt, lt));
+  Stencil mol (Lookup::slur (curve, lt, lt, SCM_UNDEFINED));
   mol.translate_axis (heads[LEFT], Y_AXIS);
   return mol.smobbed_copy ();
 }
index 3712b9213ef91c26ab1d5fb74d0fb56127dc5c06..b9044063baffa5d494aab1b3d8cec59eecf7a552 100644 (file)
@@ -265,3 +265,53 @@ Bezier::reverse ()
     b2.control_[CONTROL_COUNT - i - 1] = control_[i];
   *this = b2;
 }
+
+
+/*
+  Subdivide a bezier at T into LEFT_PART and RIGHT_PART
+  using deCasteljau's algorithm.
+*/
+void
+Bezier::subdivide (Real t, Bezier &left_part, Bezier &right_part)
+{
+  Offset p[CONTROL_COUNT][CONTROL_COUNT];
+
+  for (int i = 0; i < CONTROL_COUNT ; i++)
+    p[i][CONTROL_COUNT - 1 ] = control_[i];
+  for (int j = CONTROL_COUNT - 2; j >= 0 ; j--)
+  for (int i = 0; i < CONTROL_COUNT -1; i++)
+    p[i][j] = p[i][j+1] + t * (p[i+1][j+1] - p[i][j+1]);
+  for (int i = 0; i < CONTROL_COUNT; i++)
+    {
+      left_part.control_[i]=p[0][CONTROL_COUNT - 1 - i];
+      right_part.control_[i]=p[i][i];
+    }
+}
+
+/*
+  Extract a portion of a bezier from T_MIN to T_MAX
+*/
+
+Bezier
+Bezier::extract (Real t_min, Real t_max)
+{
+  Bezier bez1, bez2, bez3, bez4;
+  if (t_min == 0.0)
+    {
+      for (int i = 0; i < CONTROL_COUNT; i++)
+        bez2.control_[i] = control_[i];
+    }
+  else
+    {
+      subdivide (t_min, bez1, bez2);
+    }
+  if (t_max == 1.0)
+    {
+      return bez2;
+    }
+  else
+   {
+     bez2.subdivide ((t_max-t_min)/(1-t_min), bez3, bez4);
+     return bez3;
+  }
+}
index a04d449725ab17f346df4d20daa5286df7de0d4c..5cfca578c2ebd5270095076cc91788adb6a3bd42 100644 (file)
@@ -22,6 +22,8 @@ public:
   void reverse ();
   void rotate (Real);
   void translate (Offset);
+  void subdivide (Real, Bezier &, Bezier &);
+  Bezier extract (Real, Real);
 
   Real get_other_coordinate (Axis a, Real x) const;
   vector<Real> solve_point (Axis, Real coordinate) const;
index 8f0844df71efb7a09f875171e77972034a84e9ee..bfe5d57b0326ed37895ae402ab63c1193c5ccba5 100644 (file)
@@ -20,10 +20,11 @@ struct Lookup
   static Stencil rotated_box (Real slope, Real width, Real thick, Real blot);
   static Stencil round_filled_polygon (vector<Offset> const &points, Real blotdiameter);
   static Stencil frame (Box b, Real thick, Real blot);
-  static Stencil slur (Bezier controls, Real cthick, Real thick);
-  static Stencil bezier_sandwich (Bezier top_curve, Bezier bottom_curve);
+  static Stencil slur (Bezier controls, Real cthick, Real thick, 
+                       SCM dash_definition);
+  static Stencil bezier_sandwich (Bezier top_curve, Bezier bottom_curve,
+                                  Real thickness);
   static Stencil beam (Real slope, Real width, Real thick, Real blot);
-  static Stencil dashed_slur (Bezier b, Real thick, Real dash_period, Real dash_fraction);
   static Stencil blank (Box b);
   static Stencil filled_box (Box b);
   static Stencil round_filled_box (Box b, Real blotdiameter);
index 014d2ec8aba399a8552c621cae16c6a296bf2240..b557986c0742a7f7ed5981d6ab1dd2bd0bf527cc 100644 (file)
@@ -86,28 +86,6 @@ Lookup::beam (Real slope, Real width, Real thick, Real blot)
   return Stencil (b, expr);
 }
 
-Stencil
-Lookup::dashed_slur (Bezier b, Real thick, Real dash_period, Real dash_fraction)
-{
-  SCM l = SCM_EOL;
-
-  Real on = dash_fraction * dash_period;
-  Real off = dash_period - on;
-
-  for (int i = 4; i--;)
-    l = scm_cons (ly_offset2scm (b.control_[i]), l);
-
-  SCM at = (scm_list_n (ly_symbol2scm ("dashed-slur"),
-                       scm_from_double (thick),
-                       scm_from_double (on),
-                       scm_from_double (off),
-                       ly_quote_scm (l),
-                       SCM_UNDEFINED));
-
-  Box box (b.extent (X_AXIS), b.extent (Y_AXIS));
-  return Stencil (box, at);
-}
-
 Stencil
 Lookup::rotated_box (Real slope, Real width, Real thick, Real blot)
 {
@@ -365,47 +343,74 @@ Lookup::frame (Box b, Real thick, Real blot)
   Make a smooth curve along the points
 */
 Stencil
-Lookup::slur (Bezier curve, Real curvethick, Real linethick)
+Lookup::slur (Bezier curve, Real curvethick, Real linethick,
+              SCM dash_details)
 {
+  Stencil return_value;
+
+  /* calculate the offset for the two beziers that make the sandwich
+   *   for the slur
+  */
   Real alpha = (curve.control_[3] - curve.control_[0]).arg ();
   Bezier back = curve;
   Offset perp = curvethick * complex_exp (Offset (0, alpha + M_PI / 2)) * 0.5;
-  back.reverse ();
   back.control_[1] += perp;
   back.control_[2] += perp;
 
   curve.control_[1] -= perp;
   curve.control_[2] -= perp;
-
-  SCM scontrols[8];
-
-  for (int i = 0; i < 4; i++)
-    scontrols[i] = ly_offset2scm (back.control_[i]);
-  for (int i = 0; i < 4; i++)
-    scontrols[i + 4] = ly_offset2scm (curve.control_[i]);
-
-  /*
-    Need the weird order b.o. the way PS want its arguments
-  */
-  int indices[] = {5, 6, 7, 4, 1, 2, 3, 0};
-  SCM list = SCM_EOL;
-  for (int i = 8; i--;)
-    list = scm_cons (scontrols[indices[i]], list);
-
-  SCM at = (scm_list_n (ly_symbol2scm ("bezier-sandwich"),
-                       ly_quote_scm (list),
-                       scm_from_double (linethick),
-                       SCM_UNDEFINED));
-  Box b (curve.extent (X_AXIS),
-        curve.extent (Y_AXIS));
-
-  b[X_AXIS].unite (back.extent (X_AXIS));
-  b[Y_AXIS].unite (back.extent (Y_AXIS));
-
-  b.widen (0.5 * linethick, 0.5 * linethick);
-  return Stencil (b, at);
+  if ((dash_details == SCM_UNDEFINED) || (dash_details == SCM_EOL))
+    { /* solid slur  */
+      return_value = bezier_sandwich (back, curve, linethick);
+    }
+  else
+    { /* dashed or combination slur */
+      int num_segments = scm_to_int (scm_length (dash_details));
+      for (int i=0; i<num_segments; i++)
+        {
+          SCM dash_pattern = scm_list_ref (dash_details, scm_from_int (i));
+          Real t_min = robust_scm2double (scm_car (dash_pattern), 0);
+          Real t_max = robust_scm2double (scm_cadr (dash_pattern), 1.0);
+          Real dash_fraction = 
+            robust_scm2double (scm_caddr (dash_pattern), 1.0);
+          Real dash_period = 
+            robust_scm2double (scm_cadddr (dash_pattern), 0.75);
+          Bezier back_segment = back.extract (t_min, t_max);
+          Bezier curve_segment = curve.extract (t_min, t_max);
+          if (dash_fraction == 1.0) 
+            {
+              return_value.add_stencil (bezier_sandwich (back_segment,
+                                                         curve_segment,
+                                                         linethick));
+            }
+          else
+            {
+              Bezier back_dash, curve_dash;
+              Real seg_length = (back_segment.control_[3] - 
+                                 back_segment.control_[0]).length ();
+              int pattern_count = seg_length / dash_period;
+              Real pattern_length = 1.0 / (pattern_count + dash_fraction);
+              Real start_t, end_t;
+              for (int p = 0; p <= pattern_count; p++)
+                {
+                  start_t = p * pattern_length;
+                  end_t = (p + dash_fraction) * pattern_length;
+                  back_dash = 
+                    back_segment.extract (start_t, end_t);
+                  curve_dash =
+                    curve_segment.extract (start_t, end_t);
+                  return_value.add_stencil (bezier_sandwich (back_dash,
+                                                             curve_dash,
+                                                             linethick));
+                }
+            }
+        }/* end for num_segments */
+    }/* end dashed or combination slur */
+  return return_value;
 }
 
+
 /*
  * Bezier Sandwich:
  *
@@ -430,7 +435,7 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick)
  *
  */
 Stencil
-Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve)
+Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve, Real thickness)
 {
   /*
     Need the weird order b.o. the way PS want its arguments
@@ -447,7 +452,7 @@ Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve)
 
   SCM horizontal_bend = scm_list_n (ly_symbol2scm ("bezier-sandwich"),
                                    ly_quote_scm (list),
-                                   scm_from_double (0.0),
+                                   scm_from_double (thickness),
                                    SCM_UNDEFINED);
 
   Interval x_extent = top_curve.extent (X_AXIS);
@@ -456,6 +461,7 @@ Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve)
   y_extent.unite (bottom_curve.extent (Y_AXIS));
   Box b (x_extent, y_extent);
 
+  b.widen (0.5 * thickness, 0.5 * thickness);
   return Stencil (b, horizontal_bend);
 }
 
index b1794ad4014828bff6b1c9b8f62f89b944d3e10a..7eea1c24d08597dce719e2578ac3a5893ea73470 100644 (file)
@@ -119,15 +119,11 @@ Slur::print (SCM smob)
   Bezier one = get_curve (me);
   Stencil a;
 
-  SCM p = me->get_property ("dash-period");
-  SCM f = me->get_property ("dash-fraction");
-  if (scm_is_number (p) && scm_is_number (f))
-    a = Lookup::dashed_slur (one, line_thick, robust_scm2double (p, 1.0),
-                            robust_scm2double (f, 0));
-  else
-    a = Lookup::slur (one,
-                     get_grob_direction (me) * base_thick,
-                     line_thick);
+  SCM dash_definition = me->get_property ("dash-definition");
+  a = Lookup::slur (one,
+                    get_grob_direction (me) * base_thick,
+                   line_thick,
+                    dash_definition);
 
 #if DEBUG_SLUR_SCORING
   SCM annotation = me->get_property ("annotation");
@@ -417,8 +413,7 @@ ADD_INTERFACE (Slur,
               "annotation "
               "avoid-slur "    /* UGH. */
               "control-points "
-              "dash-fraction "
-              "dash-period "
+               "dash-definition "
               "details "
               "direction "
               "eccentricity "
index 5c64db64940522c4427a21a868e17fdcc5b9ea8a..27033eaeaa1baca379388244104e8dd0cdf2dd92 100644 (file)
@@ -265,17 +265,11 @@ Tie::print (SCM smob)
 
   Stencil a;
 
-  SCM p = me->get_property ("dash-period");
-  SCM f = me->get_property ("dash-fraction");
-  if (scm_is_number (p) && scm_is_number (f))
-    a = Lookup::dashed_slur (b,
-                            line_thick,
-                            robust_scm2double (p, 1.0),
-                            robust_scm2double (f, 0));
-  else
-    a = Lookup::slur (b,
-                     get_grob_direction (me) * base_thick,
-                     line_thick);
+  SCM dash_definition = me->get_property ("dash-definition");
+  a = Lookup::slur (b,
+                   get_grob_direction (me) * base_thick,
+                   line_thick,
+                    dash_definition);
 
 #if DEBUG_TIE_SCORING
   SCM annotation = me->get_property ("annotation");
@@ -315,8 +309,7 @@ ADD_INTERFACE (Tie,
               "annotation "
               "avoid-slur "    //  UGH.
               "control-points "
-              "dash-fraction "
-              "dash-period "
+               "dash-definition "
               "details "
               "direction "
               "head-direction "
index 3a37fb5dce57b1dcc30f727a79a54d54f41fda3f..861e4352a8dff1ff62027fd1f63f6eb1fa18f2c0 100644 (file)
@@ -126,7 +126,7 @@ vaticana_brew_flexa (Grob *me,
   if (solid)
     {
       Stencil solid_head
-       = Lookup::bezier_sandwich (top_curve, bottom_curve);
+       = Lookup::bezier_sandwich (top_curve, bottom_curve, 0.0);
       stencil.add_stencil (solid_head);
     }
   else // outline
@@ -134,13 +134,13 @@ vaticana_brew_flexa (Grob *me,
       Bezier inner_top_curve = top_curve;
       inner_top_curve.translate (Offset (0.0, -line_thickness));
       Stencil top_edge
-       = Lookup::bezier_sandwich (top_curve, inner_top_curve);
+       = Lookup::bezier_sandwich (top_curve, inner_top_curve, 0.0);
       stencil.add_stencil (top_edge);
 
       Bezier inner_bottom_curve = bottom_curve;
       inner_bottom_curve.translate (Offset (0.0, +line_thickness));
       Stencil bottom_edge
-       = Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve);
+       = Lookup::bezier_sandwich (bottom_curve, inner_bottom_curve, 0.0);
       stencil.add_stencil (bottom_edge);
 
       /*
index 2d50a6c6019569271214b6c1ca09e0acada8552d..010b5ac0a9bf618a8489e10de0225fd928ca8c24 100644 (file)
@@ -10,35 +10,63 @@ slurUp = \override Slur #'direction = #UP
 slurDown = \override Slur #'direction = #DOWN
 slurNeutral = \revert Slur #'direction
 
+#(define (make-simple-dash-definition dash-fraction dash-period)
+    (list (list 0 1 dash-fraction dash-period)))
+
 slurDashed = {
-  \override Slur #'dash-period = #0.75
-  \override Slur #'dash-fraction = #0.4
-}
+  \override Slur #'dash-definition =  #'((0 1 0.4 0.75))
+}
+slurDashPattern = 
+#(define-music-function (parser location dash-fraction dash-period)
+  (number? number?)
+  #{
+     \override Slur #'dash-definition =
+       $(make-simple-dash-definition dash-fraction dash-period)
+  #})
 slurDotted = {
-  \override Slur #'dash-period = #0.75
-  \override Slur #'dash-fraction = #0.1
+  \override Slur #'dash-definition =  #'((0 1 0.1 0.75))
+}
+slurHalfDashed = {
+  \override Slur #'dash-definition =  #'((0 0.5 0.4 0.75)
+                                         (0.5 1 1 1))
+}
+slurHalfSolid = {
+  \override Slur #'dash-definition =  #'((0 0.5 1 1)
+                                         (0.5 1 0.4 0.75))
 }
 slurSolid = {
-  \revert Slur #'dash-period
-  \revert Slur #'dash-fraction
+  \revert Slur #'dash-definition
 }
 
 
+
 phrasingSlurUp = \override PhrasingSlur #'direction = #UP
 phrasingSlurDown = \override PhrasingSlur #'direction = #DOWN
 phrasingSlurNeutral = \revert PhrasingSlur #'direction
 
 phrasingSlurDashed = {
-  \override PhrasingSlur #'dash-period = #0.75
-  \override PhrasingSlur #'dash-fraction = #0.4
-}
+  \override PhrasingSlur #'dash-definition =  #'((0 1 0.4 0.75))
+}
+phrasingSlurDashPattern = 
+#(define-music-function (parser location dash-fraction dash-period)
+  (number? number?)
+  #{
+     \override PhrasingSlur #'dash-definition =
+       $(make-simple-dash-definition dash-fraction dash-period)
+  #})
 phrasingSlurDotted = {
-  \override PhrasingSlur #'dash-period = #0.75
-  \override PhrasingSlur #'dash-fraction = #0.1
+  \override PhrasingSlur #'dash-definition =  #'((0 1 0.1 0.75))
+}
+phrasingSlurHalfDashed = {
+  \override PhrasingSlur #'dash-definition =  #'((0 0.5 0.4 0.75)
+                                                 (0.5 1 1 1))
+}
+phrasingSlurHalfSolid = {
+  \override PhrasingSlur #'dash-definition =  #'((0 0.5 1 1)
+                                                 (0.5 1 0.4 0.75))
 }
 phrasingSlurSolid = {
-  \revert PhrasingSlur #'dash-period
-  \revert PhrasingSlur #'dash-fraction
+  \revert PhrasingSlur #'dash-definition
 }
 
 mergeDifferentlyDottedOn = {
@@ -65,16 +93,28 @@ tieDown = \override Tie #'direction = #DOWN
 tieNeutral = \revert Tie #'direction
 
 tieDashed = {
-  \override Tie #'dash-period = #0.75
-  \override Tie #'dash-fraction = #0.4
-}
+  \override Tie #'dash-definition = #'((0 1 0.4 0.75))
+}
+tieDashPattern = 
+#(define-music-function (parser location dash-fraction dash-period)
+  (number? number?)
+  #{
+     \override Tie #'dash-definition =
+       $(make-simple-dash-definition dash-fraction dash-period)
+  #})
 tieDotted = {
-  \override Tie #'dash-period = #0.75
-  \override Tie #'dash-fraction = #0.1
+  \override Tie #'dash-definition = #'((0 1 0.1 0.75))
+}
+tieHalfDashed = {
+  \override Tie #'dash-definition =  #'((0 0.5 0.4 0.75)
+                                        (0.5 1 1 1))
+}
+tieHalfSolid = {
+  \override Tie #'dash-definition =  #'((0 0.5 1 1)
+                                        (0.5 1 0.4 0.75))
 }
 tieSolid = {
-  \revert Tie #'dash-period
-  \revert Tie #'dash-fraction
+  \revert Tie #'dash-definition
 }
 
 easyHeadsOn = {
index 0016b97970303a37e83e87f90f65ecbdff570dd6..2a70225232b2c5fd9c8e69d74ec3f42e740f37ec 100644 (file)
@@ -2892,13 +2892,18 @@ longer in reversed order.\n"))
 
 @rule ((2, 13, 1),
        _ ("\\bar \".\" now produces a thick barline\n\
-ly:hairpin::after-line-breaking -> ly:spanner::kill-zero-spanned-time"))
+ly:hairpin::after-line-breaking -> ly:spanner::kill-zero-spanned-time\n\
+Dash parameters for slurs and ties are now in dash-definition"))
 def conv(str):
     if re.search(r'\\bar\s*"."', str):
         stderr_write ("\n")
         stderr_write (NOT_SMART % _("\\bar \".\" now produces a thick barline.\n"))
         stderr_write (UPDATE_MANUALLY)
     str = re.sub (r'ly:hairpin::after-line-breaking', r'ly:spanner::kill-zero-spanned-time', str)
+    if (re.search(r'\'dash-fraction', str) or re.search(r'\'dash-period', str):
+        stderr_write ("\n")
+        stderr_write (NOT_SMART % _("Dash parameters for slurs and ties are now in \'dash-details.\n"))
+        stderr_write (UPDATE_MANUALLY)
     return str
 
 # Guidelines to write rules (please keep this at the end of this file)
index 38e7d93d30ef77324be861549c506e81056913cf..8d166a4d235e399c9c4efc6cbd4aff1c292645c8 100644 (file)
@@ -171,6 +171,9 @@ this should list the control points of a third-order B@'ezier curve.")
 ;; d
 ;;
      (damping ,number? "Amount of beam slope damping.")
+     (dash-definition ,pair? "List of @code{dash-elements} defining the 
+dash structure.  Each @code{dash-element} has a starting t value,
+an ending t-value, a @code{dash-fraction}, and a @code{dash-period}.")
      (dash-fraction ,number? "Size of the dashes, relative to
 @code{dash-period}.  Should be between @code{0.0} (no line) and
 @code{1.0} (continuous line).")