]> git.donarmstrong.com Git - lilypond.git/commitdiff
(dump-page): Implement landscape.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 19 Dec 2004 10:20:27 +0000 (10:20 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 19 Dec 2004 10:20:27 +0000 (10:20 +0000)
ChangeLog
scm/framework-svg.scm
scm/output-svg.scm

index 7b7bc00882a3d5ccb99d138082774e7f1aa60408..da956c5e86f9e90b12f85c6932a7bf21ae97bb20 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-12-19  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * scm/framework-svg.scm (dump-page): Implement landscape.
+
 2004-12-18  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * lily/main.cc (setup_paths): Add svg to search path.
index af2ffd8a1a211fff970459e476f546d75ef3d1b5..259fde045f6c5b12adc59fecd634bb5d5478093b 100644 (file)
@@ -22,7 +22,7 @@
         (vsize (ly:output-def-lookup paper 'vsize))
         (page-width (inexact->exact (ceiling (* output-scale hsize))))
         (page-height (inexact->exact (ceiling (* output-scale vsize))))
-        (page-set? (> page-count 1)))
+        (page-set? (or (> page-count 1) landscape?)))
     
    (ly:outputter-dump-string
     outputter
     (ec 'svg)))))
 
 (define (dump-page outputter page page-number page-count landscape? page-set?)
-  ;; FIXME:landscape
   (ly:outputter-dump-string
    outputter (comment (format #f "Page: ~S/~S" page-number page-count)))
-  (if page-set? (ly:outputter-dump-string outputter (eo 'page)))
+  (if (or landscape? page-set?)
+      (ly:outputter-dump-string
+       outputter
+       (if landscape? (eo 'page '(page-orientation . "270")) (eo 'page))))
   (ly:outputter-dump-string outputter (string-append (eo 'g)))
   (ly:outputter-dump-stencil outputter page)
   (ly:outputter-dump-string outputter (string-append (ec 'g)))
-  (if page-set? (ly:outputter-dump-string outputter (ec 'page))))
+  (if (or landscape? page-set?)
+      (ly:outputter-dump-string outputter (ec 'page))))
 
 (define (embed-font string)
   (let ((start (string-contains string "<defs>"))
index b19006a342888139a9aabd9e75433fb6c820a349..03155dbf39b162fd64e292e48a27eef3dc843e09 100644 (file)
@@ -6,6 +6,11 @@
 
 ;;;; http://www.w3.org/TR/SVG11
 
+;;;; TODO:
+;;;;  * missing stencils: line, dashed-line ...
+;;;;  * rounded corners on stencils: rect, bezier (inkscape bug?)
+;;;;  * inkscape page/pageSet support
+
 (debug-enable 'backtrace)
 (define-module (scm output-svg))
 (define this-module (current-module))
 ;; FIXME: 2?
 (define output-scale (* 2 scale-to-unit))
 
-(define (stderr string . rest)
-  (apply format (cons (current-error-port) (cons string rest)))
-  (force-output (current-error-port)))
+(define indent-level 0)
+(define (indent s . add) s)
+
+;;(define (indentation indent str)
+;;   (regexp-substitute/global #f "\(\n\)[ \t]*" str 'pre 1 indent 'post))
+
+(define (indent s . add)
+  (let ((before indent-level)
+       (after (apply + (cons indent-level add)))
+       (after? (and (not (null? add)) (> (car add) 0))))
+    (set! indent-level after)
+    (if after?
+      (string-append (make-string before #\ ) s)
+      (string-append (make-string after #\ ) s))))
 
 (define (debugf string . rest)
   (if #f
              attributes-alist)))
 
 (define-public (eo entity . attributes-alist)
-  (format #f "<~S~a>\n" entity (attributes attributes-alist)))
+  (indent (format #f "<~S~a>\n" entity (attributes attributes-alist)) 2))
 
 (define-public (eoc entity . attributes-alist)
-  (format #f "<~S~a/>\n" entity (attributes attributes-alist)))
+  (indent (format #f "<~S~a/>\n" entity (attributes attributes-alist))))
 
 (define-public (ec entity)
-  (format #f "</~S>\n" entity))
+  (indent (format #f "</~S>\n" entity) -2))
 
 (define-public (entity entity string . attributes-alist)
   (if (equal? string "")
   (let* ((encoding (ly:font-encoding font))
         (anchor (if (memq encoding '(fetaMusic fetaBraces)) 'start 'start))
         (family (font-family font)))
-   (format #f "font-family:~a;font-weight:~a;font-size:~a;text-anchor:~S;"
+   (format #f "font-family:~a;font-style:~a;font-size:~a;text-anchor:~S;"
           (otf-name-mangling font family)
-          (otf-weight-mangling font family)
+          (otf-style-mangling font family)
           (font-size font) anchor)))
 
 (define (fontify font expr)
          "LilyPondBraces"
          family)))
 
-(define-public (otf-weight-mangling font family)
+(define-public (otf-style-mangling font family)
   ;; Hmm, family is bigcheese20/26?
   (if (string=? (substring family 0 (min (string-length family) 9))
                "bigcheese")