]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/framework-ps.scm (output-classic-framework): dump a
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 28 Jan 2005 20:43:18 +0000 (20:43 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 28 Jan 2005 20:43:18 +0000 (20:43 +0000)
-systems.texi too
(output-classic-framework): dump multiple systems on an "infinite"
page EPS including fonts.

* scripts/lilypond-book.py (Lilypond_snippet.ly_is_outdated): use
.eps files for both texi and tex formats. Use PNG coming from
lilypond.

ChangeLog
make/lilypond-vars.make
scm/framework-ps.scm
scm/lily.scm
scripts/lilypond-book.py
stepmake/stepmake/metafont-rules.make

index 947f2450577504dedac7f00221796ec5c0476ccc..14484e052d7b0fe21c916fbf82ce9e77b79f9b83 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-01-28  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/framework-ps.scm (output-classic-framework): dump a
+       -systems.texi too
+       (output-classic-framework): dump multiple systems on an "infinite"
+       page EPS including fonts. 
+
+       * scripts/lilypond-book.py (Lilypond_snippet.ly_is_outdated): use
+       .eps files for both texi and tex formats. Use PNG coming from
+       lilypond.
+       
 2005-01-28  Graham Percival  <gperlist@shaw.ca>
 
        * Docuemntation/user/invoking.itely: fix info about -o=FILE.
index 521017bd54ef5810a8fa8d296ff79aa7045fc175..c72c0cec4281e5303eb07a50f6218cb3bb83cd72 100644 (file)
@@ -38,7 +38,7 @@ CONVERT_LY = $(script-dir)/convert-ly.py
 LILYPOND = $(builddir)/lily/$(outconfbase)/lilypond
 LILYPOND_BOOK = $(script-dir)/lilypond-book.py
 LILYPOND_BOOK_INCLUDES = -I $(pwd) -I $(outdir) -I$(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/test/ -I $(input-dir)/tutorial/ -I $(builddir)/mf/$(outconfbase)/  -I $(builddir)/mf/out/
-LILYPOND_BOOK_FLAGS = --process="lilypond --backend ps  --formats=ps --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"
+LILYPOND_BOOK_FLAGS = --process="lilypond --backend ps  --formats=ps,png --header=texidoc -I $(srcdir)/input/test -e '(ly:set-option (quote internal-type-checking) \#t)'"
 
 #texi-html for www only:
 LILYPOND_BOOK_FORMAT=$(if $(subst out-www,,$(notdir $(outdir))),texi,texi-html)
index 7063fa5d530becf9f9781e307c69dabefe56e8f3..443d3aeeaffd0d4358a79c3b18d79d982515e760 100644 (file)
             (if (or (nan? x) (inf? x))
                 0.0 x))
           (list (car xext) (car yext)
-                (cdr xext) (cdr yext)))               ))
+                (cdr xext) (cdr yext))))
+        (rounded-bbox
+         (map
+          (lambda (x)
+            (inexact->exact
+             (round (* x scale mm-to-bigpoint))))))
+         )
 
     (for-each
      (lambda (x)
        (ly:outputter-dump-string outputter x))
      (cons
-      (eps-header paper
-                 (map
-                  (lambda (x)
-                    (inexact->exact
-                     (round (* x scale mm-to-bigpoint))))
-                  bbox)
-                 #t)
+      (eps-header paper rounded-bbox #t)
       (preamble paper #t)))
 
 
                 0.0 x))
           (list (car xext) (car yext)
                 (cdr xext) (cdr yext))))
-        (header (eps-header paper
-                            (map
-                             (lambda (x)
-                               (inexact->exact
-                                (round (* x scale mm-to-bigpoint))))
-                             bbox) #f)))
+        (rounded-bbox
+         (map
+          (lambda (x)
+            (inexact->exact
+             (round (* x scale mm-to-bigpoint)))) bbox))
+         
+        (header (eps-header paper rounded-bbox #f)))
 
       (for-each
        (lambda (str) (ly:outputter-dump-string outputter str))
       (ly:outputter-dump-string outputter "} stop-system\n%%Trailer\n%%EOF\n")
       (ly:outputter-close outputter)))
 
+  (define (dump-infinite-page lines)
+    (let*
+       ((outputter  (ly:make-paper-outputter (format "~a.eps" basename)
+                                             (ly:output-backend)))
+        (stencils (map ly:paper-system-stencil lines))
+        (dump-me (stack-stencils Y DOWN 2.0 stencils))
+        (xext (ly:stencil-extent dump-me X))
+        (yext (ly:stencil-extent dump-me Y))
+        (scale  (ly:output-def-lookup paper 'outputscale))
+        (bbox
+         (map
+          (lambda (x)
+            (if (or (nan? x) (inf? x))
+                0.0 x))
+          (list (car xext) (car yext)
+                (cdr xext) (cdr yext))))
+        (ps-bbox (map (lambda (x)
+                                 (inexact->exact
+                                  (round (* x scale mm-to-bigpoint))))
+                               bbox))
+        
+        (header (eps-header paper ps-bbox #t)))
+
+      (for-each
+       (lambda (str) (ly:outputter-dump-string outputter str))
+       (cons
+       header
+       (preamble paper #t)))
+
+      (ly:outputter-dump-string outputter
+                               (string-append "start-system { "
+                                              "set-ps-scale-to-lily-scale "
+                                              "\n"))
+
+      (ly:outputter-dump-stencil outputter dump-me)
+      (ly:outputter-dump-string outputter "} stop-system\n%%Trailer\n%%EOF\n")
+      (ly:outputter-close outputter)))
+
   (define (dump-lines lines count)
     (if (pair? lines)
        (let*
 
   (let* ((lines (ly:paper-book-systems book))
         (tex-system-port (open-output-file (format "~a-systems.tex" basename)))
-g       (last-line (car (last-pair lines))))
+        (texi-system-port (open-output-file (format "~a-systems.texi" basename)))
+        (last-line (car (last-pair lines)))
+        (pages (ly:paper-book-pages book))
+        )
 
     (dump-lines lines 1)
     (for-each (lambda (c)
-               (display (format "\\lilypondEpsGraphics{~a-~a.eps}%\n"
-                                basename (1+ c)) tex-system-port))
-             (iota (length lines))
-             )))
+               (display (format "\\includegraphics{~a-~a.eps}%\n"
+                                basename (1+ c)) tex-system-port)
+               (display (format "@image{~a-~a}%\n"
+                                basename (1+ c)) texi-system-port)
+
+               )
+             (iota (length lines)))
+
+    (display "@c eof" texi-system-port)
+    (display "% eof" tex-system-port)
+
+    (dump-infinite-page lines))
+
+    (postprocess-output book framework-ps-module (format "~a.eps" basename) (ly:output-formats))
+  )
+
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
index a9d5d15c39449147860dfacad743fea8bf2828c0..265e506978285c233bbecb143a902a4133e92fe3 100644 (file)
@@ -323,23 +323,32 @@ predicates. Print a message at LOCATION if any predicate failed."
                  "--verbose "
                  " ")
              name)))
+
     (ly:system cmd)))
 
 (define-public (postprocess-output paper-book module filename formats)
-  (for-each (lambda (f)
-             ((eval (string->symbol (string-append "convert-to-" f))
-                    module)
-              paper-book filename))
-             
-           formats))
+  (for-each
+   (lambda (f)
+     ((eval (string->symbol (string-append "convert-to-" f))
+           module)
+      paper-book filename))
+   
+   formats))
 
 (define-public (completize-formats formats)
+  (define new-fmts '())
+
   (if (member "png" formats)
       (set! formats (cons "ps" formats)))
   (if (member "pdf" formats)
       (set! formats (cons "ps" formats)))
 
-  (uniq-list formats))
+  (for-each
+   (lambda (x)
+     (if (member x formats) (set! new-fmts (cons x new-fmts))))
+   '("tex" "dvi" "ps" "pdf" "png"))
+
+  new-fmts)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
index 2edce7156b5b026cbb56541a0d4ce6c50603373c..5aec278f0eba5a8c6a6af8c0c6ea1ed27c3b475c 100644 (file)
@@ -454,7 +454,7 @@ output = {
   \preLilyPondExample
 \fi
 \def\lilypondbook{}%%
-\input %(base)s.tex
+\input %(base)s-systems.tex
 \ifx\postLilyPondExample \undefined
   \relax
 \else
@@ -487,7 +487,13 @@ output = {
 @lilypond''',
 
                OUTPUT: r'''@noindent
-@image{%(base)s,,,[image of music],%(ext)s}''',
+@iftex
+@include %(base)s-systems.texi
+@end iftex
+@ifnottex
+@image{%(base)s,,,[image of music],%(ext)s}
+@end ifnottex
+''',
 
                PRINTFILENAME: '''@file{%(filename)s}
        ''',
@@ -734,33 +740,6 @@ def compose_ly (code, options, type):
 
        return (PREAMBLE_LY + body) % vars ()
 
-# BARF
-# Use lilypond for latex (.lytex) books,
-# and lilypond --preview for html, texinfo books?
-def to_eps (file):
-       cmd = r'latex "\nonstopmode \input %s"' % file
-       # Ugh.  (La)TeX writes progress and error messages on stdout.
-       # Redirect to stderr.
-       cmd = '(( %s >&2 ) >&- )' % cmd
-       ly.system (cmd)
-       ly.system (
-         'dvips -Ppdf -u+ec-mftrace.map -u+lilypond.map -E -o %s.eps %s' \
-           % (file, file))
-
-       # Check if it really is EPS.
-       # Otherwise music glyphs disappear from 2nd and following pages.
-
-       # TODO: Should run dvips -pp -E per page, then we get proper
-       #       cropping as well.
-
-       f = open ('%s.eps' % file)
-       for x in range (0, 10):
-               if re.search ('^%%Pages: ', f.readline ()):
-                       # Make non-EPS.
-                       ly.system (
-                         'dvips -Ppdf -u+ec-mftrace.map -u+lilypond.map -o %s.eps %s' \
-                           % (file, file))
-                       break
 
 def find_file (name):
        for i in include_path:
@@ -871,12 +850,13 @@ class Lilypond_snippet (Snippet):
                base = self.basename ()
 
                tex_file = '%s.tex' % base
+               eps_file = '%s.eps' % base
+               system_file = '%s-systems.tex' % base
                ly_file = '%s.ly' % base
                ok = os.path.exists (ly_file) \
-                    and os.path.exists (tex_file)\
-                    and os.stat (tex_file)[stat.ST_SIZE] \
-                    and open (tex_file).readlines ()[-1][1:-1] \
-                      == 'lilypondend'
+                    and os.path.exists (system_file)\
+                    and os.stat (system_file)[stat.ST_SIZE] \
+                    and re.match ('% eof', open (system_file).readlines ()[-1])
 
                if ok and (use_hash_p \
                           or self.ly () == open (ly_file).read ()):
@@ -1000,9 +980,10 @@ class Lilypond_snippet (Snippet):
                        if not QUOTE in self.options:
                                str = output[TEXINFO][NOQUOTE] % vars()
 
-               str += ('@ifinfo\n' + self.output_info () + '\n@end ifinfo\n')
-               str += ('@tex\n' + self.output_latex () + '\n@end tex\n')
-               str += ('@html\n' + self.output_html () + '\n@end html\n')
+               str += self.output_info ()
+#              str += ('@ifinfo\n' + self.output_info () + '\n@end ifinfo\n')
+#              str += ('@tex\n' + self.output_latex () + '\n@end tex\n')
+#              str += ('@html\n' + self.output_html () + '\n@end html\n')
 
                if QUOTE in self.options:
                        str = output[TEXINFO][QUOTE] % vars ()
@@ -1162,17 +1143,6 @@ def process_snippets (cmd, ly_snippets, texstr_snippets, png_snippets):
        if ly_names:
                my_system (string.join ([cmd] + ly_names))
 
-       if format == HTML or format == TEXINFO:
-               for i in png_names:
-                       if not os.path.exists (i + '.eps') \
-                          and os.path.exists (i + '.tex'):
-                               to_eps (i)
-                               ly.make_ps_images (i + '.eps',
-                                                  resolution = 110)
-
-#                      elif os.path.exists (i + '.ps'):
-#                              ly.make_ps_images (i + '.ps', resolution = 110)
-
 LATEX_DOCUMENT = r'''
 %(preamble)s
 \begin{document}
@@ -1443,8 +1413,12 @@ def do_options ():
 def main ():
        files = do_options ()
        global process_cmd
+
+       formats = "ps"
+       if format == TEXINFO:
+               formats += ",png" 
        if process_cmd == '':
-               process_cmd = lilypond_binary
+               process_cmd = lilypond_binary + ' --formats=%s  --backend ps ' % formats
 
        if process_cmd:
                process_cmd += string.join ([(' -I %s' % p)
index 30ecf440c8aa7b55bc5da48ad8579a4df003961a..e62a94dd899eb7b4f83816e7ece65fcbf282e6f1 100644 (file)
@@ -30,7 +30,7 @@ $(outdir)/%.$(XPM_RESOLUTION)pk: $(outdir)/%.$(XPM_RESOLUTION)gf
 
 
 $(outdir)/%.pfb $(outdir)/%.svg $(outdir)/%.pfa: %.mf
-       $(MFTRACE) $(MFTRACE_FLAGS) -I $(outdir)/ --formats=pfa,pfb,svg --simplify $(basename $(@F))
+       $(MFTRACE) $(MFTRACE_FLAGS) -I $(outdir)/ --formats=pfa,pfb,svg $(basename $(@F))
        mv $(basename $(@F)).{pfa,pfb,svg} $(outdir)
 
 #%.afm: