From: Graham Percival Date: Tue, 24 Aug 2010 13:42:59 +0000 (+0100) Subject: Merge commit 'origin' into release/unstable X-Git-Tag: release/2.13.31-1~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7e222406df49d159a021ee88610589e7f73086d1;hp=9502ddd357cc67746757dbd26a1538e70d194bda;p=lilypond.git Merge commit 'origin' into release/unstable --- diff --git a/Documentation/changes.tely b/Documentation/changes.tely index 76ba8b56d1..7941e85c27 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -66,6 +66,14 @@ which scares away people. @end ignore +@item +New option @code{-dinclude-settings=INCLUDEFILE.ly}, which causes lilypond +to include the given file before the score is processed. This allows the +user to change global settings without the need to change the score itself. +That way, several different editions/version (e.g. different page sizes) +can be generated from a file without having to modify the score for each +version. + @item The autobeaming settings syntax has been changed. beatLength, beatGrouping, beamSettings, and measureGrouping have all been eliminated. diff --git a/Documentation/notation/vocal.itely b/Documentation/notation/vocal.itely index 3dc1dcedfb..0b2e0b075d 100644 --- a/Documentation/notation/vocal.itely +++ b/Documentation/notation/vocal.itely @@ -1623,12 +1623,15 @@ Notation reference: @node Setting a chant @unnumberedsubsubsec Setting a chant +Some approaches to setting a chant are shown in the following +snippets. + +@snippets @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle] {chant-or-psalms-notation.ly} -@c TODO add this snippet when available -@c @l ilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle] -@c {Ancient notation template -- modern transcription of gregorian music.ly} +@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle] +{ancient-notation-template----modern-transcription-of-gregorian-music.ly} @node Pointing a psalm diff --git a/input/regression/center-title.ly b/input/regression/center-title.ly new file mode 100644 index 0000000000..e67c5d65bf --- /dev/null +++ b/input/regression/center-title.ly @@ -0,0 +1,17 @@ +\version "2.13.31" + +\header { + + texidoc = " +Long titles should be properly centered. + +" + + title = \markup \center-column { + "How Razorback Jumping Frogs Level Six Piqued Gymnasts" + } +} + +\score { + s1 +} diff --git a/input/regression/nested-fill-lines.ly b/input/regression/nested-fill-lines.ly new file mode 100644 index 0000000000..592732641c --- /dev/null +++ b/input/regression/nested-fill-lines.ly @@ -0,0 +1,16 @@ +\version "2.13.31" + +\header +{ + + texidoc = " +Nested fill-lines should work properly. In this example, both occurences +of FOO should be centered. + +" + title = \markup \column { + \fill-line { "|FOO|" } + \fill-line { \fill-line { "|FOO|" } } + } +} +\score {c''} diff --git a/ly/init.ly b/ly/init.ly index 20416624c2..fa1dbe5993 100644 --- a/ly/init.ly +++ b/ly/init.ly @@ -22,6 +22,11 @@ #(define book-filename #f) #(define book-output-suffix #f) #(use-modules (scm clip-region)) + +#(if (ly:get-option 'include-settings) + (ly:parser-include-string parser + (format "\\include \"~a\"" (ly:get-option 'include-settings)))) + \maininput %% there is a problem at the end of the input file diff --git a/python/book_snippets.py b/python/book_snippets.py index 443ad3c363..a19a5796d7 100644 --- a/python/book_snippets.py +++ b/python/book_snippets.py @@ -6,7 +6,11 @@ global _;_=ly._ import re import os import copy -from subprocess import Popen, PIPE +# TODO: We are using os.popen3, which has been deprecated since python 2.6. The +# suggested replacement is the Popen function of the subprocess module. +# Unfortunately, on windows this needs the msvcrt module, which doesn't seem +# to be available in GUB?!?!?! +# from subprocess import Popen, PIPE progress = ly.progress warning = ly.warning @@ -717,10 +721,10 @@ printing diff against existing file." % filename) if self.global_options.verbose: progress (_ ("Opening filter `%s'\n") % cmd) - #(stdin, stdout, stderr) = os.popen3 (cmd) - - p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) - (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr) + # TODO: Use Popen once we resolve the problem with msvcrt in Windows: + (stdin, stdout, stderr) = os.popen3 (cmd) + # p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) + # (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr) stdin.write (input) status = stdin.close () diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index d863d16200..5dc3f420e7 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -885,14 +885,16 @@ Like simple-markup, but use tie characters for @q{~} tilde symbols. (make-simple-markup "")) ;; helper for justifying lines. -(define (get-fill-space word-count line-width text-widths) +(define (get-fill-space word-count line-width word-space text-widths) "Calculate the necessary paddings between each two adjacent texts. - The lengths of all texts are stored in @var{text-widths}. - The normal formula for the padding between texts a and b is: - padding = line-width/(word-count - 1) - (length(a) + length(b))/2 - The first and last padding have to be calculated specially using the - whole length of the first or last text. - Return a list of paddings." + The lengths of all texts are stored in @var{text-widths}. + The normal formula for the padding between texts a and b is: + padding = line-width/(word-count - 1) - (length(a) + length(b))/2 + The first and last padding have to be calculated specially using the + whole length of the first or last text. + All paddings are checked to be at least word-space, to ensure that + no texts collide. + Return a list of paddings." (cond ((null? text-widths) '()) @@ -901,23 +903,27 @@ Like simple-markup, but use tie characters for @q{~} tilde symbols. (cons (- (- (/ line-width (1- word-count)) (car text-widths)) (/ (car (cdr text-widths)) 2)) - (get-fill-space word-count line-width (cdr text-widths)))) + (get-fill-space word-count line-width word-space (cdr text-widths)))) ;; special case last padding ((= (length text-widths) 2) (list (- (/ line-width (1- word-count)) (+ (/ (car text-widths) 2) (car (cdr text-widths)))) 0)) (else - (cons - (- (/ line-width (1- word-count)) - (/ (+ (car text-widths) (car (cdr text-widths))) 2)) - (get-fill-space word-count line-width (cdr text-widths)))))) + (let ((default-padding + (- (/ line-width (1- word-count)) + (/ (+ (car text-widths) (car (cdr text-widths))) 2)))) + (cons + (if (> word-space default-padding) + word-space + default-padding) + (get-fill-space word-count line-width word-space (cdr text-widths))))))) (define-markup-command (fill-line layout props args) (markup-list?) #:category align #:properties ((text-direction RIGHT) - (word-space 1) - (line-width #f)) + (word-space 0.6) + (line-width #f)) "Put @var{markups} in a horizontal line of width @var{line-width}. The markups are spaced or flushed to fill the entire line. If there are no arguments, return an empty stencil. @@ -940,55 +946,58 @@ If there are no arguments, return an empty stencil. } @end lilypond" (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 - (get-fill-space word-count line-width text-widths)))) - (fill-space-normal - (map (lambda (x) - (if (< x word-space) - word-space - x)) - fill-space)) - - (line-stencils (if (= word-count 1) - (list - point-stencil - (car stencils) - point-stencil) - stencils))) - - (if (= text-direction LEFT) - (set! line-stencils (reverse line-stencils))) + (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 + (get-fill-space word-count line-width word-space text-widths)))) + + (line-contents (if (= word-count 1) + (list + point-stencil + (car stencils) + point-stencil) + stencils))) (if (null? (remove ly:stencil-empty? orig-stencils)) - empty-stencil - (ly:stencil-translate-axis - (stack-stencils-padding-list X - RIGHT fill-space-normal line-stencils) - (- (car (ly:stencil-extent (car stencils) X))) - X)))) + 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)))) (define-markup-command (line layout props args) (markup-list?) diff --git a/scm/lily.scm b/scm/lily.scm index 515ff2e02c..4a00ab66e4 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -104,6 +104,8 @@ a log file.") "Include book titles in preview images.") (include-eps-fonts #t "Include fonts in separate-system EPS files.") + (include-settings #f +"Include file for global settings, included before the score is processed.") (job-count #f "Process in parallel, using the given number of jobs.")