lilypond-user
[Top][All Lists]
Advanced

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

Cannot get a text stencil from this font


From: Mark Knoop
Subject: Cannot get a text stencil from this font
Date: Sun, 05 Sep 2021 15:22:33 +0100
User-agent: mu4e 1.6.5; emacs 27.2

Hi,

I'm using Aaron's excellent overlayMarkup function from this thread: 
https://lists.gnu.org/archive/html/lilypond-user/2021-09/msg00052.html and am 
seeing different behaviour for Script objects depending if they are attached to 
notes or to multimeasure rests. See the following example. Any ideas how to 
deal with this?

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.23.3"

overlayMarkup =
#(define-scheme-function
 (self-x self-y parent-x parent-y markup)
 ((number? 0) (number? 0) (number? 0) (number? 0) markup?)
 (grob-transformer 'stencil
  (lambda (grob orig)
   (let* ((xex (ly:stencil-extent orig X))
          (yex (ly:stencil-extent orig Y))
          (xoff (interval-index xex parent-x))
          (yoff (interval-index yex parent-y))
          (sten (grob-interpret-markup grob markup)))
    (set! sten (ly:stencil-aligned-to sten X self-x))
    (set! sten (ly:stencil-aligned-to sten Y self-y))
    (ly:stencil-add orig
     (ly:stencil-translate sten (cons xoff yoff)))))))

{
 %% this usage works
 R1
 -\tweak stencil \overlayMarkup 0 0 0 3 "test"
 \fermata

 %% this usage fails
 %%    programming error: Cannot get a text stencil from this font
 %%    continuing, cross fingers
 g'1
 -\tweak stencil \overlayMarkup 0 0 0 3 "test"
 \fermata
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

--
Mark Knoop
mark@markknoop.com
https://markknoop.com/



reply via email to

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