lilypond-user
[Top][All Lists]
Advanced

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

Overriding skyline settings (for accidentals) in 2.17 ?


From: Paul Morris
Subject: Overriding skyline settings (for accidentals) in 2.17 ?
Date: Sun, 9 Jun 2013 22:52:18 -0400

Greetings everyone,

Here's an obscure "how to do this in 2.17" question.  I have some custom accidental signs that are not as wide or as tall as the standard ones, and so I would like for them to be positioned closer to their notes.

In 2.16 I just set the X-extent and Y-extent, so that they reflect the size of the custom stencils, and that does the trick.  LilyPond automatically positions them quite nicely.  


However, in 2.17 setting the X and Y extent had no effect.  The custom accidentals kept the same spacing as the standard accidentals.  


I'm guessing that this may be due to the new "horizontal-skylines" and "vertical-skylines" properties for accidentals?

So are these skyline settings the ones that I need to be overriding in 2.17 to get the desired result?  How does one go about changing such skyline settings, in general?  What is a "pair of skylines" that these settings take?  Am I just getting ahead of the documentation here?

Rendering the code snippet below in 2.16 and 2.17 shows the difference between them.  

Thanks in advance for any advice on this!

-Paul Morris


%% BEGIN SNIPPET
 \version "2.16"

ln = #(ly:make-stencil
       '(path 0.2
          '(moveto 0  0.6
             lineto 0 -0.6 ))
       (cons 0  0.1)
       (cons 0.6 -0.6))

crcl = #(make-circle-stencil 0.25 0.01 #t)

flt = #(ly:stencil-add ln (ly:stencil-translate crcl '(0 . -0.5)))

shrp = #(ly:stencil-add ln (ly:stencil-translate crcl '(0 . 0.5)))

#(define custom_accidental_engraver
   (make-engraver
    (acknowledgers
     ((accidental-interface engraver grob source-engraver)
      (let* ((mult (magstep (ly:grob-property grob 'font-size 0.0)))
             (acc (accidental-interface::calc-alteration grob)))

        ;; set the 'X-extent and 'Y-extent
        (ly:grob-set-property! grob 'X-extent '(0 . 0.27))
        (ly:grob-set-property! grob 'Y-extent '(0 . 1.2))

        ;; set the stencil
        (set! (ly:grob-property grob 'stencil)
              (ly:stencil-scale
               (cond
                ((= acc -1) dblflt)
                ((= acc -.5) flt)
                ((= acc 0) (ly:stencil-scale (ly:grob-property grob 'stencil) .65 .65 ))
                ((= acc .5) shrp)
                ((= acc 1) dblshrp)
                (else (ly:grob-property grob 'stencil)))
               mult mult))
        )))))

music =
\relative f' {
  \time 1/4
  cis4 ais' <cis, ais'> 
  <cis eis> <eis gis> 
  des bes' <des, bes'>
}

\new Staff {
  \music
}

\new Staff \with {
  \consists \custom_accidental_engraver
}{
  \music
}

%% END SNIPPET

reply via email to

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