Hi Paul, Thanks for the reminder! Makes me think that I could simplified lots of my path's codes ;). Anyway... I suppose that for 'make-path-stencil', 'Z' stays for 'closepath', doesn't it? So what's 'z' for ?
Cheers, Pierre 2015-04-13 15:40 GMT+02:00 Paul Morris <p...@paulwmorris.com>: > Schneidy wrote > > Now I understand - font size changes won’t affect this code as it is not > >> drawing from the font. But I am not sure what code will scale the > >> noteheads. Do I need a separate stencil for different sizes? That’s not > >> so > >> bad, as I only want to differentiate normal notes and grace notes. > >> > > > > Yes, I think you'll have to scale note heads for graces' (e.g. \scale > > #'(.8 > > . .8) \sOne) > > Does it help? > > Cheers, > > Pierre > > For another example of how to scale such custom stencils, especially with > the font size, but also to create a smaller grace note version, see: > http://lsr.di.unimi.it/LSR/Item?id=623 > > Especially this part: > > scaleCustomClefStencilTwo = > #(lambda (grob) > (let* ((sz (ly:grob-property grob 'font-size 0.0)) > (mult (magstep sz))) > (set! (ly:grob-property grob 'stencil) > (ly:stencil-scale > customClefStencilTwo > mult mult)))) > > > This snippet shows a different way to make a path stencil with: > #(ly:make-stencil `(path > this is a low level way and it requires you to specify the X and Y extents > of the stencil. > > See a higher level method here: > Using make-connected-path-stencil to draw custom shapes > http://lsr.di.unimi.it/LSR/Item?id=891 > Which calculates the X and Y extents for you, but the path has to be > connected. > > In 2.19 there is an improved version "make-path-stencil" where the path > doesn't need to be connected. There's not a snippet for it yet because it's > not in 2.18. As far as I know this method provides the most flexibility > and > least constraints. Here are some examples (the use of \markup here is just > for convenient demonstration): > > %%%%%%%%%%%%%%%%% > \version "2.19" > > { > > c'1^\markup \stencil > #(make-path-stencil > ;; path, accepts both "rmoveto" and "m", "curveto" and "C", etc. > '(rmoveto -1 1 > rcurveto 0 0.75 1 0.75 1 0 > rcurveto 0 -0.75 -1 -0.75 -1 0 > rcurveto -1 0 -1 1.5 -0.5 1.5 > rmoveto 0.5 -1.5 > c -1 0 -1 -1.5 -0.5 -1.5 > m 1.5 1.5 > c 2.5 0 2.5 4 4 4 > m -4 -4 > c 2.5 0 2.5 -4 4 -4) > ;; line thickness > 0.2 > ;; x and y scaling factors > 1 1 > ;; filled? > #f) > > c'1^\markup \stencil > #(make-path-stencil > `(rmoveto 0 0 > rlineto 2 0 > rlineto 0 -2 > rlineto -2 0 > closepath > rmoveto 1.1 -1.1 > rlineto 2 0 > rlineto 0 -2 > rlineto -2 0 > closepath > rmoveto 1.1 -1.1 > rlineto 2 0 > rlineto 0 -2 > rlineto -2 0 > closepath) > 0.2 1 1 #f) > > c'1^\markup \stencil > #(make-path-stencil > '(moveto 6 0 > curveto 0 -2 0 7 6 5 > curveto 3 5 3 0 6 0) > 0.2 0.5 0.5 #f) > > c'1^\markup \stencil > #(make-path-stencil `(L 0 0 L 1 2 L 2 0 Z M 1 3 L 1 0) 0.2 1 1 #f) > > c'1^\markup \stencil > #(make-path-stencil `(l 1 2 L 2 0 z) 0.2 1 2 #t) > > } > > %%%%%%%%%%%%%%% > > And then there's the \path markup command method that Pierre used. This > one > requires that you have access to a grob so you can do grob-interpret-markup > (which is not required by the other methods). > > I think that covers it! > -Paul > > > > > > > -- > View this message in context: > http://lilypond.1069038.n5.nabble.com/Custom-noteheads-stem-alignment-tp174412p174461.html > Sent from the User mailing list archive at Nabble.com. > > _______________________________________________ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user >
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user