lilypond-user
[Top][All Lists]
Advanced

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

Re: [HELP] Change notehead font-size depending on note duration


From: David Kastrup
Subject: Re: [HELP] Change notehead font-size depending on note duration
Date: Tue, 01 Mar 2022 19:04:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Robert Mengual <robert.mengual@outlook.com> writes:

> Hello everyone,
>
> I am facing a challenge in which I have been stuck already 7 days. I
> am sending this email as my last hope to get this done or at least
> receive any assistance that allows me to move forward. I really hope
> you can help me.
>
> Find attached a Tiny.ly, I did the same for changing things like
> NoteHead.text and NoteHead.Y-offset and everything worked
> perfectly. However, it looks like I cannot use the grob when changing
> the NoteHead.font-size
>
> I would really appreciate any help. Am I doing something wrong? Is
> there a better way to achieve what I want?

Well, font properties are not callback material.  And you should not
have mentioned NoteHead.text as being relevant and cause me extra work.

Here is one way:

#(define resized-stencil (grob-transformer 'stencil
                          (lambda (grob default)
                           (let ((scale (magstep (- 2
                                                  (ly:duration-log
                                                   (ly:event-property
                                                    (event-cause grob) 
'duration))))))
                            (ly:stencil-scale default scale scale)))))

\relative c' {
  \temporary \override NoteHead.stencil = #resized-stencil
  c1 | c2 d4 e8 f16 g32 a64 b128 c
}

-- 
David Kastrup

reply via email to

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