]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-socket.scm
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / scm / output-socket.scm
index 74451f3aa89a2cfa69ed8b60c104ca284e12b1c1..c8a0fac3c7e872f5c7359951a33ac681956c11be 100644 (file)
@@ -11,6 +11,7 @@
 (define (dummy . rest)
   "")
 
+(display (ly:all-stencil-expressions))
 (for-each
  (lambda (x) 
    (module-define! (current-module)
   (format "drawline ~a ~a ~a ~a ~a"
          thick x1 y2 x2 y2))
 
+(define-public (polygon xy-coords blot do-fill)
+  (format "polygon ~a ~a ~a"
+         blot
+         (if do-fill "True" "False")
+         (string-join
+          (map number->string xy-coords))
+  ))
 
 (define-public (named-glyph font glyph)
-  (format "glyphshow ~a \"~a\" ~a"
+  (format "glyphshow ~a \"~a\" ~a \"~a\""
          (ly:font-glyph-name-to-charcode font glyph)
          (ly:font-name font)
          (modified-font-metric-font-scaling font)
+         glyph
          ))
 
 (define-public (placebox x y s) 
@@ -46,7 +55,7 @@
 
     (cond
      ((ly:music? cause) cause)
-     ((ly:grob? cause) (music-cause cause))
+;     ((ly:grob? cause) (music-cause cause))
      (else
       #f))))
 
       ((x-ext (ly:grob-extent grob grob X))
        (y-ext (ly:grob-extent grob grob Y))
        (x (car offset))
-       (y (cdr offset))
-       )
+       (y (cdr offset)))
+
+    (if (interval-empty? x-ext)
+       (set! x-ext '(0 . 0)))
 
+    (if (interval-empty? y-ext)
+       (set! y-ext '(0 . 0)))
+    
     (list (+ x (car x-ext))
          (+ y (car y-ext))
          (+ x (cdr x-ext))
-         (+ y (cdr y-ext)))
-    ))
+         (+ y (cdr y-ext))
+         )))
 
 (define-public (no-origin)
   "nocause\n")
 
 (define-public (grob-cause offset grob)
   (let*
-      ((cause (music-cause grob)))
-  (if (and cause (integer? (ly:music-property cause 'input-tag)))
-      (apply format
-            (append
-             (list "cause ~a ~a ~a ~a ~a\n" (ly:music-property cause 'input-tag))
-             (grob-bbox grob offset)
-            ))
-      "")))
-
-(define-public (glyph-string
-        postscript-font-name
-        size cid?
-        x-y-named-glyphs)
+      ((cause (music-cause grob))
+       (tag (if (and cause (integer? (ly:music-property cause 'input-tag)))
+               (ly:music-property cause 'input-tag)
+               -1))
+       (name (cdr (assoc 'name (ly:grob-property grob 'meta))))
+       )
+    
+    (apply format
+          (append (list "cause ~a \"~a\" ~a ~a ~a ~a\n"
+                        tag name)
+          
+                  (grob-bbox grob offset))
+         )))
+
+
+(define (escape-string str)
+  (string-regexp-substitute
+   " " "\\040" 
+   (string-regexp-substitute "\"" "\\\"" str)))
+  
+(define-public (utf-8-string
+               descr
+               string)
   
-  (format "text \"~a\" ~a ~a " postscript-font-name size
-         (string-join (map (lambda (xyn) (caddr xyn))
-                           x-y-named-glyphs))))
+  (format "utf-8 \"~a\" \"~a\""
+         (escape-string descr)
+
+         ;; don't want unescaped spaces.
+         (escape-string string)
+         ))
+
+
+(define (bezier-sandwich lst thick)
+  (format
+   #f
+   "bezier_sandwich ~a [~a]"
+   thick
+   (string-append 
+    (string-join (map (lambda (x) (format "(~a,~a)" (car x) (cdr x)))
+                     lst) ","))))