1 (debug-enable 'backtrace)
4 ; '(("bold" . "as-dummy")
5 ; ("brace" . "as-braces")
6 ; ("dynamic" . "as-dummy")
7 ; ("default" . "as-dummy")
11 ; ("finger" . "as-number")
12 ; ("typewriter" . "as-dummy")
13 ; ("italic" . "as-dummy")
14 ; ("roman" . "as-dummy")
15 ; ("script" . "as-dummy")
16 ; ("large" . "as-dummy")
17 ; ("Large" . "as-dummy")
18 ; ("mark" . "as-number")
19 ; ("number" . "as-number")
20 ; ("timesig" . "as-number")
21 ; ("volta" . "as-number"))
25 (define as-font-alist-alist
31 (feta-nummer6 . as-number1)
32 (feta-nummer8 . as-number1)
33 (feta-braces16 . as-braces9)
42 (feta-nummer4 . as-number1)
43 (feta-nummer8 . as-number4)
44 (feta-braces16 . as-braces9)
52 (define (as-properties-to-font-name size fonts properties-alist-list)
53 (let* ((feta-name (properties-to-font-name fonts properties-alist-list))
54 (as-font-alist (cdr (assoc size as-font-alist-alist)))
55 (font (assoc (string->symbol feta-name) as-font-alist)))
56 (if font (symbol->string (cdr font))
57 (let ((e (current-error-port)))
59 (display "can't find font: " e)
61 ;;(symbol->string size)
65 ;; FIXME: making a full style-sheet is a pain, so we parasite on
66 ;; paper16 and translate the result.
68 (define (as-make-style-sheet size)
69 (let ((sheet (make-style-sheet 'paper16)))
70 (assoc-set! sheet 'properties-to-font
71 (lambda (x y) (as-properties-to-font-name size x y)))
74 ;;;; AsciiScript as -- ascii art output
75 (define (as-scm action-name)
77 (define (beam width slope thick)
79 (func "set-line-char" "#")
80 (func "rline-to" width (* width slope))
84 (define (bezier-sandwich l thick)
91 (dy (- (cdr c3) (cdr c0)))
93 (c1-dx (- (car c1) x))
94 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
95 (dir (if (< c1-line-y (cdr c1)) 1 -1))
96 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
99 (func "put" (if (< 0 dir) "/" "\\\\"))
100 (func "rmove-to" 1 (if (< 0 dir) 1 0))
101 (func "set-line-char" "_")
102 (func "h-line" (- dx 1))
103 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
104 (func "put" (if (< 0 dir) "\\\\" "/"))))))
107 (define (bracket arch_angle arch_width arch_height height arch_thick thick)
111 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
113 (func "set-line-char" "|")
114 (func "rmove-to" 0 1)
115 (func "v-line" (+ height 1))
116 (func "rmove-to" 0 (+ height 1))
123 (define (define-origin a b c ) "")
128 (define (experimental-on)
131 (define (filledbox breapth width depth height)
132 (let ((dx (+ width breapth))
133 (dy (+ depth height)))
135 (func "rmove-to" (* -1 breapth) (* -1 depth))
138 (func "set-line-char"
139 (if (<= dx 1) "|" "#"))
142 (func "set-line-char"
143 (if (<= dy 1) "-" "="))
144 (func "h-line" dx))))))
146 (define (font-load-command name-mag command)
147 ;; (display "name-mag: ")
149 ;; (display "command: ")
151 (func "load-font" (car name-mag) (cdr name-mag)))
153 (define (header creator generate)
154 (func "header" creator generate))
159 ;; urg: this is good for half of as2text's execution time
160 (define (xlily-def key val)
161 (string-append "(define " key " " (arg->string val) ")\n"))
163 (define (lily-def key val)
165 ;; let's not have all bloody definitions
166 (or (equal? key "lilypondpaperlinewidth")
167 (equal? key "lilypondpaperstaffheight")
168 (equal? key "lilypondpaperoutputscale"))
169 (string-append "(define " key " " (arg->string val) ")\n")
172 (define (no-origin) "")
174 (define (placebox x y s)
175 (let ((ey (inexact->exact y)))
176 (string-append "(move-to " (number->string (inexact->exact x)) " "
177 (if (= 0.5 (- (abs y) (abs ey)))
182 (define (select-font name-mag-pair)
183 (let* ((c (assoc name-mag-pair font-name-alist)))
188 "Programming error: No such font known "
189 (car name-mag-pair))))
190 "") ; issue no command
191 (func "select-font" (car name-mag-pair))))
193 (define (start-line height)
194 (func "start-line" height))
202 (define (tuplet ht gap dx dy thick dir) "")
204 (define (volta h w thick vert-start vert-end)
207 (func "set-line-char" "|")
208 (func "rmove-to" 0 -4)
209 ;; definition strange-way around
213 (func "rmove-to" 1 h)
214 (func "set-line-char" "_")
215 (func "h-line" (- w 1))
216 (func "set-line-char" "|")
219 (func "rmove-to" (- w 1) (* -1 h))
220 (func "v-line" (* -1 h)))
223 (cond ((eq? action-name 'all-definitions)
226 (define bracket ,bracket)
228 (define define-origin ,define-origin)
229 ;;(define crescendo ,crescendo)
230 (define bezier-sandwich ,bezier-sandwich)
231 ;;(define dashed-slur ,dashed-slur)
232 ;;(define decrescendo ,decrescendo)
233 (define end-output ,end-output)
234 (define experimental-on ,experimental-on)
235 (define filledbox ,filledbox)
236 ;;(define font-def ,font-def)
237 (define font-load-command ,font-load-command)
238 ;;(define font-switch ,font-switch)
239 (define header ,header)
240 (define header-end ,header-end)
241 (define lily-def ,lily-def)
242 ;;(define invoke-char ,invoke-char)
243 ;;(define invoke-dim1 ,invoke-dim1)
244 (define no-origin ,no-origin)
245 (define placebox ,placebox)
246 (define select-font ,select-font)
247 (define start-line ,start-line)
248 ;;(define stem ,stem)
249 (define stop-line ,stop-line)
250 (define stop-last-line ,stop-line)
252 (define tuplet ,tuplet)
253 (define volta ,volta)
255 ((eq? action-name 'tuplet) tuplet)
256 ;;((eq? action-name 'beam) beam)
257 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
258 ;;((eq? action-name 'bracket) bracket)
259 ((eq? action-name 'char) char)
260 ;;((eq? action-name 'crescendo) crescendo)
261 ;;((eq? action-name 'dashed-slur) dashed-slur)
262 ;;((eq? action-name 'decrescendo) decrescendo)
263 ;;((eq? action-name 'experimental-on) experimental-on)
264 ((eq? action-name 'filledbox) filledbox)
265 ((eq? action-name 'select-font) select-font)
266 ;;((eq? action-name 'volta) volta)
267 (else (error "unknown tag -- MUSA-SCM " action-name))
271 (define (scm-as-output)
272 (ly-eval (as-scm 'all-definitions)))