lilypond-user
[Top][All Lists]
Advanced

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

Re: Place text next to rehearsal mark, or with left edge over barline if


From: Thomas Morley
Subject: Re: Place text next to rehearsal mark, or with left edge over barline if there is none
Date: Sun, 9 Jul 2017 23:07:40 +0200

2017-07-09 18:24 GMT+02:00  <address@hidden>:
> As you can see on the screenshot, both texts are misaligned. The first one,
> a \tempo, is placed *under* the rehearsal mark instead of next to it. The
> second one, the name of a song, is too far too the right, since it's
> attached to the note instead of the barline (it's a <>^"").
>
> How can I move the texts to be next to the rehearsal mark (without manual
> adjustments)?
>
> And is there a version of <>^"" that is attached to a moment instead of a
> note, to be more semantically correct? I think \mark is supposed to do that,
> but it only supports one mark at a time.
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

Hi,

please always post an (minimal) example demonstrating the problem.
I wasted some minutes to reproduce your first problem. But I was
annoyed not being able to do so. Hence I decided to try solving the
problem instead of continuing finding an code-example triggering the
problem.
You could have done this.

That said, how about:

\version "2.19.63"

#(define (combine-marks mrkup)
  (lambda (grob)
    (let* ((default-stencil (ly:grob-property grob 'stencil))
           (mrkp-stencil (grob-interpret-markup grob mrkup))
           (new-stencil
             (ly:stencil-combine-at-edge
               (ly:stencil-aligned-to default-stencil Y CENTER)
               X
               RIGHT
               (ly:stencil-aligned-to mrkp-stencil Y CENTER)
               0.5 ;; padding
               ))
           (new-stencil-length
             (interval-length (ly:stencil-extent new-stencil X)))
           (default-stencil-length
             (interval-length (ly:stencil-extent default-stencil X))))

      (ly:grob-set-property! grob 'self-alignment-X
        (/ (- new-stencil-length default-stencil-length)
           (* -1 new-stencil-length)))
      (ly:grob-set-property! grob 'stencil
        new-stencil))))

rM =
#(define-music-function (mark mrkp)(ly:music? markup?)
  #{
    \once \override Score.RehearsalMark #'before-line-breaking =
      #(combine-marks mrkp)
    $mark
  #})

{
  R1*2
  \mark \default
  R
  \rM
  \mark \default \markup \bold \fontsize #-2 "Slightly Slower"
  R1*5
  \rM
  \mark \default \markup \fontsize #-2 "\"Come And Get Your Love\""
  R1*2
  \mark \default
  R1
}

Cheers,
  Harm



reply via email to

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