;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
-;;;; (c) 2004--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+;;;; (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
(define-module (scm framework-eps))
(use-modules (ice-9 regex)
(ice-9 string-fun)
- (ice-9 format)
(guile)
(scm framework-ps)
(scm paper-system)
(srfi srfi-13)
(lily))
+(define format ergonomic-simple-format)
+
(define framework-eps-module (current-module))
stencil, so LaTeX includegraphics doesn't fuck up the alignment."
(define left
- (apply min
- (map (lambda (stc)
- (interval-start (ly:stencil-extent stc X)))
- stencils)))
+ (if (pair? stencils)
+ (apply min
+ (map (lambda (stc)
+ (interval-start (ly:stencil-extent stc X)))
+ stencils))
+ 0.0))
+
(map (lambda (stil)
(ly:make-stencil
(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))
+ (let* ((write-file (lambda (str-port ext)
+ (let*
+ ((name (format "~a-systems.~a" basename ext))
+ (port (open-output-file name)))
+ (ly:message (_ "Writing ~a...") name)
+ (display (get-output-string str-port) port)
+ (close-output-port port)
+ )))
+
+ (tex-system-port (open-output-string))
+ (texi-system-port (open-output-string))
(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)
-
(if do-pdf
;; par-for-each: a bit faster ...
basename (1+ c)) texi-system-port))
(iota (length stencils)))
- (display "@c eof - 'eof' is a Makefile marker; do not remove. " texi-system-port)
- (display "% eof - 'eof' is Makefile marker; do not remove. " tex-system-port)
-
- (close-output-port texi-system-port)
- (close-output-port tex-system-port)
+ (display "@c eof." texi-system-port)
+ (display "% eof. " tex-system-port)
(dump-infinite-stack-EPS stencils)
(postprocess-output book framework-eps-module
- (format "~a.eps" basename) (ly:output-formats))))
+ (format "~a.eps" basename) (ly:output-formats))
+
+ (write-file texi-system-port "texi")
+ (write-file tex-system-port "tex")
+ ))
(define-public (output-framework basename book scopes fields)
(output-scopes scopes fields basename)
+ (if (ly:get-option 'clip-systems)
+ (clip-system-EPSes basename book))
+
(dump-stencils-as-EPSes
(map page-stencil (ly:paper-book-pages book)) book basename))