]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/ps-to-png.scm
Remove snippets from /new that are now in the LSR
[lilypond.git] / scm / ps-to-png.scm
index 1b3df3f1e62ef8382ff16313ca8c34c50a92394f..3b6b6c2452c719aa9963685d30861944172af19c 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; This file is part of LilyPond, the GNU music typesetter.
 ;;;;
-;;;; Copyright (C) 2005--2014 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; Copyright (C) 2005--2015 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;;
 ;;;; LilyPond is free software: you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@
 (define PLATFORM
   (string->symbol
    (string-downcase
-    (car (string-tokenize (vector-ref (uname) 0) char-set:letter)))))
+    (car (string-tokenize (utsname:sysname (uname)) char-set:letter)))))
 
 (define (re-sub re sub string)
   (regexp-substitute/global #f re string 'pre sub 'post))
@@ -96,7 +96,7 @@
                                   header))))
     (if match (string->number (match:substring match 1)) 0)))
 
-(define-public (make-ps-images ps-name . rest)
+(define-public (make-ps-images base-name tmp-name is-eps . rest)
   (let-keywords*
    rest #f
    ((resolution 90)
                       ((string-contains format-str "jpeg") "jpeg")
                       (else
                        (ly:error "Unknown pixmap format ~a" pixmap-format))))
-          (base (string-join
-                 (string-split (dir-basename ps-name ".ps" ".eps") #\%)
-                 "%%"))
-          (png1 (format #f "~a.~a" base extension))
-          (pngn (format #f "~a-page%d.~a" base extension))
-          (page-count (ps-page-count ps-name))
+          (png1 (format #f "~a.~a" base-name extension))
+          (pngn (format #f "~a-page%d.~a" base-name extension))
+          (page-count (ps-page-count tmp-name))
           (multi-page? (> page-count 1))
           (output-file (if multi-page? pngn png1))
 
           (gs-variable-options
-           (if (string-suffix-ci? ".eps" ps-name)
+           (if is-eps
                "-dEPSCrop"
                (format #f "-dDEVICEWIDTHPOINTS=~,2f -dDEVICEHEIGHTPOINTS=~,2f"
                        page-width page-height)))
                           gs-variable-options
                           pixmap-format
                           output-file
-                          (* anti-alias-factor resolution) ps-name))
+                          (* anti-alias-factor resolution) tmp-name))
           (status 0)
           (files '()))
 
            (if multi-page?
                (map
                 (lambda (n)
-                  (format #f "~a-page~a.png" base (1+ n)))
+                  (format #f "~a-page~a.png" base-name (1+ n)))
                 (iota page-count))
-               (list (format #f "~a.png" base))))
+               (list (format #f "~a.png" base-name))))
 
      (if (not (= 0 status))
          (begin