Le 21/12/2021 à 21:33, David Kastrup a écrit :
Kieren MacMillan <kie...@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