[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
possible fix for 5026 "\crossStaff mangles all grace note flags"?
From: |
Thomas Morley |
Subject: |
possible fix for 5026 "\crossStaff mangles all grace note flags"? |
Date: |
Tue, 3 Jan 2017 13:10:58 +0100 |
Hi,
I had a look at
issue 5026 "\crossStaff mangles all grace note flags "
https://sourceforge.net/p/testlilyissues/issues/5026/
The code below checks additional for equal stem-durations.
If true connect stems, if not don't do so _and_ unset Flag.style.
Though, I'm not sure it's a proper fix.
I'd appreciate opinions/testings.
Thanks,
Harm
\version "2.19.52"
#(define-public (my-Span_stem_engraver ctx)
"Connect cross-staff stems to the stems above in the system"
(let ((stems '()))
(make-engraver
;; Record all stems for the given moment
(acknowledgers
((stem-interface trans grob source)
(set! stems (cons grob stems))))
;; Process stems and reset the stem list to empty
((process-acknowledged trans)
(let ((flags
(flatten-list
(map
(lambda (stem) (ly:grob-object stem 'flag))
stems)))
(stem-durs
(map
(lambda (stem) (ly:grob-property stem 'duration-log))
stems)))
;; condition to connect:
;; connect stems only if two or more present _and_ all are of same
;; duration and `stem-connectable?' is true (checked earlier)
(if (and (<= 2 (length stems))
(every (lambda (el) (= (car stem-durs) el)) stem-durs))
;; `make-stem-spans!' is not public, thus the @@-syntax
;; can be deleted if inserted in music-functions.scm
((@@ (lily) make-stem-spans!) ctx stems trans)
;; if the condition is false unset Flag.style
(if (pair? flags)
(ly:grob-set-property! (car flags) 'style '())))
(set! stems '()))))))
A = {
c'8 \grace d'8 e'8 f' \grace g' fis' g'4 a'8 \noBeam b' c''8
}
B = {
\voiceOne
\autoBeamOff
\crossStaff { c'8 \grace { d'8 } e'8 \grace e'8 f' fis' g'8 a' b'4 }
c''8
}
music = <<
\new Staff
%% works only if patch for issue 4983 is present
%\with { \override Flag.stencil = #modern-straight-flag }
\A
\new Staff
%% works only if patch for issue 4983 is present
%\with { \override Flag.stencil = #flat-flag }
\B
>>
\new PianoStaff
\with {
\consists #Span_stem_engraver
instrumentName = "current"
}
\music
\new PianoStaff
\with {
\consists #my-Span_stem_engraver
instrumentName = "proposed"
}
\music
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- possible fix for 5026 "\crossStaff mangles all grace note flags"?,
Thomas Morley <=