Valentino,

Your function seems to not work for polyphonic passages as in the example 
below. Is there a fix for the function, would using \voiceOne and \voiceTwo 
explicitly for this polyphonic context make a difference?

\version "2.24.3"
#(define (outside-staff-collecting-engraver context)
   (let* ((span_up #f) (span_down #f))
   (make-engraver
    ((initialize engraver)
     (set! span_up (ly:engraver-make-grob engraver 'TextSpanner '()))
     (ly:grob-set-property! span_up 'transparent #t)
     (ly:grob-set-property! span_up 'direction UP)
     (set! span_down (ly:engraver-make-grob engraver 'TextSpanner '()))
     (ly:grob-set-property! span_down 'transparent #t)
     (ly:grob-set-property! span_down 'direction DOWN))
    (acknowledgers
     ((outside-staff-interface engraver grob source-engraver)
      (if (assoc-get 'align (ly:grob-property grob 'details))
          (let* ((d (ly:grob-property grob 'direction))
                 (span (if (= d UP) span_up span_down)))
            (ly:grob-set-parent! grob Y span)
            (if (null? (ly:spanner-bound span LEFT))
                (ly:spanner-set-bound! span LEFT
                                       (if (ly:spanner? grob)
                                           (ly:spanner-bound grob LEFT)
                                           grob)))
            (ly:spanner-set-bound! span RIGHT
                                   (if (ly:spanner? grob)
                                       (ly:spanner-bound grob LEFT)
                                       grob))
            (ly:grob-set-property! grob 'outside-staff-priority #f)
            (ly:grob-set-property! grob 'Y-offset 0))))))))

\layout {
  \context {
    \Staff
    \consists #outside-staff-collecting-engraver
  }
  \context {
    \Voice
    \consists Horizontal_bracket_engraver
    \override HorizontalBracket.direction = #UP

  }
}

\relative c {
\override HorizontalBracket.details.align = ##t
  << {
    << {
            c\startTextSpan c c c\stopTextSpan |

    } \\ {
        g g g g |
    }
    a a a a
    >> } >>
    { s\startGroup s s s\stopGroup | s s s s }
}

-Fennel

​

Reply via email to