From: Patrick McCarty Date: Sun, 5 Jul 2009 20:15:51 +0000 (-0700) Subject: Check for a null string before using `placebox' X-Git-Tag: release/2.13.4-1~331 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=797245ff520d9c44f0308bbc2828bb4747c84123;p=lilypond.git Check for a null string before using `placebox' - 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. --- diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 01677fa9dd..ae8d1e2478 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -181,9 +181,9 @@ 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" diff --git a/scm/output-socket.scm b/scm/output-socket.scm index 60be721806..ab38e62967 100644 --- a/scm/output-socket.scm +++ b/scm/output-socket.scm @@ -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" diff --git a/scm/output-svg.scm b/scm/output-svg.scm index 5c6299a279..e99711f9c6 100644 --- a/scm/output-svg.scm +++ b/scm/output-svg.scm @@ -267,18 +267,21 @@ (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