Dear all,

I cannot seem yet to get certain textual output rendered the way I intend.
Here are the questions I still have:


1. How can I combine header fields without adding whitespace between header
properties? I'm referring to snippets as:

\fromproperty #'header:composer (\fromproperty #'header:opus)

Using \concat doesn't help as it eats ALL white space.


2. Why does a strut have a nonzero width? Can it be used and set to zero?
Maybe it has zero width, but because of some internal processing every
markup element automatically gets white space glued to it (this may explain
my first question in part too).


3. How can I get markup in columns use the font "strut" dimensions for
correct vertical padding of a paragraph? In the example below, you'll see
that there's an ugly and uncontrollable vertical white space between the
3-column output and the red text, due to using text in the 3 columns with
characters protruding below the baseline or not.


So here comes the rather long self-contained example. Colors are only there
for identifying semantical elements.

%% BEGIN code
\version "2.16.1"

% LSR snippet from http://lsr.dsi.unimi.it/LSR/Item?id=368
#(define-markup-command (when-property layout props symbol markp) (symbol?
markup?)
   (if (chain-assoc-get symbol props)
       (interpret-markup layout props markp)
       (ly:make-stencil '()  '(1 . -1) '(1 . -1))))

% LSR snippet from http://lsr.dsi.unimi.it/LSR/Snippet?id=464
#(define-markup-command (columns layout props args) (markup-list?)
   (let ((line-width (/ (chain-assoc-get 'line-width props
                          (ly:output-def-lookup layout 'line-width))
                       (max (length args) 1))))
     (interpret-markup layout props
       (make-line-markup (map (lambda (line)
                                (markup #:pad-to-box `(0 . ,line-width) '(0
. 0)
                                  #:override `(line-width . ,line-width)
                                  line))
                           args)))))

\paper {
  scoreTitleMarkup = \markup {
    \column {
      \when-property #'header:piece {
        \rounded-box {
          \column {
            %\rounded-box
            \fill-line {
              % \fill-line 1 (piece title)
              \bold { \justify-field #'header:piece }
              \line { \with-color #blue \fromproperty #'header:composer
(\with-color #(rgb-color 1 .5 0) \fromproperty #'header:opus) }
            } % \fill-line 1 (piece title)
            \when-property #'header:piece-explanation {
              %
              % (piece explanation)
              % \vspace #.15
              % \rounded-box
              \columns {
                \column {
                  \wordwrap {
                    % Deutsch
                    \wordwrap-field #'header:piece-explanation-de
                  }
                }
                \column {
                  \wordwrap \italic {
                    % Français
                    \italic { \wordwrap-field #'header:piece-explanation-fr
}
                  }
                }
                \column {
                  \wordwrap {
                    % English
                    \wordwrap-field #'header:piece-explanation-en
                  }
                }
              } % \columns
            } % \when-property #'header:piece-explanation (piece
explanation)
            \when-property #'header:piece-tonality {
              % \rounded-box  {
              % \vspace #.1
              \with-color #red \fromproperty #'header:piece-tonality
            }
          }
        } % \column
      } % \rounded-box
    } % \when-property #'header:piece
    \when-property #'header:piece-comment {
      \rounded-box  {
        % \vspace #.15
        \with-color #magenta \italic { \wordwrap-field
#'header:piece-comment }
      }
    }
  } % \column
}


\header {
  composer = "Nemo Ignoto"
  opus = "Opus 3.14"
}

pieceStr = "N° 25. Minuetto"
% \piece \pieceStr
\label #'score13

theMusic = \new StaffGroup <<

  \new Staff {
    \relative c' {
      \key c \major
      \time 3/4
      \tempo "Moderato con moto"
      \repeat unfold 10 { c4 c'8. d,16-. e8. f16-. }

      \bar "|."
    }
  }

  \new Staff {
    \relative c {
      \key c \major
      \clef "bass"
      \repeat unfold 10 { g4-> f c }

    }
  }

>>

\score {
  \theMusic

  \header {
    piece = \pieceStr
    piece-tonality = \markup { C Dur. {\italic Do majeur.} C major. }
    piece-comment = "This is a sample comment."
    % {
    piece-explanation = ""
    piece-explanation-de = "Wird ganz in der zweiten Position gespielt."
    piece-explanation-fr = "Jouer entièrement à la 2° position."
    piece-explanation-en = "Play entirely in the 2nd position."
    % }
  }

  \layout {
    indent = 0.0\cm
    \context {
      \Staff
      \override Fingering            #'add-stem-support            = ##t
      \override Fingering            #'avoid-slur                = #'outside
      % \override Fingering            #'direction                    =
#DOWN
      % \override StringNumber        #'script-priority            = #150
      \override TupletBracket        #'bracket-visibility        = ##t
    }
  }
}

\markup {
  \column {
    \line { \huge { The following also does not work: } }

    \rounded-box {
      \column {
        \fill-line {
          { \bold "N° 25. Minuetto" }
          \line { \with-color #blue "Nemo Ignoto" "(" \with-color
#(rgb-color 1 .5 0) "Opus 3.14"  ")" }
        }
        \columns {
          \override #'(baseline-skip . 4) \column { \wordwrap { Wird ganz
in der zweiten Position gespielt. }\strut }
          \override #'(baseline-skip . 4) \column { \wordwrap { \italic {
Jouer entièrement à la 2° position. } } }
          \override #'(baseline-skip . 4) \column { \wordwrap { Play
entirely in the 2nd position. } }
        }
        \line { \with-color #red { C Dur. {\italic Do majeur.} C major. } }
      }
    }

    \strut
    \wordwrap { \huge { The following works but (1) does not make use of
columns and (2) does not make use of header fields: } }

    % But it breaks the vertical spacing again...



    \rounded-box {
      \column {
        \fill-line {
          { \bold "N° 25. Minuetto" }
          \with-color #blue "Nemo Ignoto (Opus 3.14)"
        }
        \line { Wird ganz in der zweiten Position gespielt. }
        \line { \italic { Jouer entièrement à la 2° position. } }
        \line { Play entirely in the 2nd position. }
        \line { \with-color #red { C Dur. {\italic Do majeur.} C major. } }
      }
    }
  }
}
%% END code

Best regards,

Olivier
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to