]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-ps.scm
(calc_direction): take dir from visible stem in
[lilypond.git] / scm / output-ps.scm
index fe168a103ffca1302e729a9f21d02881d7ed09ae..f7d0ee5b44a5ba0890f3c5e686890498ef5da70d 100644 (file)
@@ -2,7 +2,7 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 1998--2005 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;;                 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
 ;;;; Note: currently misused as testbed for titles with markup, see
@@ -21,7 +21,6 @@
            blank
            circle
            dot
-           beam
            dashed-slur
            char
            setcolor
@@ -34,7 +33,6 @@
            placebox
            bezier-sandwich
            embedded-ps
-           filledbox
            round-filled-box
            text
            polygon
 ;;; Lily output interface, PostScript implementation --- cleanup and docme
 ;;;
 
-;;; Output-interface functions
-(define (beam width slope thick blot)
-  (string-append
-   (ly:numbers->string (list slope width thick blot)) " draw_beam" ))
-
 ;; two beziers
 (define (bezier-sandwich lst thick)
   (string-append 
    (ly:number->string y2) " lineto stroke"))
 
 (define (embedded-ps string)
+  (display (list "len " (string-length string) "\n"))
   string)
 
-;; FIXME: use draw_round_box
-(define (filledbox breapth width depth height)
-  (string-append (ly:numbers->string (list breapth width depth height))
-                " draw_box"))
-
 (define (glyph-string
         postscript-font-name
         size cid?
-        x-y-named-glyphs)
-
-  (define (encoding-vector-hack glyphs)
-    
-    ;; GS fucks up with glyphs that are not in the
-    ;; encoding vector.
-    (define (inner j glyphs)
-      (if (or (null? glyphs) (> j 256))
-         '()
-         (cons (format "dup ~a /~a put\n"
-                       j (car glyphs))
-               (inner (1+ j) (cdr glyphs)))))
-         
-    (format "256 array 0 1 255 { 1 index exch /.notdef put} for\n ~a
-/EncHack reencode-font /EncHack findfont"
-           (apply string-append (inner 32 glyphs))))
-    ;; END HACK.
-  
-  (format #f "gsave 1 output-scale div 1 output-scale div scale
-  /~a ~a ~a scalefont setfont\n~a grestore"
+        w-x-y-named-glyphs)
+
+  (format #f "gsave 
+  /~a ~a ~a output-scale div scalefont setfont\n~a grestore"
          postscript-font-name
          (if cid?
              " /CIDFont findresource "
              " findfont")
-       
          size
          (apply
           string-append
           (map (lambda  (item)
                  (let*
-                     ((x (car item))
-                      (y (cadr item))
-                      (g (caddr item))
+                     ((w (car item))
+                      (x (cadr item))
+                      (y (caddr item))
+                      (g (cadddr item))
                       (prefix (if  (string? g) "/" "")))
 
-                   (if (and (= 0.0 x)
-                            (= 0.0 y))
-                       (format #f " ~a~a glyphshow\n" prefix g)
-                       (format #f " ~a ~a rmoveto ~a~a glyphshow\n"
-                               x y
-                               prefix
-                               g))))
-               x-y-named-glyphs))))
+                   (format #f " gsave ~a~a glyphshow grestore ~a ~a rmoveto \n" prefix g (+ w x) y)
+                   ))
+               w-x-y-named-glyphs))))
 
 (define (grob-cause offset grob)
   (let* ((cause (ly:grob-property grob 'cause))
          (if (and (< 0 (interval-length x-ext))
                   (< 0 (interval-length y-ext)))
              (format "~a ~a ~a ~a (textedit://~a:~a:~a:~a) mark_URI\n"
-                     (+ (car offset) (car x-ext))
-                     (+ (cdr offset) (car y-ext))
-                     (+ (car offset) (cdr x-ext))
-                     (+ (cdr offset) (cdr y-ext))
-                     file
+                     (ly:number->string (+ (car offset) (car x-ext)))
+                     (ly:number->string (+ (cdr offset) (car y-ext)))
+                     (ly:number->string (+ (car offset) (cdr x-ext)))
+                     (ly:number->string (+ (cdr offset) (cdr y-ext)))
+
+                     ;; TODO
+                     ;; full escaping.
+                     (string-regexp-substitute " " "%20" file)
                      (cadr location)
                      (caddr location)
                      (cadddr location))
   "")
 
 (define (placebox x y s) 
-  (string-append 
-   (ly:number->string x) " " (ly:number->string y) " { " s " } place-box\n"))
+  (format
+   "gsave ~a ~a translate
+0 0 moveto
+~a
+grestore\n"
+
+   (ly:number->string x)
+   (ly:number->string y)
+   s))
 
 (define (polygon points blotdiameter filled?)
   (string-append
          (cdr y)
          url))
 
-(define (utf8-string pango-font-description string)
-  (ly:warning (_ "utf8-string encountered in PS backend")))
+(define (utf-8-string pango-font-description string)
+  (ly:warning (_ "utf-8-string encountered in PS backend")))