]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/framework-ps.scm
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / scm / framework-ps.scm
index 670e28e538d35cb053aee265af64a41c8124ce41..0eb622fe48d56d184ab341e28ee429d3e40ff055 100644 (file)
     (string-append
       "/" command " { /" fontname " " (ly:number->string scaling) " output-scale div selectfont } bind def\n"))
 
-  (define (standard-tex-font? x)
-    (or (equal? (substring x 0 2) "ms")
-       (equal? (substring x 0 2) "cm")))
-
   (define (font-load-command font)
     (let* ((specced-font-name (ly:font-name font))
           (fontname (if specced-font-name
           (ops (ly:output-def-lookup paper 'output-scale))
           (scaling (* ops magnification designsize)))
 
-      ;; Bluesky pfbs have UPCASE names (sigh.)
-      ;; FIXME - don't support Bluesky?
-      (if (standard-tex-font? fontname)
-         (set! fontname (string-upcase fontname)))
       (if (equal? fontname "unknown")
          (display (list font fontname)))
       (define-font plain fontname scaling)))
               (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 -b eps FILE
 
 If have cut & pasted a lilypond fragment from a webpage, be sure
 to only remove anything before
@@ -779,5 +775,4 @@ to only remove anything before
   %% ****************************************************************
   %% Start cut-&-pastable-section
   %% ****************************************************************
-
 ")))