]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/framework-svg.scm
* The grand 2005-2006 replace.
[lilypond.git] / scm / framework-svg.scm
index d2948e9014107197522257472e53ee6eec8b7f5e..49841f25c5cd57f5f64f14c97400c245bc2c1a9b 100644 (file)
@@ -1,8 +1,9 @@
-;;;; framework-svg.scm --
+;;
+;; framework-svg.scm -- structure for SVG output
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 2004--2005 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c) 2004--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 
 (define-module (scm framework-svg))
 
@@ -17,7 +18,7 @@
 
 (define-public (output-framework basename book scopes fields)
   (let* ((filename (format "~a.svg" basename))
-        (outputter  (ly:make-paper-outputter filename
+        (outputter  (ly:make-paper-outputter (open-file filename "wb")
                                              (ly:output-backend)))
         (dump (lambda (str) (display str (ly:outputter-port outputter))))
         (paper (ly:paper-book-paper book))
@@ -38,6 +39,7 @@
                                `(begin (set! lily-unit-length ,unit-length) ""))
     (dump (eo 'svg
              '(xmlns . "http://www.w3.org/2000/svg")
+             '(xmlns:xlink . "http://www.w3.org/1999/xlink")
              '(version . "1.2")
 
              ;; Argggghhhh: SVG takes the px <-> mm mapping from the windowing system
@@ -50,7 +52,8 @@
       ;; FIXME: only use pages if there are more than one, pageSet is
       ;; not supported by all SVG applications yet.
       (if page-set? (eo 'pageSet) "")
-      (eo 'g `(transform . ,(format "scale(~a,~a)" output-scale output-scale)))))
+      (eo 'g `(transform . ,(format "scale(~a, ~a) "
+                                   output-scale output-scale)))))
     
     (for-each
      (lambda (page)
@@ -75,7 +78,7 @@
           (eo 'page '(page-orientation . "270"))
           (eo 'page))))
   
-  (dump (string-append (eo 'g)))
+  (dump (string-append (eo 'g )))
   (ly:outputter-dump-stencil outputter page)
   (dump (string-append (ec 'g)))
   (if (or landscape? page-set?)
@@ -95,7 +98,7 @@
                (lambda (x)
                  (let ((file-name (ly:find-file (string-append x ".svg"))))
                    (if file-name (embed-font (cached-file-contents file-name))
-                       (begin (ly:warn "cannot find SVG font ~S" x) ""))))
+                       (begin (ly:warning "cannot find SVG font ~S" x) ""))))
                (filter string? font-names))))
     (entity 'defs (string-join svgs "\n"))))