]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4417 / 2: Use ly:system in make-ps-images (ps-to-png.scm)
authorMasamichi Hosoda <trueroad@trueroad.jp>
Sun, 24 May 2015 13:14:53 +0000 (22:14 +0900)
committerMasamichi Hosoda <trueroad@trueroad.jp>
Sun, 31 May 2015 13:27:27 +0000 (22:27 +0900)
In make-ps-images,
use ly:system instead of my-system for invoking gs.
It is the same way as postscript->pdf
(backend-library.scm).

scm/ps-to-png.scm

index 8a476f36c5be350dc040ec053045a1bbf19df17b..dd70eca22f647d2df0bf0b2a9a54c5e1e10e6d72 100644 (file)
           (multi-page? (> page-count 1))
           (output-file (if multi-page? pngn png1))
 
-          (gs-variable-options
-           (if is-eps
-               "-dEPSCrop"
-               (format #f "-dDEVICEWIDTHPOINTS=~,2f -dDEVICEHEIGHTPOINTS=~,2f"
-                       page-width page-height)))
-          (cmd (ly:format "~a\
- ~a\
- ~a\
- -dGraphicsAlphaBits=4\
- -dTextAlphaBits=4\
- -dNOPAUSE\
- -sDEVICE=~a\
- -sOutputFile=~S\
- -r~a\
- ~S\
- -c quit"
-                          (search-gs)
-                          (if be-verbose "" "-q")
-                          gs-variable-options
-                          pixmap-format
-                          output-file
-                          (* anti-alias-factor resolution) tmp-name))
-          (status 0)
+          (*unspecified* (if #f #f))
+          (cmd
+           (remove (lambda (x) (eq? x *unspecified*))
+                   (list
+                    (search-gs)
+                    (if (ly:get-option 'verbose) *unspecified* "-q")
+                    (if (or (ly:get-option 'gs-load-fonts)
+                            (ly:get-option 'gs-load-lily-fonts)
+                            (eq? PLATFORM 'windows))
+                        "-dNOSAFER"
+                        "-dSAFER")
+
+                    (if is-eps
+                        "-dEPSCrop"
+                        (ly:format "-dDEVICEWIDTHPOINTS=~$" page-width))
+                    (if is-eps
+                        *unspecified*
+                        (ly:format "-dDEVICEHEIGHTPOINTS=~$" page-height))
+                    "-dGraphicsAlphaBits=4"
+                    "-dTextAlphaBits=4"
+                    "-dNOPAUSE"
+                    "-dBATCH"
+                    (ly:format "-sDEVICE=~a" pixmap-format)
+                    (string-append "-sOutputFile=" output-file)
+                    (ly:format "-r~a" (* anti-alias-factor resolution))
+                    (string-append "-f" tmp-name))))
           (files '()))
 
-     ;; The wrapper on windows cannot handle `=' signs,
-     ;; gs has a workaround with #.
-     (if (eq? PLATFORM 'windows)
-         (begin
-           (set! cmd (re-sub "=" "#" cmd))
-           (set! cmd (re-sub "-dSAFER " "" cmd))))
-
-     (set! status (my-system be-verbose #f cmd))
+     (ly:system cmd)
 
      (set! files
            (if multi-page?
                 (iota page-count))
                (list (format #f "~a.png" base-name))))
 
-     (if (not (= 0 status))
-         (begin
-           (for-each delete-file files)
-           (exit 1)))
-
      (if (and rename-page-1 multi-page?)
          (begin
            (rename-file (re-sub "%d" "1" pngn) png1)