[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to catch extent of AccidentalPlacement?
From: |
David Nalesnik |
Subject: |
Re: How to catch extent of AccidentalPlacement? |
Date: |
Sat, 12 Apr 2014 09:21:38 -0500 |
Hi Harm,
On Sun, Mar 16, 2014 at 7:06 AM, Thomas Morley <address@hidden>wrote:
> 2014-03-12 1:27 GMT+01:00 Thomas Morley <address@hidden>:
> > Hi,
> >
> > for some function I need to know the extent/length of the
> AccidentalPlacement.
> >
> > With 2.16.2 I used to do something like:
> >
> > info =
> > \override Staff.AccidentalPlacement #'after-line-breaking =
> > #(lambda (grob)
> > (display (interval-length (ly:grob-extent grob grob X)))
> > (newline))
> >
> > \relative c' {
> > \info
> > <c d>
> > <cis d>1
> > <cis dis>
> > <cis dis eis>
> > <cis dis eis fis>
> > <cis dis eis fis gis>
> > }
> >
> > and got different values.
> >
> > With 2.18.0 and 2.19.1 it always returns the same: 1.1
> > Looks like a bug to me.
> > How to do it different?
> >
> > Cheers,
> > Harm
>
> Noone with an idea?
Forgive the late reply...
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>
}
--David
- Re: How to catch extent of AccidentalPlacement?,
David Nalesnik <=