lilypond-user
[Top][All Lists]
Advanced

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

Re: Cannot get a text stencil from this font


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


At 16:43 on 05 Sep 2021, Jean Abou Samra wrote:
Le 05/09/2021 à 16:22, Mark Knoop a écrit :
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?

Script has font-encoding set to 'fetaMusic, to look
up glyphs in music fonts. That's curious as it doesn't
seem to need it (it uses music font defaults for its
default stencil anyway). Try:

\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)))))))

{
  R1
 -\tweak stencil \overlayMarkup 0 0 0 3 "test"
 \fermata
 g'1
 -\tweak stencil \overlayMarkup 0 0 0 3
   \markup \override #'(font-encoding . latin1) "test"
 \fermata
}

Many thanks Jean, that's it. Strange that this is affected by the Grob the 
Script is being attached to.

--
Mark Knoop



reply via email to

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