lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: \markup on "topmost" voice in a Frenched score?


From: Aaron Hill
Subject: Re: \markup on "topmost" voice in a Frenched score?
Date: Thu, 14 Mar 2019 16:31:23 -0700
User-agent: Roundcube Webmail/1.3.8

On 2019-03-14 10:35 am, N. Andrew Walsh wrote:
On Thu, Mar 14, 2019 at 4:36 PM Aaron Hill <address@hidden> wrote:
Seems like \mark would work. RehearsalMarks belong to the Score and are
by default placed above the entire system regardless of any staves.

This does seem like it wold work well. Is there a way to have a \mark that includes both the \default command and a \markup block at the same point? The client wants Roman-numeral rehearsal marks, but at some of them also
wants these section titles.

Well, you can always \override the stencil of the RehearsalMark. Using grob-transformer, it is possible to reuse the original value when building the new one. Consider the following:

%%%%
\version "2.19.82"

#(define ((align-and-combine axis direction parent self padding) first second)
  "Aligns and combines two stencils.  The @var{axis} and @var{direction}
arguments specify on which side of the first stencil the second stencil
will be placed.  The @var{parent} and @var{self} arguments establish the
reference points on the first and second stencils, respectively, that
will be aligned on the opposite axis."
  (if (and (ly:stencil? first) (ly:stencil? second))
    (ly:stencil-combine-at-edge first axis direction
      (ly:stencil-translate-axis
        (ly:stencil-aligned-to second (- 1 axis) self)
(interval-index (ly:stencil-extent first (- 1 axis)) parent) (- 1 axis))
      padding)))

%% Here are some convenience procedures using align-and-combine.
#(define centered-above (align-and-combine Y UP CENTER CENTER 1))
#(define as-superscript (align-and-combine X RIGHT UP DOWN 0))
#(define left-aligned-below (align-and-combine Y DOWN LEFT LEFT 1))

combineWithMark = #(define-music-function (proc arg)
  ((procedure? centered-above) markup?)
  "Combines the specified markup with an existing RehearsalMark.
The @var{proc} argument specifies how the stencils are to be combined."
  #{ \once \override Score.RehearsalMark.stencil =
       #(grob-transformer 'stencil (lambda (grob old)
         (proc old (grob-interpret-markup grob arg)))) #} )

\paper { line-width = 5\in }
{
  % Default is #centered-above.
  \combineWithMark \markup \italic "centered-above"
  \mark \default \repeat unfold 5 { b'1 } \bar "."
  \once \override Score.RehearsalMark.self-alignment-X = #RIGHT
  \combineWithMark #as-superscript \markup \italic "as-superscript"
  \mark \default \repeat unfold 5 { b'1 } \bar "."
  \once \override Score.RehearsalMark.self-alignment-X = #LEFT
\combineWithMark #left-aligned-below \markup \italic "left-aligned-below"
  \mark \default \repeat unfold 5 { b'1 }
}
%%%%


-- Aaron Hill

Attachment: mark-default-markup.cropped.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]