lilypond-user
[Top][All Lists]
Advanced

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

Re: collision of special notehead and accidental


From: address@hidden
Subject: Re: collision of special notehead and accidental
Date: Mon, 14 Nov 2011 11:11:53 +0100

On Nov 14, 2011, at 11:02 AM, takumi ikeda wrote:

> When using special notehead, accidental and notehead collide to some specific
> notes. What should I do in order to avoid this using Scheme?
> 
> \version "2.14.2"
> 
> triBk =
> #(ly:make-stencil 
>       (list 'embedded-ps
>       "gsave
>       currentpoint translate
>       newpath
>       -.1675 .5 moveto
>       .65625 -.5 lineto
>       1.5 .5 lineto
>       closepath
>       fill
>       grestore" )
>       (cons -.1875 1.5)
>       (cons -.5 .5)
> )
> 
> triWt =
> #(ly:make-stencil 
>       (list 'embedded-ps
>       "gsave
>       currentpoint translate
>       newpath
>       -.0775 .43 moveto
>       .65625 -.43 lineto
>       1.39 .43 lineto
>       closepath
>       0.1 setlinewidth
>       stroke
>       grestore" )
>       (cons -.1875 1.5)
>       (cons -.5 .5)
> )
> 
> #(define (stencil-notehead grob)
>       (if (> 2 (ly:grob-property grob 'duration-log))
>       triWt triBk
>       )
> )
> 
> upStem                = #'(1 . .9)
> downStem      = #'(1 . -1)
> 
> #(define (pitch-to-stem stemdir)
>       (if (= UP stemdir) upStem downStem)
> )
> 
> #(define (notehead-get-notecolumn nhgrob)
>       (ly:grob-parent nhgrob X))
> 
> #(define (notehead-get-stem nhgrob)
>       (let ((notecolumn (notehead-get-notecolumn nhgrob)))
>               (ly:grob-object notecolumn 'stem)))
> 
> #(define (stem-adjuster nhgrob)
>       (pitch-to-stem
>               (ly:grob-property (notehead-get-stem nhgrob) 'direction) ))
> 
> 
> notes = \relative c' {
>       c2 cis d dis e f fis g gis a ais b
>       c cis d dis e f fis g gis a ais b
>       c4 b bes a aes g ges f e ees d des
>       c b bes a aes g ges f e ees d des
> }
> 
> 
> \new Staff 
> {
>       \override NoteHead #'stencil = #stencil-notehead
>       \override NoteHead #'stem-attachment = #stem-adjuster
>       <<
>               \notes 
>       >>
> }
> 
> 

If you download the unstable version, you can use a new feature called 
unpure-pure-containers to solve this problem.

In the current stable version, you'd have to not use a function as an override 
but rather use the stencil directly.

Cheers,
MS


reply via email to

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