lilypond-user
[Top][All Lists]
Advanced

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

Re: Force text on line without using \textLengthOn


From: Urs Liska
Subject: Re: Force text on line without using \textLengthOn
Date: Tue, 23 Oct 2018 14:20:25 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi Aaron,

thank you for these thoughts and suggestions.

From the layout aspect lyrics would be best, this would save me lots of grey hair wrt baseline and horizontal alignment. But I had already tried to do so earlier and failed miserably. The point is: I can't use a dedicated lyrics variable and need to encode the texts along with the notes (the input files belong to publicly visible edition contents so they really have to be "clean").

Maybe I should give that another try ...

Best
Urs


Am 23.10.2018 um 12:17 schrieb Aaron Hill:
On 2018-10-22 11:27 pm, Urs Liska wrote:
Hi,

I want to use TextScript.staff-padding to produce markup elements that
are aligned to their baseline. In order to prevent the texts from
moving vertically to avoid collisions I used \textLengthOn (or its
spelled-out variant):

\version "2.19.82"

test =
#(define-event-function (text)(markup?)
   #{
     -\tweak extra-spacing-width #(cons -0.0 0.4)
     -\tweak extra-spacing-height #(cons -inf.0 +inf.0)
     -\tweak staff-padding 3
     -\markup #text
   #})

\relative {
  c''8 ^\test "foobar" d16 c
  c8 ^\test "foobar" d16 ^\test "John Doe" c
}

However, this does not only push the next notes when there actually is
some neighboring text (as in the second beat of the following example)
but also when it wouldn't be needed (see atttached image):

Uncommenting the extra-spacing... tweaks will result in the texts
moving vertically which is not desired.

Is there another approach to make the following note columns move -
but only if there *is* something in the way?

At first glance, I would have assumed the issue is that the markup is only considering the duration of the note to which it is attached.  So the solution seemed to be to attach the markup to something longer.  I tried creating a new voice with skips of the appropriate length.  However, the markup still insisted on stretching the spacing only for the note at the same moment.  (Is that a bug or just my misunderstanding of something?)

But lyrics seem to work:

%%%%
  \new Staff {
    <<
      \new Voice { s4 ^"foobar" s8 ^"foobar" s8 ^"John Doe" }
      \new Voice { c''8 d''16 c'' c''8 d''16 c'' }
      \new Lyrics
        \with {
          \override LyricText.self-alignment-X = #-1
          \override LyricText.font-size = #0
        }
        \lyricmode { "foobar"4 "foobar"8 "John Doe"8 }
    >>
  }
%%%%

NOTE: I left in the voice with the skips for reference of my first approach.  Unsurprisingly, the lyrics cause the notes to space as one would expect which gives enough room for the markup to function normally, since I forced the lyrics to be the same size as the default markup.

So if you want markup to be able to span multiple notes and stay aligned to a baseline, could you repurpose lyrics for this purpose?

Granted, a potentially big issue with either of the above options is that the markup is no longer located with the associated notes.  But perhaps some clever Scheme could take in music with notes and attached markup in the normal manner and automatically generate a voice without markup and the markup as lyrics with the appropriate durations.


-- Aaron Hill

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




reply via email to

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