lilypond-user
[Top][All Lists]
Advanced

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

Re: Graphics


From: Johannes Roeßler
Subject: Re: Graphics
Date: Mon, 10 Apr 2023 18:06:50 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1

solution from Jean Abou Samra in  another thread:

Consider baking the offset into the markup itself, e.g.,
  \override Staff.Clef.stencil = #ly:text-interface::print
  \override Staff.Clef.text =
    \markup \lower #0.5 \epsfile #X #1.5 "XXX"

- just to have this in this thread for future searches...
Joei
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

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