X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fframework-eps.scm;h=e2215ede41b7b68913bc51bc6a41c93be9aac763;hb=f37ed92f67856110f5c0741566f84dc53cc70b4a;hp=23f5779f869981fb85b49fadb3e3ede7a6ca2391;hpb=8f536cca6460caca6b5ac7925670b5692ac40ce5;p=lilypond.git diff --git a/scm/framework-eps.scm b/scm/framework-eps.scm index 23f5779f86..e2215ede41 100644 --- a/scm/framework-eps.scm +++ b/scm/framework-eps.scm @@ -2,7 +2,7 @@ ;;;; ;;;; source file of the GNU LilyPond music typesetter ;;;; -;;;; (c) 2004--2006 Han-Wen Nienhuys +;;;; (c) 2004--2006 Han-Wen Nienhuys (define-module (scm framework-eps)) @@ -44,7 +44,6 @@ stencil, so LaTeX includegraphics doesn't fuck up the alignment." )) stencils)) - (define (dump-stencils-as-EPSes stencils book basename) (define do-pdf (member "pdf" (ly:output-formats))) (define paper (ly:paper-book-paper book)) @@ -52,7 +51,20 @@ stencil, so LaTeX includegraphics doesn't fuck up the alignment." (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)) @@ -60,29 +72,33 @@ stencil, so LaTeX includegraphics doesn't fuck up the alignment." ) (dump-stencil-as-EPS - paper line system-base-name - (ly:get-option 'eps-font-include)) + 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)) - (pdftex-system-name (format "~a-systems.pdftex" 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)) - (pdftex-system-port (open-output-file pdftex-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) - (ly:message (_ "Writing ~a...") pdftex-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 @@ -91,10 +107,8 @@ stencil, so LaTeX includegraphics doesn't fuck up the alignment." \\betweenLilyPondSystem{~a} \\fi " c) tex-system-port)) - (display (format "\\includegraphics{~a-~a.eps}\n" + (display (format "\\includegraphics{~a-~a}\n" basename (1+ c)) tex-system-port) - (display (format "\\includegraphics{~a-~a.pdf}\n" - basename (1+ c)) pdftex-system-port) (display (format "@image{~a-~a}\n" basename (1+ c)) texi-system-port)) (iota (length stencils))) @@ -102,6 +116,9 @@ stencil, so LaTeX includegraphics doesn't fuck up the alignment." (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) + (dump-infinite-stack-EPS stencils) (postprocess-output book framework-eps-module (format "~a.eps" basename) (ly:output-formats))))