bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fw: LSR item?id=700


From: Phil Holmes
Subject: Fw: LSR item?id=700
Date: Thu, 6 Jan 2011 15:08:24 -0000

Bug?

--
Phil Holmes


----- Original Message ----- 
From: MING TSANG 
To: address@hidden 
Sent: Thursday, January 06, 2011 1:45 PM
Subject: Re: LSR item?id=700


Addition info

I uninstall v2.13.45 and install 2.12.3-1. Then I run the LSR item?id=700 
again. It compiles fine and produce print out as described on the LSR 700

question:  Is there a syntax change for "interval-translate span-point" ?






--------------------------------------------------------------------------------
From: MING TSANG <address@hidden>
To: address@hidden
Sent: Wed, January 5, 2011 11:01:50 PM
Subject: LSR item?id=700


I run the following LSR and I got the error message.

This is a console shell for running LilyPond and related commands. Enter %help 
to see the available special commands.
> %lilypond %args "C:\Documents and 
> Settings\Administrator\Desktop\LILY_POND\snippet_test-colou-staff line.ly"
正在處理 ‘C:/Documents and 
Settings/Administrator/Desktop/LILY_POND/snippet_test-colou-staff line.ly’
分析中...
Interpreting music... 
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...C:/Documents and 
Settings/Administrator/Desktop/LILY_POND/snippet_test-colou-staff 
line.ly:52:12: In expression (interval-translate span-points (- #)):
C:/Documents and 
Settings/Administrator/Desktop/LILY_POND/snippet_test-colou-staff 
line.ly:52:12: Unbound variable: interval-translate
Processing time: 4 seconds 


The following is LSR item?id=700
\version "2.13.45"
%\include "english.ly"
date = #(strftime "%d-%m-%Y" (localtime (current-time)))

%LSR This snippet was contributed by Neil Puttock

#(define-public ((color-staff-lines . rest) grob)

   (define (index-cell cell dir)
     (if (equal? dir RIGHT)
         (cdr cell)
         (car cell)))

   (define (index-set-cell! x dir val)
     (case dir
       ((-1) (set-car! x val))
       ((1) (set-cdr! x val))))

   (let* ((common (ly:grob-system grob))
          (span-points '(0 . 0))
          (thickness (* (ly:grob-property grob 'thickness 1.0)
                        (ly:output-def-lookup (ly:grob-layout grob) 
'line-thickness)))
          (width (ly:grob-property grob 'width))
          (line-positions (ly:grob-property grob 'line-positions))
          (staff-space (ly:grob-property grob 'staff-space 1))
          (line-stencil #f)
          (total-lines empty-stencil)
          ;; use a local copy of colors list, since
          ;; stencil creation mutates list
          (colors rest))

     (for-each
      (lambda (dir)
        (if (and (= dir RIGHT)
                 (number? width))
            (set-cdr! span-points width)
            (let* ((bound (ly:spanner-bound grob dir))
                   (bound-ext (ly:grob-extent bound bound X)))
              
              (index-set-cell! span-points dir
                               (ly:grob-relative-coordinate bound common X))
              (if (and (not (ly:item-break-dir bound))
                       (not (interval-empty? bound-ext)))
                  (index-set-cell! span-points dir 
                                   (+ (index-cell span-points dir)
                                      (index-cell bound-ext dir))))))
        (index-set-cell! span-points dir (- (index-cell span-points dir)
                                            (* dir thickness 0.5))))
      (list LEFT RIGHT))

     (set! span-points
           (interval-translate span-points
                            (- (ly:grob-relative-coordinate grob common X))))
     (set! line-stencil
           (make-line-stencil thickness (car span-points) 0 (cdr span-points) 
0))

     (if (pair? line-positions)
         (for-each (lambda (position)
                     (let ((color (if (pair? colors)
                                      (car colors)
                                      #f)))
                       (set! total-lines
                             (ly:stencil-add
                              total-lines
                              (ly:stencil-translate-axis
                               (if (color? color)
                                   (ly:stencil-in-color line-stencil
                                                        (first color)
                                                        (second color)
                                                        (third color))
                                   line-stencil)
                               (* position staff-space 0.5) Y)))
                       (and (pair? colors)
                            (set! colors (cdr colors)))))
                   line-positions)       
         (let* ((line-count (ly:grob-property grob 'line-count 5))
                (height (* (1- line-count) (/ staff-space 2))))
           (do ((i 0 (1+ i)))                      
               ((= i line-count))
             (let ((color (if (and (pair? colors)
                                   (> (length colors) i))
                              (list-ref colors i)
                              #f)))
               (set! total-lines (ly:stencil-add
                                  total-lines
                                  (ly:stencil-translate-axis
                                   (if (color? color)
                                       (ly:stencil-in-color line-stencil
                                                            (first color)
                                                            (second color)
                                                            (third color))
                                       line-stencil)
                                   (- height (* i staff-space)) Y)))))))
     total-lines))

\relative c' {
  % color all lines in a standard five-line staff
  \override Staff.StaffSymbol #'stencil = #(color-staff-lines red green yellow 
blue cyan)
  c1 \stopStaff
  \revert Staff.StaffSymbol #'stencil

  \startStaff
  % color the fifth, third and second lines only
  \override Staff.StaffSymbol #'stencil = #(color-staff-lines (rgb-color 0 0.3 
0.8) #f grey (x11-color 'LightGreen))
  c1 \stopStaff
  \revert Staff.StaffSymbol #'stencil

  \startStaff
  % color an individual line in a custom staff
  \override Staff.StaffSymbol #'line-positions = #'(-4 0 4)
  \override Staff.StaffSymbol #'stencil = #(color-staff-lines #f red)
  c1 
}





--------------------------------------------------------------------------------


_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user


reply via email to

[Prev in Thread] Current Thread [Next in Thread]