1 ;;;; framework-ps.scm --
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 2004--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 (define-module (scm framework-eps))
9 ;;; this is still too big a mess.
11 (use-modules (ice-9 regex)
21 (define framework-eps-module (current-module))
23 (define (dump-stencils-as-EPSes stencils book basename)
24 (define paper (ly:paper-book-paper book))
25 (define (dump-infinite-stack-EPS stencils)
26 (let* ((dump-me (stack-stencils Y DOWN 2.0 stencils)))
27 (dump-stencil-as-EPS paper dump-me basename #t)))
29 (define (dump-stencils-as-separate-EPS stencils count)
31 (let* ((line (car stencils))
32 (rest (cdr stencils)))
36 line (format "~a-~a" basename count)
37 (ly:output-def-lookup paper 'force-eps-font-include))
39 (dump-stencils-as-separate-EPS rest (1+ count)))))
41 (let* ((tex-system-name (format "~a-systems.tex" basename))
42 (texi-system-name (format "~a-systems.texi" basename))
43 (tex-system-port (open-output-file tex-system-name))
44 (texi-system-port (open-output-file texi-system-name)))
46 (ly:message (_ "Writing ~a...") tex-system-name)
47 (ly:message (_ "Writing ~a...") texi-system-name)
48 (dump-stencils-as-separate-EPS stencils 1)
52 (display "\\ifx\\betweenLilyPondSystem \\undefined\n" tex-system-port)
53 (display " \\relax\n" tex-system-port)
54 (display "\\else\n" tex-system-port)
56 " \\betweenLilyPondSystem{~a}\n" c) tex-system-port)
57 (display "\\fi\n" tex-system-port)))
58 (display (format "\\includegraphics{~a-~a.eps}\n"
59 basename (1+ c)) tex-system-port)
60 (display (format "@image{~a-~a}\n"
61 basename (1+ c)) texi-system-port))
62 (iota (length stencils)))
63 (display "@c eof - 'eof' is a Makefile marker; don not remove. " texi-system-port)
64 (display "% eof - 'eof' is Makefile marker; do not remove. " tex-system-port)
66 (dump-infinite-stack-EPS stencils))
67 (postprocess-output book framework-eps-module
68 (format "~a.eps" basename) (ly:output-formats)))
70 (define-public (output-classic-framework basename book scopes fields)
71 (output-scopes scopes fields basename)
73 (dump-stencils-as-EPSes
74 (map ly:paper-system-stencil (ly:paper-book-systems book))
78 (define-public (output-framework basename book scopes fields)
79 (output-scopes scopes fields basename)
80 (dump-stencils-as-EPSes (ly:paper-book-pages book) book basename))
83 ; redefine to imports from framework-ps
84 (define convert-to-pdf convert-to-pdf)
85 (define convert-to-ps convert-to-ps)
86 (define convert-to-png convert-to-png)
87 (define convert-to-tex convert-to-tex)
88 (define convert-to-dvi convert-to-dvi)