Hi List,

Tonight I'd like to share with you some tools I'm experimenting for a
couple of weeks that can ease to make drawings with the 'path' command.

Almost everyone here uses postscript images when a new glyph is needed. But
it may causes some issues (no svg, some overrides are not possible  e.g.
color...)
So why not using 'path'?

For sure, when I first put my eyes here (scroll down until 'samplePath'):
http://lilypond.org/doc/v2.18/Documentation/notation/graphic.fr.html with
its weird fight glove glyph it looked a little mysterious. But after many
trials and with some self-made tools to help me finding the right
coordinates it revealed that it's a pretty powerful toy.
And a recent conversation made me think that maybe I could re-think and
enhanced those tools and shared them with you. So, here we go!

The idea is to use LP and your favorite editor as a cad.
So please find herewith "graphPaper.ily" and an unfinished example to show
you how my glyphs are constructed.
Basically, all you need is knowing how to find coordinates on a graph,
combining an original glyph behind the graph paper and follow the lines
with the specific path commands: moveto, lineto, curveto, closepath (note
that I only use absolute coordinates).
"graphPaper.ily" includes a graph paper ("1" equivalent to the distance
between 2 staff lines) and ready to use tangents to help you to choose the
right Bézier coordinates.
I also put lots of comments in the example. Please feel free to ask if
anythings' unclear or badly explained.

Waiting for your comments,
Cheers,
Pierre

PS. Recent path examples added to the LSR:
- http://lsr.di.unimi.it/LSR/Item?id=991
- http://lsr.di.unimi.it/LSR/Item?id=989
- http://lsr.di.unimi.it/LSR/Item?id=988
- http://lsr.di.unimi.it/LSR/Item?id=987
- http://lsr.di.unimi.it/LSR/Item?id=986
- http://lsr.di.unimi.it/LSR/Item?id=984
- http://lsr.di.unimi.it/LSR/Item?id=982 (with absolute coordinates, LP has
already one with relatives')
- http://lsr.di.unimi.it/LSR/Item?id=973 (pseudo stems)
- http://lsr.di.unimi.it/LSR/Item?id=904
- http://lsr.di.unimi.it/LSR/Item?id=900
- http://lsr.di.unimi.it/LSR/Item?id=890

If you're still interested after this toooo-long list, Paul's specific
snippet are very helpful too:
- http://lsr.di.unimi.it/LSR/Item?id=891
- http://lsr.di.unimi.it/LSR/Item?id=623

Attachment: graph-paper.ily
Description: Binary data

Attachment: 256up.pdf
Description: Adobe PDF document

\version "2.19.16"
\include "graph-paper.ily"

%% ouput options possible, e.g.:
#(set-global-staff-size 350)
%#(set-default-paper-size "a4" 'landscape)

%% full view - markups have to be \translate #'(10 . -10) :
%#(set-default-paper-size "a1")

%% original drawing copy (could be an 'eps' file):
original = 
\markup
\column {
 \scale #'(0.86 . 1)
 %\with-color #grey
 \with-color #white
 \musicglyph #"flags.u3"
 \vspace #-.68
 \with-color #grey
 \musicglyph #"flags.u7"
}

%%%% graph paper, path, Bézier tools:
\markup 
\with-dimensions #'(0 . 0) #'(0 . 0) %% <= has to be set to 'no-dimension' in 
                                     %%    order to avoid 'compress' warnings.

%% full view : \translate #'(10 . -10) 
\translate #'(1 . 0) %% <= set the page center
{
  %% control #1 ('orig' behind graphPaper):
  \combine\original
  
  %% graphPaper
  \combine\graphPaper
  
  %% control #2 ('orig' behind PATH):
  %\combine\original
  
  %% Bézier tools syntax: tan'Axe' #'rotation' #'translation'.
  %% e.g.: \combine\tanX #45 #1
  %% (comment/uncomment lines to hide/show tangents).
  
  %% tanX (blue), moves left (-x) to right (+x):
  %\combine\tanX #39 #-0.81
  %\combine\tanX #42 #-1.72
  %\combine\tanX #49 #-3.27
  \combine\tanX #48 #-4.19
  
  %% tanY (red), moves down (-y) to up (+y):
  %\combine\tanY #76 #-5.28
  %\combine\tanY #83 #-7
  %\combine\tanY #66 #-4.9
  %\combine\tanY #76 #-5.5
  %\combine\tanY #65 #-5.76
  %\combine\tanY #71 #-5.83
  %\combine\tanY #67 #-6.84
  \combine\tanY #73 #-7
  
  %% PATH:
  %% use absolute commands: moveto, lineto, curveto & closepath
  \combine 
  %\override #'(filled . #t) 
  %\with-color #magenta
  \path #0.001 
  #'((moveto   -0.05   0.00)
     (lineto   -0.01   0.00) 
     (lineto   -0.01  -0.10)
     (curveto  -0.01  -0.75   0.93  -1.55   0.68  -2.55)
     (lineto    0.57  -2.35)
     (curveto   0.63  -1.90   0.48  -1.60  -0.01  -0.99)
     (lineto   -0.01  -1.09)
     (curveto  -0.01  -1.80   1.07  -2.50   0.69  -3.35)
     (lineto    0.59  -3.16)
     (curveto   0.67  -2.81   0.58  -2.54  -0.01  -1.90)
     (lineto   -0.01  -2.03)
     (curveto  -0.01  -2.77   1.18  -3.26   0.68  -4.30)
     (lineto    0.59  -4.12)
     (curveto   0.72  -3.75   0.70  -3.44  -0.01  -2.84)
     (lineto   -0.01  -2.95)
     (curveto  -0.01  -3.70   1.17  -4.20   0.69  -5.22)
     (lineto    0.59  -5.05)
     (curveto   0.77  -4.50   0.53  -4.25  -0.01  -3.76)
     ;;;;;;
     ;;;;;;
     (lineto   -0.01  -6.11)
     (lineto   -0.05  -6.11)
     (closepath)
    )
  
  %% control #3 ('orig' over PATH):
  %\combine\original
  
  %% END
  \null
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to