]> git.donarmstrong.com Git - lilypond.git/blob - scm/framework-eps.scm
*** empty log message ***
[lilypond.git] / scm / framework-eps.scm
1 ;;;; framework-ps.scm --
2 ;;;;
3 ;;;;  source file of the GNU LilyPond music typesetter
4 ;;;;
5 ;;;; (c) 2004--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
6
7 (define-module (scm framework-eps))
8
9 ;;; this is still too big a mess.
10
11 (use-modules (ice-9 regex)
12              (ice-9 string-fun)
13              (ice-9 format)
14              (guile)
15              (scm framework-ps)
16              (scm output-ps)
17              (srfi srfi-1)
18              (srfi srfi-13)
19              (lily))
20
21 (define framework-eps-module (current-module))
22
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)))
28
29   (define (dump-stencils-as-separate-EPS stencils count)
30     (if (pair? stencils)
31         (let* ((line (car stencils))
32                (rest (cdr stencils)))
33           (dump-stencil-as-EPS
34            paper
35            line (format "~a-~a" basename count)
36            (ly:output-def-lookup paper 'force-eps-font-include))
37           
38           (dump-stencils-as-separate-EPS rest (1+ count)))))
39   
40   (let* ((tex-system-name (format "~a-systems.tex" basename))
41          (texi-system-name (format "~a-systems.texi" basename))
42          (tex-system-port (open-output-file tex-system-name))
43          (texi-system-port (open-output-file texi-system-name)))
44     
45     (ly:message (_ ("Writing ~a...") tex-system-name))
46     (ly:massage (_ ("Writing ~a...") texi-system-name))
47     (dump-stencils-as-separate-EPS stencils 1)
48     (for-each (lambda (c)
49                 (display (format "\\includegraphics{~a-~a.eps}%\n"
50                                  basename (1+ c)) tex-system-port)
51                 (display (format "@image{~a-~a}@c\n"
52                                  basename (1+ c)) texi-system-port))
53               (iota (length stencils)))
54
55     (display "@c eof - 'eof' is a Makefile marker; don not remove. " texi-system-port)
56     (display "% eof - 'eof' is Makefile marker; do not remove. " tex-system-port)
57     
58     (dump-infinite-stack-EPS stencils))
59     (postprocess-output book framework-eps-module
60                         (format "~a.eps" basename) (ly:output-formats)))
61
62 (define-public (output-classic-framework basename book scopes fields)
63   (output-scopes scopes fields basename)
64   (dump-stencils-as-EPSes
65    (map ly:paper-system-stencil (ly:paper-book-systems book))
66    book
67    basename))
68
69 (define-public (output-framework basename book scopes fields)
70   (output-scopes scopes fields basename)
71   (dump-stencils-as-EPSes (ly:paper-book-pages book) book basename))
72   
73
74 ; redefine to imports from framework-ps
75 (define convert-to-pdf convert-to-pdf)
76 (define convert-to-ps convert-to-ps)
77 (define convert-to-png convert-to-png)
78 (define convert-to-tex convert-to-tex)
79 (define convert-to-dvi convert-to-dvi)
80