]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/backend-library.scm
* configure.in (LINK_GXX_STATICALLY): remove kpathsea checks.
[lilypond.git] / scm / backend-library.scm
index 25b2ae9e7b3d427cd798467ba1a1af29a0779b1b..0030b15e1e5a355a13f89f23d4f0c7a50d13cf12 100644 (file)
          (throw 'ly-file-failed)))))
 
 (define-public (sanitize-command-option str)
+  "Kill dubious shell quoting"
+  
   (string-append
    "\""
-   (regexp-substitute/global #f "[^- 0-9,.a-zA-Z'\"\\]" str 'pre 'post)
+   (regexp-substitute/global #f "[^-_ 0-9,.a-zA-Z'\"\\]" str 'pre 'post)
    "\""))
 
 (define-public (search-executable names)
     (ly:message (_ "Converting to `~a'...") pdf-name)
     (ly:progress "\n")
     (ly:system cmd)
-    
-    (if (ly:get-option 'delete-intermediate-files)
-       (delete-file name))))
+    ))
 
 (use-modules (scm ps-to-png))
+
 (define-public (postscript->png resolution paper-size-name name)
     ;; Do not try to guess the name of the png file,
     ;; GS produces PNG files like BASE-page%d.png.
     ;;     (string-append (basename name ".ps") "-page1.png" )))
   (let ((paper-size (sanitize-command-option paper-size-name))
        (verbose (ly:get-option 'verbose))
-       (rename-page-1 #t))
+       (rename-page-1 #f))
+
     (ly:message (_ "Converting to ~a...") "PNG")
-    (make-ps-images name resolution paper-size rename-page-1 verbose)
+    (make-ps-images name resolution paper-size rename-page-1 verbose
+                   (ly:get-option 'anti-alias-factor))
     (ly:progress "\n")))
 
 (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))
+  (let*
+      ((completed (completize-formats formats))
+       (base (string-regexp-substitute "\\.[a-z]+$" "" filename))
+       (intermediate (remove
+                     (lambda (x)
+                       (member x formats)) 
+                     completed)))
+    (for-each
+     (lambda (f)
+       ((eval (string->symbol (string-append "convert-to-" f)) module)
+       paper-book filename))
+     completed)
+
+    (if (ly:get-option 'delete-intermediate-files)
+       (for-each
+        (lambda (f)
+          (delete-file (string-append base "." f)))
+        intermediate))
+    ))
 
 (define-public (completize-formats formats)
   (define new-fmts '())