[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to get bounding NoteColumns of the first of consecutive TextSpanners
From: |
Thomas Morley |
Subject: |
How to get bounding NoteColumns of the first of consecutive TextSpanners |
Date: |
Wed, 3 Mar 2021 13:55:55 +0100 |
Hi,
please have a look at the following minimal, producing three staves,
the middle one with consecutive TextSpanners:
mus = { bes \startTextSpan b\stopTextSpan \startTextSpan bis\stopTextSpan }
<< { a4 a a } \mus { c' c' c' } >>
Now I want to know the starting and ending NoteColumns of the _first_
TextSpanner.
Though, the first TextSpanner is left-bounded by NoteColumn and
right-bounded by PaperColumn.
How to get the NoteColumn at first TextSpanner's end?
Below some test-code.
Obviously I can filter PaperColumn's elements for NoteColumns, but
PaperColumn is a Score-grob, thus I get all three.
How to select?
(I may not know the position of the Staff with the TextSpanners)
#(define tst
(lambda (grob)
(let* ((left-bound (ly:spanner-bound grob LEFT))
(right-bound (ly:spanner-bound grob RIGHT))
(ncs-from-grob
(ly:grob-array->list (ly:grob-object grob 'note-columns)))
(right-bound-elts
(ly:grob-array->list
(ly:grob-object right-bound 'elements)))
(ncs-from-right-bound
(filter
(lambda (elt) (grob::has-interface elt 'note-column-interface))
right-bound-elts))
)
(pretty-print
(list
left-bound
right-bound
ncs-from-grob
(equal? left-bound (car ncs-from-grob))
ncs-from-right-bound
)))))
mus = {
bes4-\tweak #'after-line-breaking #tst
\startTextSpan
b\stopTextSpan
\startTextSpan
bis\stopTextSpan
}
<<
{ a4 a a }
\mus
{ c' c' c' }
>>
Thanks,
Harm
- How to get bounding NoteColumns of the first of consecutive TextSpanners,
Thomas Morley <=