lilypond-user
[Top][All Lists]
Advanced

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

Variable substitution in postscript?


From: Eric Knapp
Subject: Variable substitution in postscript?
Date: Mon, 25 May 2009 13:22:39 -0500

Hi, all.

I'm attempting to create some music functions that have some
postscript commands in them. Is there a way to pass an argument from
the Scheme music function into the embedded postscript? Here's a
simplified example that makes a hollow square notehead:

The function:

sample =
#(define-music-function (parser location thickness note )
  (number? ly:music?)
#{
  \once \override NoteHead  #'stencil = #ly:text-interface::print
  \once \override NoteHead #'text = \markup {
    \postscript #"
      -1.65 0 translate
      0.25 setlinewidth
      0.75 -0.4 0.8 0.8 rectstroke"
  }
 $note
#})

Usage:

\sample #0.25 bf2

What I want to do is have the value of the "thickness" variable
replace the "0.25" in the postscript. I've tried everything that I can
think of and have also looked in some postscript documentation. Is
there a way to do this? It would allow me to solve a lot of things I
want to do with Lilypond.

I'm not sure if I should post questions like this here or to the devel
forum. I did not cross-post so let me know if I should repost there.

Thanks,

-Eric




reply via email to

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