Thank you again!
As I see, the thing that mostly prevented me from understanding the code
was that the parameters come before the commands :-)
Bye,
Adam
________________
Siska Ádám
+36 (70) 207-63-85
http://apocalypse.rulez.org/~sadam
Valentin Villenave wrote:
2007/7/26, Siska Ádám <[EMAIL PROTECTED]>:
BTW, could you explain a bit (maybe in a private mail) how actually it
works? I would like to adopt the sign to be able to create the
down-arrowed accidentals too, and to be able to attach them to natural
signs also, but unfortunately I know nothing about postscripting...
Actually, neither do I :)
The basics are quite easy to learn though (I've been playing with it
for only a couple weeks).
Think of a pen on the paper. I've just printed the accidental glyph,
so the postscript object will start on the right of the sign.
Therefore I have to move it to the left:
-1.4 0.5 moveto %% where -1.4 is the X coordinate of my new origin point
Then I print the first (vertical line), starting from this point and
going up:
-1.4 2 lineto %% as you can see, only the Y coordinate has changed
Besides, I use
0.17 setlinewidth
to make a thicker line so it's seamlessly integrated with the glyph.
This was my first line. I could go on with the other lines, but I want
thiner lines now.
So have to create two distincts objects.
I add
stroke %% to tell the engine to actually draw my first object (the
line); and I'll insert
gsave %% at the beginning of my code , and
grestore %% after my code, to start a whole new object (the arrowhead)
The new object is printed in a similar way:
gsave %% I save the initial state
0.1 setlinewidth %% previously it was 0.17, so this is thiner
-1.7 1.4 moveto %% I move my pen without drawing anything
-1.4 2.18 lineto %% first line, towards the top of the thick line
(notice the -1.4 Y axis)
-1.1 1.4 lineto %% starting from the end of the previous line, I
directly draw the second (to the right)
stroke %% don't ask me why this is needed
Here ends the PostScipt part.
I included it in a very basic Scheme function I found in the manual:
http://lilypond.org/doc/v2.10/Documentation/user/lilypond/Simple-substitution-functions
#(define-music-function (parser location note) (ly:music?)
I create a variable, which will be named "note" (don't ask me how it
works)
the (ly:music?) is a musical expression (so if you have several notes
to affect, you can encloe them in brackets and each accidental in the
brackets will be modified)
Here's the cool part: you can use Scheme to write genuine lilypond code
#{ \once \override Voice.Accidental #'stencil =
#ly:text-interface::print
%%The Accidental object is replaced by a Text object (so I can use
\markup)
\once \override Voice.Accidental #'text =
%% Here comes the \markup, which include two objects: the glyph...
\markup {\musicglyph #"accidentals.sharp"
%% ...and the postscript code
\postscript #"gsave 0.17 setlinewidth -1.4 0.5 moveto -1.4 2 lineto
stroke grestore
gsave 0.1 setlinewidth -1.7 1.4 moveto -1.4 2.18 lineto -1.1 1.4
lineto
stroke grestore"}
%%And of course, I don't forget to print the note after the accidental
$note #})
I'm really new to this (both Scheme and PostScript), so you see it
isn't very hard to do basic things. It is probably a very dirty code,
but it works.
Regards,
Valentin
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user