]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/framework-ps.scm
-b eps -> -dbackend=eps
[lilypond.git] / scm / framework-ps.scm
index 213d995c2c463a3eb7dd3897190ba192643693ca..7c5669fdb32ecd11b80ded4d137994e30ddfb81c 100644 (file)
             (scm clip-region)
             (lily))
 
-(define (format dest . rest)
-  (if (string? dest)
-      (apply simple-format (cons #f (cons dest rest)))
-      (apply simple-format (cons dest rest))))
+(define format ergonomic-simple-format)
 
 (define framework-ps-module (current-module))
 
               (ly:output-def-lookup paper 'output-scale))
            (ly:bp 1)))
        (landscape? (eq? (ly:output-def-lookup paper 'landscape) #t)))
-  (format "%%DocumentMedia: ~a ~a ~a ~a ~a ~a\n"
-   (ly:output-def-lookup paper 'papersizename)
-   (round2 (if landscape? h w))
-   (round2 (if landscape? w h))
-   80  ;; weight
-   "()" ;; color
-   "()"  ;; type
+  (ly:format "%%DocumentMedia: ~a ~2f ~2f ~a ~a ~a\n"
+            (ly:output-def-lookup paper 'papersizename)
+            (if landscape? h w)
+            (if landscape? w h)
+            80  ;; weight
+            "()" ;; color
+            "()"  ;; type
   )))
 
 
 (define (write-preamble paper load-fonts? port)
 
   (define (load-font-via-GS font-name-filename)
-    (define (ps-load-file name)
-      (format
-       (if (string? name)
-          "(~a) (r) file .loadfont\n"
-          "% cannot find font file: ~a\n")
-       name))
+    (define (ps-load-file file-name)
+      (if (string? file-name)
+         (if (string-contains file-name (ly:get-option 'datadir))
+             (begin
+               (set! file-name (ly:string-substitute (ly:get-option 'datadir) "" file-name))
+               (format "lilypond-datadir (~a) concatstrings (r) file .loadfont" file-name))
+             (format "(~a) (r) file .loadfont\n" file-name))
+         (format "% cannot find font file: ~a\n" file-name)))
 
     (let* ((font (car font-name-filename))
           (name (cadr font-name-filename))
       pfas))
 
   (display "%%BeginProlog\n" port)
+
+  (format port
+           "/lilypond-datadir where {pop} {userdict /lilypond-datadir (~a) put } ifelse"
+           (ly:get-option 'datadir))
+  
   (if load-fonts?
       (for-each
        (lambda (f)
   (display (procset "music-drawing-routines.ps") port)
   (display (procset "lilyponddefs.ps") port)
 
-  (if (not (ly:get-option 'point-and-click))
-      (display "/mark_URI { pop pop pop pop pop } bind def\n" port)) 
-
   (display "%%EndProlog\n" port)
   
   (display "%%BeginSetup\ninit-lilypond-parameters\n%%EndSetup\n\n" port))
                     ;; content-mangling is always bad.
                     ;; MINGW hack: need to have "b"inary for embedding CFFs
                     (open-file filename "wb")
-                    "ps"))
+                    'ps))
         (paper (ly:paper-book-paper book))
         (systems (ly:paper-book-systems book))
         (page-stencils (map page-stencil (ly:paper-book-pages book)))
                     ;; content-mangling is always bad.
                     ;; MINGW hack: need to have "b"inary for embedding CFFs
                     (open-file (format "~a.eps" filename) "wb")
-                    "ps"))
+                    'ps))
 
         (port (ly:outputter-port outputter))
         (rounded-bbox (to-bp-box bbox))
     ))
 
 
-(define (clip-system-EPSes basename paper-book)
+(define-public (clip-system-EPSes basename paper-book)
   (define do-pdf (member  "pdf" (ly:output-formats)))
 
   (define (clip-score-systems basename systems)
   (ly:error (_ "\nThe PostScript backend does not support the system-by-system 
 output. For that, use the EPS backend instead,
 
-  lilypond -b eps <file>
+  lilypond -dbackend=eps FILE
 
 If have cut & pasted a lilypond fragment from a webpage, be sure
 to only remove anything before
@@ -771,5 +772,4 @@ to only remove anything before
   %% ****************************************************************
   %% Start cut-&-pastable-section
   %% ****************************************************************
-
 ")))