|
From: | Hendrik Fuß |
Subject: | Re: Center-align a score |
Date: | Mon, 01 May 2017 19:48:15 +0000 |
2017-04-28 17:39 GMT+02:00 David Nalesnik <address@hidden>:
> It would be relatively easy to alter the function make-page-stencil in
> scm/page.scm to do what you want. The stencils of the individual
> systems are already made at this point, and it's just a matter of
> moving them around to your liking. Unfortunately, this requires a
> change to program files. I've had no luck copy/pasting code from that
> file into the LY file.
It may be possible if one could get access to the (scm page)-module.
Though, I had no luck with this either.
Nevertheless, below probably a method to avoid ly:grob-extent's side-effects:
\version "2.19.59"
\paper {
ragged-right = ##t
indent = 0
}
centerLines =
\override NonMusicalPaperColumn.after-line-breaking =
#(lambda (grob)
(if (eqv? (ly:item-break-dir grob) 1) ; line beginning
(let* ((sys (ly:grob-system grob))
;; filter for StaffSymbol-grobs
(staff-symbols
(filter
(lambda (grob)
(grob::has-interface grob 'staff-symbol-interface))
(ly:grob-array->list (ly:grob-object sys 'all-elements))))
;; StaffSymbols may start/end during same system
;; Best bet is to look for the most left/right start/end-coord
(min-max
(lambda (list-of-pairs)
(cons
(reduce min +inf.0 (map car list-of-pairs))
(reduce max -inf.0 (map cdr list-of-pairs)))))
(line-width
(interval-length
(min-max
(map
(lambda (g) (ly:grob-property g 'X-extent))
staff-symbols))))
(layout (ly:grob-layout grob))
(line-full-width (ly:output-def-lookup layout 'line-width)))
(ly:grob-set-nested-property! grob
'(line-break-system-details X-offset)
(/ (- line-full-width line-width) 2)))))
\layout {
\context {
\Score
\centerLines
\override BarNumber.stencil = ##f
}
}
\score {
\new Staff \with {
\override StaffSymbol.line-count = #1
\omit Staff.TimeSignature
\omit Staff.Clef
}
{
b'4 b' b'2 \break
b'4 b' b'2 \break
b'4 b' b' b' b' b' b'2 \break
}
\addlyrics {
Häns -- chen klein
ging al -- lein
in die wei -- te Welt hi -- nein
}
}
Cheers,
Harm
_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
[Prev in Thread] | Current Thread | [Next in Thread] |