]> git.donarmstrong.com Git - lilypond.git/commitdiff
Some fixes. Sketch also groks this bare-bones
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 15 Oct 2002 15:57:40 +0000 (15:57 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 15 Oct 2002 15:57:40 +0000 (15:57 +0000)
svg output, including font.

ChangeLog
scm/sketch.scm
scm/sodipodi.scm

index db068ee2b6ef2c401875efc6945dcf152b048176..30f4795f9d775e5611988464bebe792a9c2fe5fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-10-15  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * scm/sodipodi.scm: Some fixes.  Sketch also groks this bare-bones
+       svg output, including font.
+
 2002-10-14  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * scm/lily.scm: Register sodipodi output module.
index 3f0491ccedc1be96061292a030d0e791836d7476..eff52c0c59f1313f766ab2ec4ca9a7ac85cbc47d 100644 (file)
@@ -289,11 +289,9 @@ layer('Layer 1',1,1,0,0,(0,0,0))
   (apply
    sketch-beziers (list x y (primitive-eval l) thick)))
 
-; TODO: use HEIGHT argument
 (define (start-system width height)
   (set! current-y (- current-y height))
-   "G()\n"
-)
+  "G()\n")
 
 ;;  r((520.305,0,0,98.0075,51.8863,10.089))
 ;;  width, 0, 0, height, x, y
index a3e369dd50203065cd8730ea1f6478b004e0c570..268fc48ccb52171fe36990b81f8d27b6ad6893a9 100644 (file)
 
 ;; Global vars
 
+(define output-scale 1)
+
+(define scale-to-unit
+  (cond
+   ((equal? (ly:unit) "mm") (/ 72.0  25.4))
+   ((equal? (ly:unit) "pt") (/ 72.0  72.27))
+   (else (error "unknown unit" (ly:unit)))))
+
 ;; alist containing fontname -> fontcommand assoc (both strings)
 ;;(define font-name-alist '())
 
 ;; Helper functions
+
+
 (define (tagify tag string . attribute-alist)
   (string-append
    "<" tag
   (tagify "tspan" (make-string 1 (integer->char i))))
 
 (define (end-output)
-  "</svg>")
+  "</g></svg>")
 
 
 (define (filledbox breapth width depth height)
   (tagify "rect" ""
 
          '(style . "fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;")
-;;       `(x . "50.0")
-;;       `(y . "400.0")
-         `(x . ,(number->string (* 5.5 breapth)))
-         `(y . ,(number->string (* 5.5 (- 0 depth))))
-         `(width . ,(number->string (* 5.5 (+ breapth width))))
-         `(height . ,(number->string (* 5.5 (+ depth height))))))
+         `(x . ,(number->string (* output-scale (- 0 breapth))))
+         `(y . ,(number->string (* output-scale (- 0 height))))
+         `(width . ,(number->string (* output-scale (+ breapth width))))
+         `(height . ,(number->string (* output-scale (+ depth height))))))
 
 
 (define (fontify name-mag-pair expr)
-;;  (dispatch expr))
-;;  (tagify "text" (dispatch expr) '(style . "font-family:LilyPond;font-style:feta20;font-size:200;")))
-;;  (tagify "text" (dispatch expr) '(style . "fill:black;stroke:none;font-family:feta20;font-style:normal;font-weight:normal;font-size:200;fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;"))
-  (tagify "text" (dispatch expr) '(style . "fill:black;stroke:none;font-family:futa20;font-style:normal;font-weight:normal;font-size:20;fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;"))
+
+  ;; for simple sodipodi with feta20.pfb:
+;;  (tagify "text" (dispatch expr) '(style . "fill:black;stroke:none;font-family:futa20;font-style:normal;font-weight:normal;font-size:20;fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;"))
+
+  ;; Sketch' svg input filter groks this:
+  (tagify "text" (dispatch expr) '(style . "fill:black;stroke:none;font-family:LilyPond-Feta-20;font-style:normal;font-weight:normal;font-size:20;fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;text-anchor:start;writing-mode:lr;"))
 
   )
 
   <defs
      id='defs3' />
   <sodipodi:namedview
-     id='base' />")
+     id='base' />
+  <g tranform='translate(50,-250)'>
+  ")
 
 
 (define (placebox x y expr)
-;;  (dispatch expr))
   (tagify "g" (dispatch expr) `(transform .
                                          ,(string-append
                                            "translate(" (number->string
-                                                         (* 5.5 x))
+                                                         (* output-scale x))
                                            ","
-                                           (number->string (- 700 (* 5.5 y)))
+                                           (number->string (- 0 (* output-scale y)))
                                            ")"))))
                                 
+(define (lily-def key val)
+  (if (equal? key "lilypondpaperoutputscale")
+      ;; ugr
+      (set! output-scale (* scale-to-unit (string->number val))))
+  "")
+
+