Hi David,
I've been using your new function to center paper column of notes,
however, under certain circumstances a bug appears.
Thanks again for all the help, I hope this can be fixed without much
trouble.
Víctor.
El 31/05/15 a las 11:56, David Nalesnik escibió:
Hi Victor,
On Sun, May 31, 2015 at 8:51 AM, Víctor <[email protected]
<mailto:[email protected]>> wrote:
El 31/05/15 a las 08:43, David Nalesnik escibió:
Hi Victor,
Yes, you do. However, the second version I posted should work
with earlier versions as I factored out ly:item-get-column.
Sorry, I just missed that post. Now I've checked it and it works
in 2.19.15 I'll ask however, what do you advice me to do, to use
this version or update Lily?
Well, I don't think that your choice to use a development version vs.
a stable release should depend only on these functions, as both do
pretty much the same thing. I do prefer using the later code, which
will work with both stable and unstable.
As to the larger question of whether to upgrade or not, that's up to
you. Development versions come with a caveat about possible dangers,
though I've only purposely downgraded (to an earlier development
version) on one occasion because of (temporary) brokenness.
.
David
\version "2.19.15"
#(define center-column
(lambda (col)
(let* ((left-col (ly:grob-object col 'left-neighbor))
(right-col (ly:grob-object col 'right-neighbor))
; If a column adjoining our column is a PaperColumn, ours
; is not alone in the measure. We make no adjustments.
(alone?
(and (eq? #t (ly:grob-property left-col 'non-musical))
(eq? #t (ly:grob-property right-col 'non-musical)))))
(if alone?
(let* ((elts-list
(ly:grob-array->list (ly:grob-object col 'elements)))
(note-cols
(filter
(lambda (elt)
(grob::has-interface elt 'note-column-interface))
elts-list))
(all-rests
(map (lambda (c)
(ly:grob-object c 'rest))
note-cols))
(all-rests (filter ly:grob? all-rests))
(all-notes
(map
(lambda (c)
(ly:grob-object c 'note-heads))
note-cols))
(all
(map (lambda (ga)
(if (ly:grob-array? ga)
(ly:grob-array->list ga)
'()))
all-notes))
(all (flatten-list all))
(all (append all all-rests))
(same-dur?
(every (lambda (o)
(equal?
(ly:grob-property o 'duration-log)
(ly:grob-property (car all)
'duration-log)))
all)))
(if same-dur?
(let* ((sys (ly:grob-system col))
(col-center (interval-center
(ly:grob-extent col sys X)))
(left-right-X
(cdr (ly:grob-extent left-col sys X)))
(right-left-X
(car (ly:grob-extent right-col sys X)))
(middle-X
(- (average left-right-X right-left-X)
col-center)))
(ly:grob-translate-axis! col middle-X X))))))))
centerSolitaryPaperColumn =
\override Score.PaperColumn.after-line-breaking = #center-column
\score {
<<
\new Staff {
\time 3/8
a8 a4~
a4.
}
\new PianoStaff <<
\new Staff \repeat unfold 12 a16
\new Staff \repeat unfold 6 a8
>>
>>
}
\layout {
\centerSolitaryPaperColumn
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user