Reviewers: ,
Message:
See
https://lists.gnu.org/archive/html/lilypond-user/2017-10/msg00012.html
for sort of bug report on the user list.
Description:
Merge_rests_engraver: fix vertical rest positions
When used with \magnifyStaff the engraver failed to position merged
rests correctly. Using staff-position instead of Y-offset for vertical
positioning fixes this.
Please review this at https://codereview.appspot.com/334740043/
Affected files (+9, -15 lines):
M scm/scheme-engravers.scm
Index: scm/scheme-engravers.scm
diff --git a/scm/scheme-engravers.scm b/scm/scheme-engravers.scm
index
3480610c4caee25a8bb8dd2b97e9accf2147f7d0..c9fc6cd78c715afddc35d6aad17dfd130373bca4
100644
--- a/scm/scheme-engravers.scm
+++ b/scm/scheme-engravers.scm
@@ -128,20 +128,14 @@ if there were one voice."
(define (is-single-bar-rest? mmrest)
(eqv? (ly:grob-property mmrest 'measure-count) 1))
- (define (is-whole-rest? rest)
- (eqv? (ly:grob-property rest 'duration-log) 0))
-
- (define (mmrest-offset mmrest)
+ (define (mmrest-position mmrest)
"For single measures they should hang from the second line from the top
- (offset of 1). For longer multimeasure rests they should be centered on
the
- middle line (offset of 0).
+ (staff-position of 2). For longer multimeasure rests they should be
centered on the
+ middle line (staff-position of 0).
NOTE: For one-line staves full single measure rests should be positioned
at
0, but I don't anticipate this engraver's use in that case. No errors are
given in this case."
- (if (is-single-bar-rest? mmrest) 1 0))
-
- (define (rest-offset rest)
- (if (is-whole-rest? rest) 1 0))
+ (if (is-single-bar-rest? mmrest) 2 0))
(define (rest-eqv rest-len-prop)
"Compare rests according the given property"
@@ -158,12 +152,12 @@ if there were one voice."
(define (merge-mmrests rests)
"Move all multimeasure rests to the single voice location."
(if (all-equal rests (rest-eqv 'measure-count))
- (merge-rests rests mmrest-offset)))
+ (merge-rests rests mmrest-position)))
- (define (merge-rests rests offset-function)
- (let ((y-offset (offset-function (car rests))))
+ (define (merge-rests rests position-function)
+ (let ((staff-pos (position-function (car rests))))
(for-each
- (lambda (rest) (ly:grob-set-property! rest 'Y-offset y-offset))
+ (lambda (rest) (ly:grob-set-property! rest 'staff-position
staff-pos))
rests))
(for-each
(lambda (rest) (ly:grob-set-property! rest 'transparent #t))
@@ -217,7 +211,7 @@ if there were one voice."
(all-equal durs moment=?)
(rests-all-unpitched rests))
(begin
- (merge-rests rests rest-offset)
+ (merge-rests rests (lambda (r) 0))
;; ly:grob-suicide! works nicely for dots, as opposed to
rests.
(if (pair? dots) (for-each ly:grob-suicide! (cdr dots)))))
(if (has-at-least-two curr-mmrests)
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel