lilypond-user
[Top][All Lists]
Advanced

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

Re: How to catch extent of AccidentalPlacement?


From: Thomas Morley
Subject: Re: How to catch extent of AccidentalPlacement?
Date: Sat, 12 Apr 2014 23:53:04 +0200

Hi David,

2014-04-12 16:21 GMT+02:00 David Nalesnik <address@hidden>:
[...]
> Forgive the late reply...

No problem. :)
Meanwhile I've found a solution myself, though, your coding below is
much more elegant.

>
> What about something like this?
>
> \version "2.19.3"
>
>
> info =
>
> \override Staff.AccidentalPlacement #'after-line-breaking =
>
> #(lambda (grob)
>
>   (let* ((accs (map cadr (ly:grob-object grob 'accidental-grobs)))
>
>           (sys (ly:grob-system grob))
>
>           (X-exts (map (lambda (x) (ly:grob-extent x sys X)) accs))
>
>           (un (reduce interval-union '() X-exts)))
>
>     (display (interval-length un))
>
>     (newline)))
>
>
> \relative c' {
>
>   \info
>
>   <c d>
>
>   <cis d>1
>
>   <cis dis>
>
>   <cis dis eis>
>
>   <cis dis eis fis>
>
>   <cis dis eis fis gis>
>
> }

One question remains: why was it changed?
Instead of more or less simply calling the vallue via ly:grob-extent
we now have to calculate it, looking at each Accidental separately.
(via map and reduce)

Just curious.
I must have missed that change.

Thanks,
  Harm



reply via email to

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