- (paper-size-string (if is-eps
- "-dEPSCrop"
- (ly:format "-dDEVICEWIDTHPOINTS=~$\
- -dDEVICEHEIGHTPOINTS=~$"
- paper-width paper-height)))
-
- (cmd (ly:format
- "~a\
- ~a\
- ~a\
- ~a\
- -dCompatibilityLevel=1.4\
- -dNOPAUSE\
- -dBATCH\
- -r1200\
- -sDEVICE=pdfwrite\
- -sOutputFile=~S\
- -c .setpdfwrite\
- -f ~S\
-"
- (search-gs)
- (if (ly:get-option 'verbose) "" "-q")
- (if (or (ly:get-option 'gs-load-fonts)
- (ly:get-option 'gs-load-lily-fonts))
- "-dNOSAFER"
- "-dSAFER")
- paper-size-string
- pdf-name
- name)))
- ;; The wrapper on windows cannot handle `=' signs,
- ;; gs has a workaround with #.
- (if (eq? PLATFORM 'windows)
- (begin
- (set! cmd (string-regexp-substitute "=" "#" cmd))
- (set! cmd (string-regexp-substitute "-dSAFER " "" cmd))))
-
- (ly:message (_ "Converting to `~a'...") pdf-name)
- (ly:progress "\n")
+ (*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=~$" paper-width))
+ (if is-eps
+ *unspecified*
+ (ly:format "-dDEVICEHEIGHTPOINTS=~$" paper-height))
+ "-dCompatibilityLevel=1.4"
+ "-dNOPAUSE"
+ "-dBATCH"
+ "-r1200"
+ "-sDEVICE=pdfwrite"
+ (string-append "-sOutputFile=" pdf-name)
+ "-c.setpdfwrite"
+ (string-append "-f" name)))))
+
+ (ly:message (_ "Converting to `~a'...\n") pdf-name)