lilypond-user
[Top][All Lists]
Advanced

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

Re: Overriding skyline settings (for accidentals) in 2.17 ?


From: Paul Morris
Subject: Re: Overriding skyline settings (for accidentals) in 2.17 ?
Date: Tue, 11 Jun 2013 00:33:12 -0400

Yes.  If you set them to an empty list, the code uses the extents
  \override Accidental #'horizontal-skylines = #'()

Thanks for the tip.  I tried it and the result was that the space between the accidentals and notes collapsed:


Changing the X-extent settings did not have an effect on the space between the note and the accidental.

Then I tried "hard-coding" the X-offset which mostly worked, except there are collisions -- accidentals that overlap with each other because they have the same X-offset.  



I tried getting the "default" X-offset to then modify it, but it does not seem like it exists, presumably because the spacing is handled by the skylines.

Anyway, I still haven't found a way that works as well in 2.17 as it does in 2.16.  I suppose there's not an easy way to manually set (or even automatically recalculate?) a skyline for cases where you've changed a stencil.

-Paul 


%%% BEGIN SNIPPET %%%
 \version "2.17"

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))
        
        ;; hard-code the X-offset?
        (ly:grob-set-property! grob 'X-offset -1)
        
        ;; unset the skylines?
        (ly:grob-set-property! grob 'horizontal-skylines '() )
        (ly:grob-set-property! grob 'vertical-skylines '() )

        ;; 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> 
  <eis fis> <fis aes>
  des bes' <des, bes'>
}

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

reply via email to

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