Robert Mengual <robert.meng...@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