[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Formatting part of a header property
From: |
David Kastrup |
Subject: |
Re: Formatting part of a header property |
Date: |
Mon, 17 Dec 2018 21:20:19 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Thomas Morley <address@hidden> writes:
> Am Mo., 17. Dez. 2018 um 19:21 Uhr schrieb Br. Samuel Springuel
> <address@hidden>:
>>
>> On 2018-12-17 12:08 PM, David Kastrup wrote:
>> > Uh, anything wrong with the obvious
>> >
>> > custom = \markup { PRAELUDIUM I \italic { italicized text }
>> > Back to normal }
>> >
>> > ?
>> It works in the MWE I posted, but not in my original use case (the
>> contents of the field disappear entirely. After some further
>> exploration the problem seems to be that I'm making use of
>> `\wordwrap-field` rather than `\fromproperty` (a necessity due to the
>> fact that the contents of this field can get rather long).
>
> \wordwrap-field only works for strings, otherwise an empty stencil is
> returned.
> Though, there was a bit discussion on devel recently.
> http://lilypond.1069038.n5.nabble.com/Let-wordwrap-field-and-justify-field-take-non-strings-td217729.html
> I then started work on a patch. Up to now not published (still work in
> progress and not sure when I'll have the time to continue).
>
> The idea:
>
> #(define-markup-command (wordwrap-field layout props symbol)
> (symbol?)
> #:category align
> "Wordwrap the data which has been assigned to @var{symbol}.
>
> @lilypond[verbatim,quote]
> \\header {
> title = \"My title\"
> myText = \"Lorem ipsum dolor sit amet, consectetur adipisicing
> elit, sed do eiusmod tempor incididunt ut labore et dolore
> magna aliqua. Ut enim ad minim veniam, quis nostrud
> exercitation ullamco laboris nisi ut aliquip ex ea commodo
> consequat.\"
> }
>
> \\paper {
> bookTitleMarkup = \\markup {
> \\column {
> \\fill-line { \\fromproperty #'header:title }
> \\null
> \\wordwrap-field #'header:myText
> }
> }
> }
>
> \\markup {
> \\null
> }
> @end lilypond"
> (let* ((m (chain-assoc-get symbol props)))
> (cond ((string? m)
> (wordwrap-string-markup layout props m))
> ((markup-list? m)
> (wordwrap-markup layout props m))
> ((markup? m)
> (interpret-markup layout props m))
> (else empty-stencil))))
>
>
>
> \book {
> \paper {
> indent = 0\mm
> scoreTitleMarkup = \markup {
> \fill-line {
> \null
> \fontsize #4 \bold \wordwrap-field #'header:piece
> }
> }
> }
> \header { tagline = ##f }
> \score {
> { s1 }
> \header {
> piece = \markup { PRAELUDIUM I \italic { italicized text } Back
> to normal }
> }
> }
> }
>
> Seems to work.
Given the original rationale, maybe
piece = \markuplist { PRAELUDIUM I \italic { italicized text } Back to
normal }
instead?
BTW, I am not convinced of the string/markup differentiation since a
string _is_ a simple markup. This is sort of icky.
--
David Kastrup
- Formatting part of a header property, Br. Samuel Springuel, 2018/12/17
- Re: Formatting part of a header property, David Kastrup, 2018/12/17
- Re: Formatting part of a header property, Br. Samuel Springuel, 2018/12/17
- Re: Formatting part of a header property, Thomas Morley, 2018/12/17
- Re: Formatting part of a header property,
David Kastrup <=
- Re: Formatting part of a header property, Thomas Morley, 2018/12/17
- Re: Formatting part of a header property, David Kastrup, 2018/12/17
- Re: Formatting part of a header property, Thomas Morley, 2018/12/17
- Re: Formatting part of a header property, David Kastrup, 2018/12/17
- Re: Formatting part of a header property, Br. Samuel Springuel, 2018/12/17