Reviewers: ,
Message:
I believe this new version of the glissando line breaking patch responds
to Keith's concern.
Please let me know what you think!
Cheers,
MS
Description:
Implements multiple-line non-cross-staff glissandi
Please review this at http://codereview.appspot.com/4527086/
Affected files:
A input/regression/glissando-broken-multiple.ly
M lily/line-spanner.cc
M scm/define-grobs.scm
M scm/output-lib.scm
Index: input/regression/glissando-broken-multiple.ly
diff --git a/input/regression/glissando-broken-multiple.ly
b/input/regression/glissando-broken-multiple.ly
new file mode 100644
index
0000000000000000000000000000000000000000..b9c8e20829e76ae603e82a77ea73bf5d0562cc35
--- /dev/null
+++ b/input/regression/glissando-broken-multiple.ly
@@ -0,0 +1,16 @@
+\header {
+ texidoc = "When broken, glissandi can span multiple lines."
+
+}
+\version "2.12.0"
+\paper {
+ ragged-right = ##T }
+
+\relative c'' {
+ \override Glissando #'breakable = ##t
+ d1 \glissando |
+ \break s1 |
+ \break s1 |
+ \break s1 |
+ c,1
+}
Index: lily/line-spanner.cc
diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc
index
0235243628b0dc1a74a9cab08c1d462b14a3bb42..76396705751893de94ea912d638a43544e71828d
100644
--- a/lily/line-spanner.cc
+++ b/lily/line-spanner.cc
@@ -272,9 +272,14 @@ Line_spanner::print (SCM smob)
while (flip (&d) != LEFT);
Grob *my_common_y = common_y[LEFT]->common_refpoint (common_y[RIGHT],
Y_AXIS);
- do
- span_points[d][Y_AXIS] += common_y[d]->relative_coordinate
(my_common_y, Y_AXIS);
- while (flip (&d) != LEFT);
+ bool simple_y = to_boolean (me->get_property ("simple-Y"))
&& !to_boolean (me->get_property ("cross-staff"));
+
+ if (!simple_y)
+ {
+ do
+ span_points[d][Y_AXIS] += common_y[d]->relative_coordinate
(my_common_y, Y_AXIS);
+ while (flip (&d) != LEFT);
+ }
Interval normalized_endpoints = robust_scm2interval (me->get_property
("normalized-endpoints"), Interval (0, 1));
Real y_length = span_points[RIGHT][Y_AXIS] - span_points[LEFT][Y_AXIS];
@@ -341,7 +346,7 @@ Line_spanner::print (SCM smob)
}
line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS),
- -me->relative_coordinate (my_common_y, Y_AXIS)));
+ simple_y ? 0.0 : -me->relative_coordinate
(my_common_y, Y_AXIS)));
return line.smobbed_copy ();
Index: scm/define-grobs.scm
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index
84c3f72f8fbb72c715ebab652bd81c2780b31998..d11a0e418afe10e4290d599e35f370f0bbb21c9e
100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -927,6 +927,7 @@
(Glissando
. (
(after-line-breaking . ,ly:spanner::kill-zero-spanned-time)
+ (before-line-breaking . ,glissando::before-line-breaking)
(bound-details . ((right . ((attach-dir . ,CENTER)
(padding . 1.5)
))
@@ -938,6 +939,7 @@
(left-bound-info . ,ly:line-spanner::calc-left-bound-info)
(normalized-endpoints . ,ly:spanner::calc-normalized-endpoints)
(right-bound-info . ,ly:line-spanner::calc-right-bound-info)
+ (simple-Y . #t)
(stencil . ,ly:line-spanner::print)
(style . line)
(X-extent . #f)
Index: scm/output-lib.scm
diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index
c25edf31f68a93de749a87e69e26cd4dde6dfc3d..d076b481a87ca57f618be4d9824a335093b6c0cd
100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -790,6 +790,31 @@ between the two text elements."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; glissando
+
+(define-public (glissando::before-line-breaking grob)
+ (let* ((l (glissando::internal-before-line-breaking grob LEFT))
+ (r (glissando::internal-before-line-breaking grob RIGHT))
+ (bd `((left . ,l) (right . ,r))))
+ (ly:grob-set-property! grob 'bound-details bd)))
+
+(define-public (glissando::internal-before-line-breaking grob dir)
+ (let* ((bound-details (ly:grob-property grob 'bound-details))
+ (dir-sym (if (eqv? dir LEFT) 'left 'right))
+ (other-sym (if (eqv? dir LEFT) 'right 'left))
+ (details (assoc-get dir-sym
+ bound-details))
+ (other (assoc-get other-sym
+ bound-details))
+ (extra-dy (assoc-get 'extra-dy details 0.0))
+ (bound (ly:spanner-bound grob dir))
+ (common-y (ly:grob-common-refpoint grob bound Y))
+ (y (+ (interval-center (ly:grob-extent bound common-y Y))
+ (/ (* dir extra-dy)
+ 2))))
+ (cons (cons 'Y y) details)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; scripts
(define-public (script-interface::calc-x-offset grob)
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel