lilypond-user
[Top][All Lists]
Advanced

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

Embedded PS graphics into scores


From: Jesús Guillermo Andrade
Subject: Embedded PS graphics into scores
Date: Tue, 17 Nov 2009 08:58:48 -0430

Dear fellows: Inspired by the script created for flamenco music I began to design some symbols which are specific for a cuatro in Venezuela and other parts of the world.
At any rate, the main difficulty Im experiencing right now is the fact that no matter how good, or scaled or proportioned I put a graphic, it just gets repeated twice in the output.
Let me explain.
1. Originally, the guy that created the flamenco example, used very simple PS commands to draw, again, a very simple shape of an arrow. To insert them, you just need this kind of construct:

golpe = \markup { \postscript #"
  0.2 setlinewidth
  0 0 moveto
  1 0 lineto
  1 1 lineto
  stroke

2. This, however nice, is not sufficient for my purposes. Since I need better arrows I decided to install a complete function for creating several kinds of arrows by using PS command exclusively. Now, the place to use this arrows is probably in the title section, so I put them in my file like this:

\header {
  tagline = ##f
  title = "Viajera del Río"
  subtitle = "Vals Venezolano"
  composer = \markup {
    \column \roman \right-align {"Manuel YÁNEZ"
\lower #2 \tiny "Transcrito por Jesús G. Andrade."
\lower #1 \tiny "Conservatorio Vicente E. Sojo."
\vspace #1
    }
  }
  meter = \markup {\strokeUp \strokeUp \strokeDown \strokeDown \strokeUp}
}

3. As you can see, I redefined the strokeUp and Down just for testing purposes and used it within the \meter environment for the nice placement in regard of the page and the score. The said PS function gets interpreted well with GS, however, they get repeated and lilypond inserts a full empty page with it. I tried to simplify it to the extreme, but is seems lilypond gets confused with the context of the ps function. This is the full example of the function to draw an arrow as I want:

% Finger stroke symbols
strokeUp = \markup { \postscript #"
/arrowdict 14 dict def
arrowdict begin
   /mtrx matrix def
end

/arrow
 {arrowdict begin                                 
   /headlength exch def
   /halfheadthick exch 2 div def
   /halfthick exch 2 div def
   /tipy exch def  /tipx exch def
   /taily exch def /tailx exch def
                           
   /dx tipx tailx sub def
   /dy tipy taily sub def
   /arrowlength dx dx mul dy dy mul add sqrt def
   /angle dy dx atan def
   /base arrowlength headlength sub def
   
   /savematrix mtrx currentmatrix def
                    
   tailx taily translate
   angle rotate
   
   0 halfthick neg moveto
   base halfthick neg lineto
   base halfheadthick neg lineto
   arrowlength 0 lineto
   base halfheadthick lineto
   base halfthick lineto
   0 halfthick lineto
   closepath
   
   savematrix setmatrix
 end
} def                       
   newpath
   4 3 4 .9 .9 2 2 .2 sqrt mul 2 div
arrow .65 setgray fill
showpage


Any clues as to what can I do to get rid of this erroneous behaviour?  I appreciate your patience.


Guillermo





reply via email to

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