Hi David,
Am 11.04.2017 um 22:42 schrieb David Nalesnik: > On Tue, Apr 11, 2017 at 3:34 PM, David Nalesnik > <[email protected]> wrote: >> On Tue, Apr 11, 2017 at 1:52 PM, Urs Liska <[email protected]> wrote: >>> >>> Am 11.04.2017 um 20:46 schrieb Malte Meyn: >>>> Am 11.04.2017 um 20:36 schrieb Urs Liska: >>>>> So, is there any moment in the compilation process where the natural, >>>>> unstretched length of a measure can be calculated? It doesn't have to be >>>>> an easily-read property and can involve calculation, but actually the x >>>>> position of the barlines would be an easy target - *if* there's this >>>>> magic moment in the compilation pipeline ;-) >>>> Maybe you could experiment with the ly:one-line-breaking? >>> I don't think so (only, of course, to investigate how much can be done >>> on the internal level). >>> Basically what I'm after is a ly:cheap-line-breaking mode that doesn't >>> care at all about overall appearance or good page turns but instead >>> simply places as many measures in a line as fit naturally. If then a >>> line break changes and I know the natural width of the measures I can >>> determine before compilation how many measures will fit on the *next* >>> system. >>> >> But spacing depends on the sorts of durations present -- the most >> common duration, the shortest duration. I think I have expressed myself poorly. I mean that after a first full engraving I would know the natural width of a measure (as if it were typeset ragged-right). When now something (e.g. additional notes) forces the line breaking to be changed I can take the - known - natural widths of the following measures and calculate which measures would fit into the next system. >> >> Do you mean to typeset each measure as if it's in isolation, without >> stretching based on surrounding measures? >> >> For example, >> >> \version "2.19.59" >> >> \layout { ragged-right = ##t } >> >> { >> \repeat unfold 16 { c''16 } >> \repeat unfold 4 { c''4 } >> c''1 >> c''2 c''2 >> \repeat unfold 64 { c''64 } >> } >> >> \layout { >> \context { >> \Score >> \override SpacingSpanner.common-shortest-duration = #'() >> } >> } No, I just want to know how much space a measure would need if it were ragged-right but still have the actual engraving stretched to justified lines. >> >> %% >> >> Alternately, you could create a \newSpacingSection every measure, >> though this gives different values. Don't know why. >> >> %%%%%%%%%%%%%%%%%%%%%%%% >> >> Here's how you can determine the widths of measures. Note that I've >> put everything on one line, so that the \once \override of the >> NoteHead gives access to every column in the score. You can adjust >> what alignment objects are used to gauge width by changing the symbol >> in ly:paper-column::break-align-width (available as of 2.19.59). >> Right now, it's BreakAlignment objects to give you an extent >> considering all prefatory materials. staff-bar would give extents of >> the bar lines. >> >> \version "2.19.59" >> >> \paper { >> page-breaking = #ly:one-line-breaking >> } >> >> #(define (display-measure-widths grob) >> (let* ((sys (ly:grob-system grob)) >> (cols (ly:grob-array->list (ly:grob-object sys 'columns))) >> (nmpcs >> (filter >> (lambda (elt) >> (and (grob::has-interface elt 'paper-column-interface) >> (eq? #t (ly:grob-property elt 'non-musical)))) >> cols)) >> (widths >> (map >> (lambda (c) (ly:paper-column::break-align-width c >> '(break-alignment))) >> nmpcs)) >> (widths (sort widths (lambda (x y) (< (car x) (car y))))) >> ) >> (pretty-print widths))) >> { >> >> \once \override NoteHead.after-line-breaking = #display-measure-widths >> \repeat unfold 4 { c''8. c''16} >> \repeat unfold 4 { c''4 } >> c''1 >> c''2 c''2 >> \repeat unfold 64 { c''64 } >> } >> >> \layout { >> \context { >> \Score >> \override SpacingSpanner.common-shortest-duration = #'() >> } >> } >> >> Hope this helps with something! >> I'll have to look into this tomorrow. RIght now it's too late to install another LilyPond ... > Oh, I should have mentioned that the function is showing the extents > of objects held by the columns organizing barlines, clefs, key > signatures, etc -- not measure lengths. Finding the measures will > involve an extra fun step. Looking forward to that ;-) Best Urs > > David -- [email protected] https://openlilylib.org http://lilypondblog.org _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
