))
stencils))
-
(define (dump-stencils-as-EPSes stencils book basename)
(define do-pdf (member "pdf" (ly:output-formats)))
(define paper (ly:paper-book-paper book))
(let* ((dump-me (stack-stencils Y DOWN 2.0 stencils)))
(dump-stencil-as-EPS paper dump-me basename #t)))
- (define (dump-stencils-as-separate-EPS stencils count )
+ (define (dump-counted-stencil stencil-count-pair)
+ "Return EPS filename"
+ (let*
+ ((stencil (car stencil-count-pair))
+ (number (cdr stencil-count-pair))
+ (name (format "~a-~a" basename number)))
+
+ (dump-stencil-as-EPS
+ paper stencil name
+ (ly:get-option 'include-eps-fonts))
+
+ (string-append name ".eps")))
+
+ (define (dump-stencils-as-separate-EPS stencils count)
(if (pair? stencils)
(let* ((line (car stencils))
(rest (cdr stencils))
)
(dump-stencil-as-EPS
- paper line system-base-name
- (ly:get-option 'include-eps-fonts))
+ paper line system-base-name)
(if do-pdf
(postscript->pdf 0 0 (string-append system-base-name ".eps")))
(dump-stencils-as-separate-EPS rest (1+ count)))))
-
;; main body
(let* ((tex-system-name (format "~a-systems.tex" basename))
(texi-system-name (format "~a-systems.texi" basename))
(tex-system-port (open-output-file tex-system-name))
- (texi-system-port (open-output-file texi-system-name)))
+ (texi-system-port (open-output-file texi-system-name))
+ (widened-stencils (widen-left-stencil-edges stencils))
+ (counted-systems (count-list widened-stencils))
+ (eps-files (map dump-counted-stencil counted-systems))
+ )
(ly:message (_ "Writing ~a...") tex-system-name)
(ly:message (_ "Writing ~a...") texi-system-name)
- (set! stencils (widen-left-stencil-edges stencils))
-
- (dump-stencils-as-separate-EPS stencils 1)
+ (if do-pdf
+
+ ;; par-for-each: a bit faster ...
+ (for-each
+ (lambda (y)
+ (postscript->pdf 0 0 y))
+ eps-files))
+
(for-each (lambda (c)
(if (< 0 c)
(display (format "\\ifx\\betweenLilyPondSystem \\undefined
(ly:output-formats))))
(define-public (dump-stencil-as-EPS paper dump-me filename
- load-fonts
- )
+ load-fonts)
+
(let*
((xext (ly:stencil-extent dump-me X))
(yext (ly:stencil-extent dump-me Y))
"ps"))
(port (ly:outputter-port outputter))
-
-
(rounded-bbox (to-bp-box bbox))
(port (ly:outputter-port outputter))
(header (eps-header paper rounded-bbox load-fonts)))
;; list
+(define-public (count-list lst)
+ "Given lst (E1 E2 .. ) return ((E1 . 1) (E2 . 2) ... ) "
+ (define (helper l acc count)
+ (if (pair? l)
+ (helper (cdr l) (cons (cons (car l) count) acc) (1+ count))
+ acc))
+
+
+ (reverse (helper lst '() 1)))
+
(define-public (list-join lst intermediate)
"put INTERMEDIATE between all elts of LST."