1 ;;;; sodipodi.scm -- implement Scheme output routines for PostScript
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 1998--2002 Jan Nieuwenhuizen <janneke@gnu.org>
7 ;;;; NOTE that Sodipodi
9 ;;;; * dumps core on displaying feta characters
10 ;;;; * needs PFBs (ie, not PFAs like sketch)
11 ;;;; * must have (LilyPond/feta) fonts registered through GNOME's
12 ;;;; gnome-font-install (ie, not through X11, like sketch and xfontsel),
13 ;;;; which in turn is very picky about afm files
14 ;;;; * has it's own svg-like language: possibly this file should be
18 (debug-enable 'backtrace)
21 (define-module (scm sodipodi))
22 (define this-module (current-module))
31 ;;; Lily output interface --- cleanup and docme
33 ;;; Bare minimum interface for \score { \notes c } }
36 ;;; xx-output-expression
41 ;;; and should intercept:
57 ;;(define-public (sodipodi-output-expression expr port)
58 ;; (display (eval expr this-module) port))
60 (define-public (sodipodi-output-expression expr port)
61 (display (dispatch expr) port))
64 (define (dispatch expr)
65 (let ((keyword (car expr)))
67 ((eq? keyword 'some-func) "")
68 ;;((eq? keyword 'placebox) (dispatch (cadddr expr)))
69 ;;((eq? keyword 'fontify) (dispatch (caddr expr)))
71 (if (module-defined? this-module keyword)
72 (apply (eval keyword this-module) (cdr expr))
75 (string-append "undefined: " (symbol->string keyword) "\n"))
81 ;; alist containing fontname -> fontcommand assoc (both strings)
82 ;;(define font-name-alist '())
85 (define (tagify tag string . attribute-alist)
88 (apply string-append (map (lambda (x) (string-append
90 (symbol->string (car x))
96 string "\n</" tag ">\n"))
99 ;; Interface functions
102 (tagify "tspan" (make-string 1 (integer->char i))))
108 (define (filledbox breapth width depth height)
111 '(style . "fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;")
114 `(x . ,(number->string (* 5.5 breapth)))
115 `(y . ,(number->string (* 5.5 (- 0 depth))))
116 `(width . ,(number->string (* 5.5 (+ breapth width))))
117 `(height . ,(number->string (* 5.5 (+ depth height))))))
120 (define (fontify name-mag-pair expr)
122 ;; (tagify "text" (dispatch expr) '(style . "font-family:LilyPond;font-style:feta20;font-size:200;")))
123 ;; (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;"))
124 (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;"))
129 (define (header creator generate)
130 "<?xml version='1.0' standalone='no'?>
131 <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 20010904//EN'
132 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'
135 xmlns:xlink CDATA #FIXED 'http://www.w3.org/1999/xlink'>
137 <!-- Created with Sodipodi ('http://www.sodipodi.com/') -->
140 sodipodi:version='0.26'
141 xmlns='http://www.w3.org/2000/svg'
142 xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'
143 xmlns:xlink='http://www.w3.org/1999/xlink'
146 sodipodi:docbase='/tmp/'
147 sodipodi:docname='/tmp/x'>
154 (define (placebox x y expr)
156 (tagify "g" (dispatch expr) `(transform .
158 "translate(" (number->string
161 (number->string (- 700 (* 5.5 y)))