Thank you very much Valentin! 🙂 It works perfectly although as you said it 
looks extrange. I will add it to lilypond snippets in case someone has the same 
problem in the future.

Robert

________________________________
De: Valentin Petzel
Enviado: Martes, 01 de Marzo de 2022 20:34
Para: lilypond-user@gnu.org
CC: Robert Mengual
Asunto: Re: [HELP] Change notehead font-size depending on note duration

Hello Robert,

the problem here is that the font-size property of the NoteHead is not
evaluated. (This happens from time to time, and I’m not sure why this is so.)

To get your callback working you can ensure that the font-size is calculated
by doing something like

    \override NoteHead.stencil =
    #(lambda (grob)
       (ly:grob-property grob 'font-size)
       (ly:note-head::print grob))

(the grob-property effectively just forces Lilypond to calculate the value).

Cheers,
Valentin

Am Dienstag, 1. März 2022, 13:15:45 CET schrieb Robert Mengual:
> 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?
>
> Thanks in advance
>
> Best,
> Robert

Reply via email to