I'm now able to include the eps - but still struggle to place the clef (it should be centered on the G-Line) as I like to do:

\version "2.24.0"

  \new Staff {
    \clef G c'1
    \override Staff.Clef.stencil = #ly:text-interface::print
    \override Staff.Clef.text = \markup \epsfile #X #1.5 "HasslerG3.eps"
    \set Staff.clefPosition = #0
    \set Staff.clefTransposition = #0
    \set Staff.middleCPosition = #-4
    \set Staff.middleCClefPosition = #-4
    \clef F c
    \clef G c'
   }

\layout { }

I tried to include whitespace above the clef in the eps, but this didn't change anything, looks like the bottom of the eps is placed on the g-line.
best regards
Joei

Le samedi 08 avril 2023 à 10:58 +0200, Johannes Roeßler a écrit :

now I managed to make my EPS accessable in Lilypond, and I am able to use it as markup. Now I want to use it to replace a clef. In the snippets there is a way, that creates an alternative stencil and then uses:

 \override Clef.stencil =
      #(lambda (grob)
         (let* ((sz (ly:grob-property grob 'font-size 0))
                (mlt (magstep sz))
                (glyph (ly:grob-property grob 'glyph-name)))
                 (cond
                  ((equal? glyph "clefs.F")
                     (ly:stencil-scale my-clef (* 1 mlt) (* 1 mlt)))
                  ((equal? glyph "clefs.F_change")
                    (ly:stencil-scale my-clef (* .8 mlt) (* .8 mlt)))
                  (else (ly:clef::print grob)))))

- but in this case I would need to define the stencil. Is there a way to replace a clef glyph with an EPS?

There is a general technique you can use to replace any grob's stencil using a markup: set the stencil property to |ly:text-interface::print|, which tells LilyPond to compute the stencil using the markup in the |text| property, and set that property to what you want.

|\layout { \override Staff.Clef.stencil = #ly:text-interface::print \override Staff.Clef.text = \markup \epsfile #X #10 "/home/jean/repos/lilypond/input/regression/lilypond.eps" } |

HTH,

Jean

Reply via email to