Hi Brent,
This is marvellous, thank you! Just one question: if I wanted to
remove the preceding zeros from the number, how would I do that?
Just omit the (not very elegant) code that I added in order to add the
preceding zeros. :-)
To wit, replace
(markup (format #f
(string-append "~" (number->string digits)
",'0d")
n)))
by
(number->string n))
I attach a complete version.
One problem with my code is the fine-tuning of the bottom-alignment of
the various \markup's: If you look closely, you see that LilyPond
doesn't use the baselines of the text lines, but the actual lowest point
of the markups: The lowest point of "Gottes Sohn ist kommen" (no
descenders) are aligned to the lowest point of the 'g' in 'long'. Not
ideal, but I don't know how to improve this.
Lukas
\version "2.19"
% By harm
#(define (general-column align-dir baseline mols)
(let* ((aligned-mols (map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols)))
(stack-lines -1 0.0 baseline aligned-mols)))
#(define-markup-command (wordwrap-right layout props args)
(markup-list?)
(general-column RIGHT 2.5 (wordwrap-internal-markup-list layout props #f args)))
#(define-markup-command (number-fromproperty layout props digits symbol)
(index? symbol?)
(let ((n (chain-assoc-get symbol props)))
(if (index? n)
(interpret-markup layout props (number->string n))
empty-stencil)))
#(define-markup-command (wordwrap-right-field layout props symbol)
(symbol?)
(let* ((m (chain-assoc-get symbol props)))
(if (markup-list? m)
(wordwrap-right-markup layout props m)
empty-stencil)))
\paper {
scoreTitleMarkup = \markup {
\fill-line {
\line {
\fontsize #7 \number-fromproperty #3 #'header:piece-nr
\hspace #1
\normal-text \large \fromproperty #'header:piece-title
}
\general-align #Y #DOWN
\italic \small
\override #'(line-width . 50)
\wordwrap-right-field #'header:infotext
}
}
}
\paper {
indent = 0
}
\score {
\header {
piece-nr = 0
piece-title = "Gottes Sohn ist kommen"
infotext = \markuplist {
This paragraph is in two or more rows, and the last line needs
to be level with the bit on the left. It really can be as long
as you want.
}
}
\relative c' { c1 c e f g a g }
}
\score {
\header {
piece-nr = 1
piece-title = "Another piece"
infotext = \markuplist {
This paragraph is in two or more rows, and the last line needs
to be level with the bit on the left. It really can be as long
as you want. Bla bla text, bla bla text? Really important bla bla text, bla bla text.
}
}
\relative g' { g2 f e c d b c1 }
}