lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Implement shorten-pair for Hairpin (issue 315350043 by address@hidden)


From: david . nalesnik
Subject: Implement shorten-pair for Hairpin (issue 315350043 by address@hidden)
Date: Sat, 07 Jan 2017 09:12:57 -0800

Reviewers: ,

Message:
Please review. Thanks!

Description:
Implement shorten-pair for Hairpin

This property allows the user to offset the ends of hairpins
independently.

Please review this at https://codereview.appspot.com/315350043/

Affected files (+13, -4 lines):
  M lily/hairpin.cc
  M scm/define-grob-properties.scm


Index: lily/hairpin.cc
diff --git a/lily/hairpin.cc b/lily/hairpin.cc
index 01d8fd93dea61f696d5af6a189244517f4fca622..afd94f3ee06ada9f66d16a851fed3da119037de5 100644
--- a/lily/hairpin.cc
+++ b/lily/hairpin.cc
@@ -157,6 +157,8 @@ Hairpin::print (SCM smob)
   if (circled_tip)
     thick = robust_scm2double (me->get_property ("thickness"), 1.0)
             * Staff_symbol_referencer::line_thickness (me);
+ Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
+                                                  Interval (0, 0));

   for (LEFT_and_RIGHT (d))
     {
@@ -220,7 +222,10 @@ Hairpin::print (SCM smob)
Handle back-to-back hairpins with a circle in the middle
                       */
                       if (circled_tip && (grow_dir != d))
- x_points[d] = e.center () + d * (rad - thick / 2.0);
+                        {
+ x_points[d] = e.center () + d * (rad - thick / 2.0);
+                          shorten[d] = 0.0;
+                        }
                       /*
If we're hung on a paper column, that means we're not adjacent to a text-dynamic, and we may move closer. We
@@ -248,6 +253,8 @@ Hairpin::print (SCM smob)
                 }
             }
         }
+
+        x_points[d] -= shorten[d] * d;
     }

   Real width = x_points[RIGHT] - x_points[LEFT];
@@ -336,4 +343,5 @@ ADD_INTERFACE (Hairpin,
                "bound-padding "
                "grow-direction "
                "height "
+               "shorten-pair "
               );
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 06358986b077bad2934e73eeac7fac2c4850c4af..491103fb7c8274f4dab43fa33a8ab6b41eb11598 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -875,9 +875,10 @@ of the staff-position at which each clef places C:
 If the list contains a single element it applies for all clefs.
 A single number in place of a pair sets accidentals within the octave
 ending at that staff-position.")
-     (shorten-pair ,number-pair? "The lengths to shorten a
-text-spanner on both sides, for example a pedal bracket.  Positive
-values shorten the text-spanner, while negative values lengthen it.")
+     (shorten-pair ,number-pair? "The lengths to shorten on both sides
+a hairpin or text-spanner such as a pedal bracket.  Positive values
+shorten the hairpin or text-spanner, while negative values lengthen
+it.")
      (shortest-duration-space ,number? "Start with this multiple of
 @code{spacing-increment} space for the shortest duration.  See also
 @rinternals{spacing-spanner-interface}.")





reply via email to

[Prev in Thread] Current Thread [Next in Thread]