]> git.donarmstrong.com Git - lilypond.git/blob - scm/framework-eps.scm
* configure.in (gui_b): make bison optional.
[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:message (_ "Writing ~a...") texi-system-name)
47     (dump-stencils-as-separate-EPS stencils 1)
48     (for-each (lambda (c)
49                 (if (< 0 c)
50                     (begin 
51                       (display "\\ifx\\betweenLilyPondSystem \\undefined\n" tex-system-port)
52                       (display "  \\relax\n" tex-system-port)
53                       (display "\\else\n" tex-system-port)
54                       (display (format 
55                                 "  \\betweenLilyPondSystem{~a}\n" c) tex-system-port)
56                       (display "\\fi\n" tex-system-port)))
57                 (display (format "\\includegraphics{~a-~a.eps}\n"
58                                  basename (1+ c)) tex-system-port)
59                 (display (format "@image{~a-~a}\n"
60                                  basename (1+ c)) texi-system-port))
61               (iota (length stencils)))
62     (display "@c eof - 'eof' is a Makefile marker; don not remove. " texi-system-port)
63     (display "% eof - 'eof' is Makefile marker; do not remove. " tex-system-port)
64     
65     (dump-infinite-stack-EPS stencils))
66     (postprocess-output book framework-eps-module
67                         (format "~a.eps" basename) (ly:output-formats)))
68
69 (define-public (output-classic-framework basename book scopes fields)
70   (output-scopes scopes fields basename)
71   (dump-stencils-as-EPSes
72    (map ly:paper-system-stencil (ly:paper-book-systems book))
73    book
74    basename))
75
76 (define-public (output-framework basename book scopes fields)
77   (output-scopes scopes fields basename)
78   (dump-stencils-as-EPSes (ly:paper-book-pages book) book basename))
79   
80
81 ; redefine to imports from framework-ps
82 (define convert-to-pdf convert-to-pdf)
83 (define convert-to-ps convert-to-ps)
84 (define convert-to-png convert-to-png)
85 (define convert-to-tex convert-to-tex)
86 (define convert-to-dvi convert-to-dvi)
87