CVSROOT: /cvsroot/lilypond Module name: lilypond Branch: Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/06/07 11:29:30
Modified files: . : ChangeLog VERSION scm : define-markup-commands.scm Log message: (fill-line): handle text-widths = '() case. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3732&tr2=1.3733&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/VERSION.diff?tr1=1.638&tr2=1.639&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-markup-commands.scm.diff?tr1=1.92&tr2=1.93&r1=text&r2=text Patches: Index: lilypond/ChangeLog diff -u lilypond/ChangeLog:1.3732 lilypond/ChangeLog:1.3733 --- lilypond/ChangeLog:1.3732 Tue Jun 7 10:39:56 2005 +++ lilypond/ChangeLog Tue Jun 7 11:29:30 2005 @@ -1,3 +1,8 @@ +2005-06-07 Han-Wen Nienhuys <[EMAIL PROTECTED]> + + * scm/define-markup-commands.scm (fill-line): handle text-widths = + '() case. + 2005-06-07 Jan Nieuwenhuizen <[EMAIL PROTECTED]> * scm/ps-to-png.scm (make-ps-images): Bugfix: `Pages: 1\n' is not Index: lilypond/VERSION diff -u lilypond/VERSION:1.638 lilypond/VERSION:1.639 --- lilypond/VERSION:1.638 Sat Jun 4 11:49:24 2005 +++ lilypond/VERSION Tue Jun 7 11:29:30 2005 @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=5 -PATCH_LEVEL=28 +PATCH_LEVEL=29 MY_PATCH_LEVEL= Index: lilypond/scm/define-markup-commands.scm diff -u lilypond/scm/define-markup-commands.scm:1.92 lilypond/scm/define-markup-commands.scm:1.93 --- lilypond/scm/define-markup-commands.scm:1.92 Wed Jun 1 14:26:13 2005 +++ lilypond/scm/define-markup-commands.scm Tue Jun 7 11:29:30 2005 @@ -194,6 +194,37 @@ The markups are spaced/flushed to fill the entire line. If there are no arguments, return an empty stencil. " + + + (define (get-fill-space word-count line-width 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. +" + (cond + ((null? text-widths) '()) + + ;; special case first padding + ((= (length text-widths) word-count) + (cons + (- (- (/ line-width (1- word-count)) (car text-widths)) + (/ (car (cdr text-widths)) 2)) + (get-fill-space word-count line-width (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* ((orig-stencils (map (lambda (x) (interpret-markup layout props x)) markups)) @@ -241,32 +272,6 @@ empty-stencil (stack-stencils-padding-list X RIGHT fill-space-normal line-stencils)))) -(define (get-fill-space word-count line-width 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. -" - (cond - ;; special case first padding - ((= (length text-widths) word-count) - (cons - (- (- (/ line-width (1- word-count)) (car text-widths)) - (/ (car (cdr text-widths)) 2)) - (get-fill-space word-count line-width (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)))))) - (define (font-markup qualifier value) (lambda (layout props arg) (interpret-markup layout (prepend-alist-chain qualifier value props) arg))) _______________________________________________ Lilypond-cvs mailing list Lilypond-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-cvs