summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasamichi Hosoda <trueroad@trueroad.jp>2015-05-24 22:14:53 +0900
committerMasamichi Hosoda <trueroad@trueroad.jp>2015-05-31 22:27:27 +0900
commite951c7975ad91c03e52856b954206d83fa04dcb1 (patch)
tree384e0ba9226b3c41f306198e091c1a302a0e91eb
parent42494c126671d9b70f7274ef502c9dc33e72177f (diff)
Issue 4417 / 2: Use ly:system in make-ps-images (ps-to-png.scm)
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).
-rw-r--r--scm/ps-to-png.scm63
1 files changed, 27 insertions, 36 deletions
diff --git a/scm/ps-to-png.scm b/scm/ps-to-png.scm
index 8a476f36c5..dd70eca22f 100644
--- a/scm/ps-to-png.scm
+++ b/scm/ps-to-png.scm
@@ -97,39 +97,35 @@
(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?
@@ -139,11 +135,6 @@
(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)