lilypond-user
[Top][All Lists]
Advanced

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

Re: global alignment tweak for ChordName


From: Jean Abou Samra
Subject: Re: global alignment tweak for ChordName
Date: Tue, 21 Dec 2021 21:42:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1

Le 21/12/2021 à 21:33, David Kastrup a écrit :
Kieren MacMillan <kieren@kierenmacmillan.info> writes:
Hi again,

When I try to use it in my main file, I get this:

  In procedure ly:stencil-extent in expression (ly:stencil-extent sten X):
/Users/kmac/Documents/01_music/scores/_include/paper/musical.ily:254:21:
Wrong type argument in position 1 (expecting Stencil): #f

Any thoughts about what might be going wrong?
It is applied to a grob that has been given the \omit treatment?


Certainly. Kieren, try this:

\version "2.22.1"

\layout { ragged-right = ##f }

music = \chordmode {
  c1 c:7 c:m7 c':m6.4.2/ees \once \omit ChordName c
}

\score {
  <<
    \new ChordNames \music
    \new Staff \music
  >>
  \layout {
    \context {
      \Score
      \override ChordName.X-offset =
      #(lambda (grob)
         (let ((sten (ly:grob-property grob 'stencil)))
           (if (ly:stencil? sten)
               (let* ((xex (ly:stencil-extent sten X))
                      (width (interval-length xex)))
                 (max -2 (* -0.5 (max 0 (- width 2))))))))
    }
  }
}
%%%%

Best,
Jean




reply via email to

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