[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: Finding the objects at the start of the current measure
From:       Thomas Morley <thomasmorley65 () gmail ! com>
Date:       2019-02-28 0:34:31
Message-ID: CABsfGyWg96Cj88pJ9V6g=rMC5rybNHCB8tmwXneoEEABKbSDSA () mail ! gmail ! com
[Download RAW message or body]

Am Mi., 27. Feb. 2019 um 08:51 Uhr schrieb Urs Liska <lists@openlilylib.org>:

> For me that means the results with 'minimum-length seem to be generally
> more reliable - with the exception of the start-measure objects.

Well, below an approach for minimal-length. The results are
inconsistent as well.
Currently not sure how to proceed...

\paper { ragged-right = ##t }

buzz =
  \override MultiMeasureRest.minimum-length =
    #(lambda (grob)
       (let* ((vag (ly:grob-parent grob Y)) ;; VerticalAxisGroup
              (vag-elts-array (ly:grob-object vag 'elements))
              (vag-elts-ls
                (if (ly:grob-array? vag-elts-array)
                    (ly:grob-array->list vag-elts-array)
                    '()))
              (mm-grobs
                (filter
                  (lambda (elt)
                    (and
                      (equal? (ly:grob-parent elt X) grob)
                      (grob::has-interface elt 'multi-measure-interface)))
                  vag-elts-ls)))

         (if (pair? mm-grobs)
             (let* ((mm-text-stil-x-lengths
                      (map
                        (lambda (mm)
                          (interval-length
                            (ly:stencil-extent
                              (grob-interpret-markup
                                mm
                                (ly:grob-property mm 'text))
                              X)))
                        mm-grobs))
                    (max-text-x-length
                      (apply max mm-text-stil-x-lengths))
                    (left-bound (ly:spanner-bound grob LEFT))
                    (left-bound-width
                      (ly:axis-group-interface::width left-bound))
                    (right-bound (ly:spanner-bound grob RIGHT))
                    (right-bound-width
                      (ly:axis-group-interface::width right-bound)))

                 (+ 1
                    (interval-length left-bound-width)
                    ;(interval-length right-bound-width)
                    max-text-x-length)))))

{
  \buzz

  R1^"very very long"_"not short"
  R1^"very very long"_"not short"
  \key cis \major
  R1^"very very long"_"not short"
  R1^"very very long"_"not short"
  R1^"very very long"_"not short"
  \key ces \major
  \break
  R1^"very very long"_"not short"
  \key cis \major
  R1^"very very long"_"not short"
}


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic