]> git.donarmstrong.com Git - lilypond.git/commitdiff
Check for a null string before using `placebox'
authorPatrick McCarty <pnorcks@gmail.com>
Sun, 5 Jul 2009 20:15:51 +0000 (13:15 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Thu, 16 Jul 2009 06:14:17 +0000 (23:14 -0700)
- This is most important for output-svg, due to
  the regular expression matching, but the other
  output backends can benefit from the removal of
  the superfluous `placebox' expressions.

scm/output-ps.scm
scm/output-socket.scm
scm/output-svg.scm

index 01677fa9dd8dad39a2e62900df4accec2c76d3cb..ae8d1e2478207571422a16de71fe1a38d6eb45cc 100644 (file)
    x-radius y-radius thick))
 
 (define (placebox x y s) 
-  (ly:format
-"~4f ~4f moveto
-~a\n" x y s))
+  (if (not (string-null? s))
+      (ly:format "~4f ~4f moveto ~a\n" x y s)
+      ""))
 
 (define (polygon points blot-diameter filled?)
   (ly:format "~a ~4l ~a ~4f draw_polygon"
index 60be72180619e429ab69a271d72cf6a7b4cee5a6..ab38e62967bc6c60b5cef2a08efa61d9a394659c 100644 (file)
@@ -30,7 +30,9 @@
          ))
 
 (define-public (placebox x y s) 
-  (format "at ~a ~a ~a\n" x y s))
+  (if (not (string-null? s))
+      (format "at ~a ~a ~a\n" x y s)
+      ""))
 
 (define-public (round-filled-box  breapth width depth height blot-diameter)
   (format "draw_round_box ~a ~a ~a ~a ~a"
index 5c6299a2794e1fc63e3077b63dd6b118e5c665ad..e99711f9c6e054ee99accb86a0cad5e4cf50983f 100644 (file)
                             (ly:font-glyph-name-to-charcode font name))))))
 
 (define (placebox x y expr)
-  (let*
-    ((match (regexp-exec svg-element-regexp expr))
-     (tagname (match:substring match 1))
-     (attributes (match:substring match 2)))
-
-    (string-append tagname
-                  ;; FIXME: Not using GNU coding standards
-                  ;; [translate ()] here to work around a
-                  ;; bug in Microsoft Internet Explorer 6.0
-                  (ly:format " transform=\"translate(~f, ~f)\" " x (- y))
-                  attributes
-                  "\n")))
+  (if (not (string-null? expr))
+      (let*
+       ((match (regexp-exec svg-element-regexp expr))
+        (tagname (match:substring match 1))
+        (attributes (match:substring match 2)))
+
+       (string-append tagname
+                      ;; FIXME: Not using GNU coding standards
+                      ;; [translate ()] here to work around a
+                      ;; bug in Microsoft Internet Explorer 6.0
+                      (ly:format " transform=\"translate(~f, ~f)\" "
+                                 x (- y))
+                      attributes
+                      "\n"))
+      ""))
 
 (define (polygon coords blot-diameter is-filled)
   (entity