From 326866b5afeffba53ef98f2b6fce7ebb734d1b3e Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 10 Jun 2005 08:19:19 +0000 Subject: [PATCH] * scm/backend-library.scm (postscript->pdf): * scm/ps-to-png.scm (make-ps-images): Do not use gs -q switch in verbose mode. Search for several names of gs executable. --- ChangeLog | 6 ++++++ VERSION | 2 +- scm/backend-library.scm | 19 +++++++++++++++++-- scm/ps-to-png.scm | 26 +++++++++++++++++++++----- 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6654afcb6..144c2109c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-10 Jan Nieuwenhuizen + + * scm/backend-library.scm (postscript->pdf): + * scm/ps-to-png.scm (make-ps-images): Do not use gs -q switch in + verbose mode. Search for several names of gs executable. + 2005-06-10 Han-Wen Nienhuys * lily/ly-module.cc (ly_make_anonymous_module): call make-module diff --git a/VERSION b/VERSION index ea4a6e3d0e..b53029edd0 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=5 -PATCH_LEVEL=30 +PATCH_LEVEL=29 MY_PATCH_LEVEL= diff --git a/scm/backend-library.scm b/scm/backend-library.scm index d7a2cef49e..8a9de3b665 100644 --- a/scm/backend-library.scm +++ b/scm/backend-library.scm @@ -32,14 +32,27 @@ (regexp-substitute/global #f "[^- 0-9,.a-zA-Z'\"\\]" str 'pre 'post) "\"")) +(define-public (search-executable names) + (define (helper path lst) + (if (null? (cdr lst)) + (car lst) + (if (search-path path (car lst)) (car lst) + (helper path (cdr lst))))) + + (let ((path (parse-path (getenv "PATH")))) + (helper path names))) + +(define-public (search-gs) + (search-executable '("gs-nox" "gs-8.15" "gs"))) + (define-public (postscript->pdf papersizename name) (let* ((pdf-name (string-append (basename name ".ps") ".pdf")) (cmd (format #f - "gs\ + "~a\ + ~a\ ~a\ -dCompatibilityLevel=1.4 \ -sPAPERSIZE=~a\ - -q\ -dNOPAUSE\ -dBATCH\ -r1200 \ @@ -48,6 +61,8 @@ -c .setpdfwrite\ -f ~S\ " + (search-gs) + (if (ly:get-option 'verbose) "" "-q") (if (ly:get-option 'gs-font-load) " -dNOSAFER " " -dSAFER ") diff --git a/scm/ps-to-png.scm b/scm/ps-to-png.scm index 0908ffe9c8..1f752eb303 100644 --- a/scm/ps-to-png.scm +++ b/scm/ps-to-png.scm @@ -27,6 +27,19 @@ (define (re-sub re sub string) (regexp-substitute/global #f re string 'pre sub 'post)) +(define (search-executable names) + (define (helper path lst) + (if (null? (cdr lst)) + (car lst) + (if (search-path path (car lst)) (car lst) + (helper path (cdr lst))))) + + (let ((path (parse-path (getenv "PATH")))) + (helper path names))) + +(define (search-gs) + (search-executable '("gs-nox" "gs-8.15" "gs"))) + (define (gulp-port port max-length) (let ((str (make-string max-length))) (read-string!/partial str port) @@ -82,19 +95,20 @@ ;;png16m is because Lily produces color nowadays. (cmd (if multi-page? - (format #f "gs\ + (format #f "~a\ + ~a\ -dGraphicsAlphaBits=4\ -dNOPAUSE\ -dTextAlphaBits=4\ -sDEVICE=png16m\ -sOutputFile='~a'\ -sPAPERSIZE=~a\ - -q\ -r~S\ '~a'\ -c showpage\ -c quit" output-file paper-size resolution ps-name) - (format #f "gs\ + (format #f "~a\ + ~a\ -s\ -dGraphicsAlphaBits=4\ -dEPSCrop\ @@ -102,10 +116,12 @@ -dTextAlphaBits=4\ -sDEVICE=png16m\ -sOutputFile='~a'\ - -q\ -r~S\ '~a'\ - -c quit" output-file resolution ps-name))) + -c quit" + (search-gs) + (if verbose? "" "-q") + output-file resolution ps-name))) (foo (for-each delete-file (append (dir-re "." png1) (dir-re "." pngn-re)))) (bar (if verbose? -- 2.39.2