lilypond-user
[Top][All Lists]
Advanced

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

Re: Changing staff size with custom note head stencils


From: address@hidden
Subject: Re: Changing staff size with custom note head stencils
Date: Thu, 1 Nov 2012 12:48:26 +0100


On 1 nov. 2012, at 12:44, address@hidden wrote:

On 1 nov. 2012, at 00:11, Paul Morris <address@hidden> wrote:

On Oct 31, 2012, at 4:52 PM, Thomas Morley <address@hidden> wrote:

Hi Paul,

postscript is scaled with global-staff-size only.

To work around you could use:

TwinNoteNoteHeads =
#(lambda (grob)
 (let* ((sz (ly:grob-property grob 'font-size 0.0))
        (mult (magstep sz)))
     (set! (ly:grob-property grob 'stencil) (ly:stencil-scale
(stencil-notehead grob) mult mult))
     (set! (ly:grob-property grob 'stem-attachment) (stem-adjuster grob))))


Hi Harm and Mike,  
Thank you both for your help!  Harm's work around does the trick nicely!

On Mike's suggestion I also switched to using internal path stencils instead of embedded PS. The only problem I ran into was using "fill" to get a filled triangle.  I used:

upTriangle =
#(ly:make-stencil
    '(path 0.09
        '(moveto -.1875 -.5
          lineto .65625 .5
          lineto 1.5 -.5
          closepath
          fill ()
          )
     )
    (cons -.1875 1.5)
    (cons -.5 .5)
)

When I typeset my file the visual output is correct (filled triangles), but I get either an "Unsupported SCM value for format" error for each of those notes.  (Or if I omit the "()" after "fill" then the rendering fails with "Wrong type argument in position 1 (expecting pair): ()").  I did not find much documentation for "path", only a snippet that doesn't use "fill" [1].  

Does anyone know the value that is needed for "fill" to avoid this error?

Thanks again, it will be great to be able to resize staves!

-Paul



Hey Paul,

Try make-connected-path-stencil.

(make-connected-path-stencil pointlist thickness x-scale y-scale connect fill)

Here, the x-scale and y-scale are scaling along the x and y axes, connect is a boolean if the path should be connected, and fill is a boolean if the path should be filled.  So...

upTriangle =
#(make-connected-path-stencil
  '(moveto -.1875 -.5
          lineto .65625 .5
          lineto 1.5 -.5)
     )
  0.09
  1.0
  1.0
  #t
  #t
)
The dimensions will be calculated for you by the function.

Cheers,
MS

Sorry, I spoke too soon.
The function above won't work.  You'd need to do something like:

upTriangle =
#(ly:stencil-translate (make-connected-path-stencil
  '(
          (.65625 .5)
          (1.5 -.5)
     )
  0.09
  1.0
  1.0
  #t
  #t
) '(-.1875 . -.5))

Cheers,
MS

reply via email to

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