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: Valentin Petzel
Subject: Re: global alignment tweak for ChordName
Date: Tue, 21 Dec 2021 20:50:18 +0000 (UTC)

Hello Jean, hello David, hello Kieren,

you should even be able to write (if sten (ly:stencil-extent sten)), as the 
stencil should always be a stencil or #f.

Cheers,
Valentin

21.12.2021 21:42:13 Jean Abou Samra <jean@abou-samra.fr>:

> 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]