[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: automatic line-breaking in markup
From: |
Thomas Morley |
Subject: |
Re: Re: automatic line-breaking in markup |
Date: |
Thu, 4 Feb 2016 23:03:05 +0100 |
2016-02-04 8:01 GMT+01:00 Jonathan Scholbach <address@hidden>:
> Nice! Thank you, Harm! Actually I have (unarguable) reasons to put the title
> in a string variable.
Am I missing something? In my example title _is_ a string
> But since I do not understand anything of the code in
> your snippet I cannot manage to adapt your macro to take a string variable
> as input. It would be very kind of you if you did even that for me.
>
> Jonathan
>
Anyway, if you want to get wordwrapping strings, you my use our \wordwrap-string
http://www.lilypond.org/doc/v2.19/Documentation/notation/align
In case you want to align it differently, you may be interested in:
#(define-markup-command (my-wordwrap-string layout props align strg)
(number? string?)
#:properties ((baseline-skip))
#:category align
"Same as @code{wordwrap-field}, but internally a stencil-list is produced
first, which will aligned according to @var{align}, putting out a single
stencil."
;; c/p from define-markup-commands.scm, because it's not public
(define (general-column align-dir baseline mols)
"Stack @var{mols} vertically, aligned to @var{align-dir} horizontally."
(let* ((aligned-mols
(map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols))
(stacked-stencil (stack-lines -1 0.0 baseline aligned-mols))
(stacked-extent (ly:stencil-extent stacked-stencil X)))
(ly:stencil-translate-axis stacked-stencil (- (car stacked-extent)) X)))
(general-column
align
baseline-skip
(wordwrap-string-internal-markup-list layout props #f strg)))
title = "Many many words may result in a title that is too long for one line"
\paper {
bookTitleMarkup =
\markup \fill-line { \fontsize #15 \my-wordwrap-string #CENTER \title }
}
\relative c' { c d e f }
HTH,
Harm