Re: \fill-line while respecting natural widths
Hi all, I've posted an update to this on the issue tracker. I think the discussion should move there. https://code.google.com/p/lilypond/issues/detail?id=3860 Best, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
On 02/08/2014 11:22 PM, Kieren MacMillan wrote: Hi David, Hmm--do you think it should be added as an option to \fill-line? DEFINITELY! As just one example: I’m going to use it in the musical theatre scores I’m engraving right now, to [evenly] space two columns of dialogue above a system of underscore music. But maybe it should be its own separate function, e.g., \spaced-line, or some such thing? Agreed. What about \equispaced-line? The rationale for \fill-line IMHO is only to be used for one, two or three arguments, which is the common case in headings. One for center-aligned (which should be available as \center-line on it's own...), two for left-right-aligned, three for left-center-right-aligned. That's it. Everything else gives highly unintuitive results. It's the analogue of one of the rare features I miss in OpenOffice vs. Word: In the latter, you can specify the horizontal alignment for groups of words in a single line, separated by tabs. \fill-line might not be the best name for that, but it's late to change it. (\equicentered-line? Leftmost and rightmost element don't fit in, though...) And it's description is really bad, now that I read it again... BTW, I'd like to see collision avoidance there (and there should be a comment in the code on what's necessary), but probably it's overkill for what it's used for. On the other hand, especially for two-column-dialogues or verses, I always end up to use manually spaced columns: I want a consistent column separation, I (usually) want columns of consistent width, and I (usually) want the columns to start at the same horizontal position. At least if you have several of those places. Then, it's almost no difference whether you use \spaced-line (\equispaced-line?) or simply a \fill-line (as \center-line) of $stuff to autocalculate left and right margin. Best, Alexander ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
2014-02-08 23:22 GMT+01:00 Kieren MacMillan kieren_macmil...@sympatico.ca: Hi David, Hmm--do you think it should be added as an option to \fill-line? DEFINITELY! +1000 - this is awesome! As for now, i have added it to the snippets repo(https://github.com/openlilylib/snippets/commit/4bb8a0456c42d5859cd6945b4213901785cfbd23), but please go ahead and add it to official lily! I think it is a feature important enough to warrant a new function. As just one example: I’m going to use it in the musical theatre scores I’m engraving right now, to [evenly] space two columns of dialogue above a system of underscore music. Also, it will be perfect for aligning stanzas for songs. I have already used it in the openlilylib/snippets stanza template (which could be turned into a function, btw - didn't have time to do it myself, yet...): https://github.com/openlilylib/snippets/blob/master/templates/adjustable-centered-stanzas/definitions.ily https://github.com/openlilylib/snippets/commit/eeb8d075dff02d29f02316345774fd18c7a5c732 2014-02-09 12:53 GMT+01:00 Alexander Kobel n...@a-kobel.de: The rationale for \fill-line IMHO is only to be used for one, two or three arguments, which is the common case in headings. One for center-aligned (which should be available as \center-line on it's own...), two for left-right-aligned, three for left-center-right-aligned. That's it. Everything else gives highly unintuitive results. It's the analogue of one of the rare features I miss in OpenOffice vs. Word: In the latter, you can specify the horizontal alignment for groups of words in a single line, separated by tabs. yes, very good observation! \fill-line is needed exactly for that, and because of this we should keep it like it is (and add David's work as a new function). I won't have time to follow this topic closely, but i support David's efforts! best, Janek ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
Hi David, See the attached. (I just changed a line or two of the definition of \fill-line from scm/define-markup-commands.scm.) Hopefully this gives you what you want! --David That's interesting, see the result of the two markups: \version 2.18.0 \markup \fill-line { This line has got even spaces, or is it a bit different? } \markup \fill-line-two { And this line has different spacing, it uses word length! } Is this a bug in the original \fill-line? Greetings, Ed fill-line-variant.pdf Description: Adobe PDF document ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
On Feb 8, 2014, at 10:24 AM, Ed Gordijn ed.klari...@gmail.com wrote: Hi David, See the attached. (I just changed a line or two of the definition of \fill-line from scm/define-markup-commands.scm.) Hopefully this gives you what you want! --David That's interesting, see the result of the two markups: \version 2.18.0 \markup \fill-line { This line has got even spaces, or is it a bit different? } \markup \fill-line-two { And this line has different spacing, it uses word length! } Is this a bug in the original \fill-line? It’s a feature - \fill-line evenly distributes the centers of objects along a line irrespective of their widths. Cheers, MS ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
Hi Mike, It's a feature - \fill-line evenly distributes the centers of objects along a line irrespective of their widths. I see,so there wasn't enough room in the last column for the long word different? I created too many columns. Thanks, Ed ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
David (et al.), OOO! This is wonderful. I can already see several places where I will use this. Thanks, Kieren. On Feb 8, 2014, at 2:20 AM, Mike Solomon m...@mikesolomon.org wrote: On Feb 8, 2014, at 1:18 AM, David Nalesnik david.nales...@gmail.com wrote: Hi Mike, See the attached. (I just changed a line or two of the definition of \fill-line from scm/define-markup-commands.scm.) Hopefully this gives you what you want! --David fill-line-variant.ly Great work! Thanks for taking the time to do this. I’ve posted on-line a PDF of how I use it. By spacing top-level markups this way, we get nice columns : http://mikesolomon.org/lilypond/davidNSolution.pdf Cheers, MS ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
Hi Mike, On Sat, Feb 8, 2014 at 1:20 AM, Mike Solomon m...@mikesolomon.org wrote: On Feb 8, 2014, at 1:18 AM, David Nalesnik david.nales...@gmail.com wrote: Hi Mike, See the attached. (I just changed a line or two of the definition of \fill-line from scm/define-markup-commands.scm.) Hopefully this gives you what you want! --David fill-line-variant.ly Great work! Thanks! I’ve posted on-line a PDF of how I use it. By spacing top-level markups this way, we get nice columns : http://mikesolomon.org/lilypond/davidNSolution.pdf Very nice looking. --David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
Hi Kieren, On Sat, Feb 8, 2014 at 7:16 AM, Kieren MacMillan kieren_macmil...@sympatico.ca wrote: David (et al.), OOO! This is wonderful. I can already see several places where I will use this. Thanks, Kieren. Hmm--do you think it should be added as an option to \fill-line? (Well, it would need some going over first.) --David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
Hi David, Hmm--do you think it should be added as an option to \fill-line? DEFINITELY! As just one example: I’m going to use it in the musical theatre scores I’m engraving right now, to [evenly] space two columns of dialogue above a system of underscore music. But maybe it should be its own separate function, e.g., \spaced-line, or some such thing? Thanks, Kieren. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
\fill-line while respecting natural widths
Hey all If I have \markup \fill-line { foo br hi } The line will be filled irrespective of the widths of the elements, meaning that the middle element will always be on the center of the page. Is there a way to do this such that the space between elements is (line_length - (elt_0_length + elt_1_length + … + el_tn_length)) / (n - 1) Cheers, MS ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
Hi Mike, On Fri, Feb 7, 2014 at 1:36 PM, Mike Solomon m...@mikesolomon.org wrote: Hey all If I have \markup \fill-line { foo br hi } The line will be filled irrespective of the widths of the elements, meaning that the middle element will always be on the center of the page. Is there a way to do this such that the space between elements is (line_length - (elt_0_length + elt_1_length + … + el_tn_length)) / (n - 1) Cheers, MS It looks like you could alter get-fill-space in scm/define-markup-commands.scm to reflect your formula. Unfortunately, I'm not at a machine I can try this out at the moment. HTH, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
On Fri, Feb 7, 2014 at 2:25 PM, David Nalesnik david.nales...@gmail.comwrote: Hi Mike, On Fri, Feb 7, 2014 at 1:36 PM, Mike Solomon m...@mikesolomon.org wrote: It looks like you could alter get-fill-space in scm/define-markup-commands.scm to reflect your formula. Unfortunately, I'm not at a machine I can try this out at the moment. Oh, scrap that. Spoke too soon. But it doesn't seem like it will be that tricky. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
Hi Mike, See the attached. (I just changed a line or two of the definition of \fill-line from scm/define-markup-commands.scm.) Hopefully this gives you what you want! --David \version 2.18.0 #(define-markup-command (fill-line-two layout props args) (markup-list?) #:category align #:properties ((text-direction RIGHT) (word-space 0.6) (line-width #f)) (let* ((orig-stencils (interpret-markup-list layout props args)) (stencils (map (lambda (stc) (if (ly:stencil-empty? stc) point-stencil stc)) orig-stencils)) (text-widths (map (lambda (stc) (if (ly:stencil-empty? stc) 0.0 (interval-length (ly:stencil-extent stc X stencils)) (text-width (apply + text-widths)) (word-count (length stencils)) (line-width (or line-width (ly:output-def-lookup layout 'line-width))) (fill-space (cond ((= word-count 1) (list (/ (- line-width text-width) 2) (/ (- line-width text-width) 2))) ((= word-count 2) (list (- line-width text-width))) (else (make-list (1- word-count) (/ (- line-width text-width) (1- word-count)) (line-contents (if (= word-count 1) (list point-stencil (car stencils) point-stencil) stencils))) (if (null? (remove ly:stencil-empty? orig-stencils)) empty-stencil (begin (if (= text-direction LEFT) (set! line-contents (reverse line-contents))) (set! line-contents (stack-stencils-padding-list X RIGHT fill-space line-contents)) (if ( word-count 1) ;; shift s.t. stencils align on the left edge, even if ;; first stencil had negative X-extent (e.g. center-column) ;; (if word-count = 1, X-extents are already normalized in ;; the definition of line-contents) (set! line-contents (ly:stencil-translate-axis line-contents (- (car (ly:stencil-extent (car stencils) X))) X))) line-contents \markup \fill-line { foo br hi } %% \markup \fill-line-two { foo br hi } \markup \fill-line-two { foo br hi } \markup \fill-line-two { fooo br hi } \markup \fill-line-two { fo ba hi } \markup \fill-line-two { fooo ba hi }___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: \fill-line while respecting natural widths
On Feb 8, 2014, at 1:18 AM, David Nalesnik david.nales...@gmail.com wrote: Hi Mike, See the attached. (I just changed a line or two of the definition of \fill-line from scm/define-markup-commands.scm.) Hopefully this gives you what you want! --David fill-line-variant.ly Great work! Thanks for taking the time to do this. I’ve posted on-line a PDF of how I use it. By spacing top-level markups this way, we get nice columns : http://mikesolomon.org/lilypond/davidNSolution.pdf Cheers, MS___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user