1 ; lily.scm -- implement Scheme output routines for TeX and PostScript
3 ; source file of the GNU LilyPond music typesetter
5 ; (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
9 ; This file contains various routines in Scheme that are easier to
10 ; do here than in C++. At present it is an unorganised mess. Sorry.
14 ;(debug-enable 'backtrace)
18 (use-modules (ice-9 regex))
20 ;; The regex module may not be available, or may be broken.
21 ;; If you have trouble with regex, define #f
22 ;;(define use-regex #t)
23 ;;(define use-regex #f)
26 (let ((os (string-downcase (vector-ref (uname) 0))))
27 (not (equal? "cygwin" (substring os 0 (min 6 (string-length os)))))))
29 ;; do nothing in .scm output
30 (define (comment s) "")
36 (define (cons-map f x)
37 (cons (f (car x)) (f (cdr x))))
39 (define (reduce operator list)
40 (if (null? (cdr list)) (car list)
41 (operator (car list) (reduce operator (cdr list)))
46 (define (numbers->string l)
47 (apply string-append (map ly-number->string l)))
49 ; (define (chop-decimal x) (if (< (abs x) 0.001) 0.0 x))
51 (define (number->octal-string x)
52 (let* ((n (inexact->exact x))
54 (n8 (quotient (- n (* n64 64)) 8)))
58 (number->string (remainder (- n (+ (* n64 64) (* n8 8))) 8)))))
60 (define (inexact->string x radix)
61 (let ((n (inexact->exact x)))
62 (number->string n radix)))
65 (define (control->string c)
66 (string-append (number->string (car c)) " "
67 (number->string (cdr c)) " "))
73 (make-string 1 (integer->char (+ (char->integer #\A) i)))
78 (define (scm-scm action-name)
81 (define security-paranoia #f)
84 ;; See documentation of Item::visibility_lambda_
85 (define (begin-of-line-visible d) (if (= d 1) '(#f . #f) '(#t . #t)))
86 (define (spanbar-begin-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))
87 (define (all-visible d) '(#f . #f))
88 (define (all-invisible d) '(#t . #t))
89 (define (begin-of-line-invisible d) (if (= d 1) '(#t . #t) '(#f . #f)))
90 (define (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))
93 (define mark-visibility end-of-line-invisible)
95 ;; Spacing constants for prefatory matter.
97 ;; rules for this spacing are much more complicated than this. See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147
101 ;; (Measured in staff space)
104 ((none Instrument_name) . (extra-space 1.0))
105 ((Instrument_name Left_edge_item) . (extra-space 1.0))
106 ((Left_edge_item Clef_item) . (extra-space 1.0))
107 ((Left_edge_item Key_item) . (extra-space 0.0))
108 ((Left_edge_item begin-of-note) . (extra-space 1.0))
109 ((none Left_edge_item) . (extra-space 0.0))
110 ((Left_edge_item Staff_bar) . (extra-space 0.0))
111 ; ((none Left_edge_item) . (extra-space -15.0))
112 ; ((none Left_edge_item) . (extra-space -15.0))
113 ((none Clef_item) . (minimum-space 1.0))
114 ((none Staff_bar) . (minimum-space 0.0))
115 ((none Clef_item) . (minimum-space 1.0))
116 ((none Key_item) . (minimum-space 0.5))
117 ((none Time_signature) . (extra-space 0.0))
118 ((none begin-of-note) . (minimum-space 1.5))
119 ((Clef_item Key_item) . (minimum-space 4.0))
120 ((Key_item Time_signature) . (extra-space 1.0))
121 ((Clef_item Time_signature) . (minimum-space 3.5))
122 ((Staff_bar Clef_item) . (minimum-space 1.0))
123 ((Clef_item Staff_bar) . (minimum-space 3.7))
124 ((Time_signature Staff_bar) . (minimum-space 2.0))
125 ((Key_item Staff_bar) . (extra-space 1.0))
126 ((Staff_bar Time_signature) . (minimum-space 1.5)) ;double check this.
127 ((Time_signature begin-of-note) . (extra-space 2.0)) ;double check this.
128 ((Key_item begin-of-note) . (extra-space 2.5))
129 ((Staff_bar begin-of-note) . (extra-space 1.0))
130 ((Clef_item begin-of-note) . (minimum-space 5.0))
131 ((none Breathing_sign) . (minimum-space 0.0))
132 ((Breathing_sign Key_item) . (minimum-space 1.5))
133 ((Breathing_sign begin-of-note) . (minimum-space 1.0))
134 ((Breathing_sign Staff_bar) . (minimum-space 1.5))
135 ((Breathing_sign Clef_item) . (minimum-space 2.0))
139 (define (find-notehead-symbol duration style)
142 ((harmonic) "0mensural")
144 (string-append (number->string duration)
145 (if (< duration 0) "mensural" "")))
146 ((default) (number->string duration))
148 (string-append (number->string duration) (symbol->string style)))))
153 ;; this is silly, can't we use something like
154 ;; roman-0, roman-1 roman+1 ?
157 ("brace" . "feta-braces")
158 ("default" . "cmr10")
159 ("dynamic" . "feta-din")
163 ("typewriter" . "cmtt")
170 ("mark" . "feta-nummer")
171 ("finger" . "feta-nummer")
172 ("timesig" . "feta-nummer")
173 ("number" . "feta-nummer")
174 ("volta" . "feta-nummer"))
177 (define (string-encode-integer i)
180 ((< i 0) (string-append "n" (string-encode-integer (- i))))
182 (make-string 1 (integer->char (+ 65 (modulo i 26))))
183 (string-encode-integer (quotient i 26))
190 (cdr (assoc i '((-4 . 482)
203 (define script-alist '())
205 (define font-name-alist '())
206 (define (font-command name-mag)
208 (string-append "magfont"
209 (string-encode-integer (hashq (car name-mag) 1000000))
211 (string-encode-integer (cdr name-mag)))
215 (define (define-fonts names)
216 (set! font-name-alist (map font-command names))
219 (font-load-command (car x) (cdr x))) font-name-alist)
222 (define (fontify name exp)
223 (string-append (select-font name)
230 ; Make a function that checks score element for being of a specific type.
231 (define (make-type-checker name)
233 (not (not (memq name (ly-get-elt-property elt 'interfaces))))))
236 ;;;;;;;;;;;;;;;;;;; TeX output
237 (define (tex-scm action-name)
242 (define (select-font font-name-symbol)
245 (c (assoc font-name-symbol font-name-alist))
250 (ly-warn (string-append
251 "Programming error: No such font known " (car font-name-symbol)))
252 "") ; issue no command
253 (string-append "\\" (cdr c)))
258 (define (beam width slope thick)
259 (embedded-ps ((ps-scm 'beam) width slope thick)))
261 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
262 (embedded-ps ((ps-scm 'bracket) arch_angle arch_width arch_height width height arch_thick thick)))
264 (define (dashed-slur thick dash l)
265 (embedded-ps ((ps-scm 'dashed-slur) thick dash l)))
267 (define (crescendo thick w h cont)
268 (embedded-ps ((ps-scm 'crescendo) thick w h cont)))
271 (string-append "\\char" (inexact->string i 10) " "))
273 (define (dashed-line thick dash w)
274 (embedded-ps ((ps-scm 'dashed-line) thick dash w)))
276 (define (decrescendo thick w h cont)
277 (embedded-ps ((ps-scm 'decrescendo) thick w h cont)))
279 (define (font-load-command name-mag command)
281 "\\font\\" command "="
282 (symbol->string (car name-mag))
284 (number->string (magstep (cdr name-mag)))
287 (define (embedded-ps s)
288 (string-append "\\embeddedps{" s "}"))
291 (string-append "% " s))
295 ; uncomment for some stats about lily memory
296 ; (display (gc-stats))
297 (string-append "\n\\EndLilyPondOutput"
301 (define (experimental-on)
304 (define (font-switch i)
308 (define (font-def i s)
310 "\\font" (font-switch i) "=" s "\n"))
316 ;; URG: ly-gulp-file: now we can't use scm output without Lily
318 ;; fixed in 1.3.4 for powerpc -- broken on Windows
319 (regexp-substitute/global #f "\n"
320 (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
321 (ly-gulp-file "lily.ps"))
323 "\\input lilyponddefs \\turnOnPostScript"))
325 (define (header creator generate)
327 "%created by: " creator generate "\n"))
329 (define (invoke-char s i)
331 "\n\\" s "{" (inexact->string i 10) "}" ))
333 (define (invoke-dim1 s d)
335 "\n\\" s "{" (number->dim d) "}"))
340 ;; need to do something to make this really safe.
342 (define (output-tex-string s)
343 (if security-paranoia
345 (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post)
346 (begin (display "warning: not paranoid") (newline) s))
349 (define (lily-def key val)
353 ;; fixed in 1.3.4 for powerpc -- broken on Windows
354 (regexp-substitute/global #f "_"
355 (output-tex-string key) 'pre "X" 'post)
356 (output-tex-string key))
357 "{" (output-tex-string val) "}\n"))
359 (define (number->dim x)
361 (ly-number->string x) " pt "))
363 (define (placebox x y s)
366 (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
368 (define (bezier-sandwich l thick)
369 (embedded-ps ((ps-scm 'bezier-sandwich) l thick)))
371 (define (start-line ht)
372 (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
375 "}\\vss}\\interscoreline")
376 (define (stop-last-line)
378 (define (filledbox breapth width depth height)
380 "\\kern" (number->dim (- breapth))
381 "\\vrule width " (number->dim (+ breapth width))
382 "depth " (number->dim depth)
383 "height " (number->dim height) " "))
386 (string-append "\\hbox{" (output-tex-string s) "}"))
388 (define (tuplet ht gapx dx dy thick dir)
389 (embedded-ps ((ps-scm 'tuplet) ht gapx dx dy thick dir)))
391 (define (volta h w thick vert_start vert_end)
392 (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end)))
395 ;; The procedures listed below form the public interface of TeX-scm.
396 ;; (should merge the 2 lists)
397 (cond ((eq? action-name 'all-definitions)
399 (define font-load-command ,font-load-command)
401 (define bezier-sandwich ,bezier-sandwich)
402 (define bracket ,bracket)
404 (define crescendo ,crescendo)
405 (define dashed-line ,dashed-line)
406 (define dashed-slur ,dashed-slur)
407 (define decrescendo ,decrescendo)
408 (define end-output ,end-output)
409 (define experimental-on ,experimental-on)
410 (define filledbox ,filledbox)
411 (define font-def ,font-def)
412 (define font-switch ,font-switch)
413 (define header-end ,header-end)
414 (define lily-def ,lily-def)
415 (define header ,header)
416 (define invoke-char ,invoke-char)
417 (define invoke-dim1 ,invoke-dim1)
418 (define placebox ,placebox)
419 (define select-font ,select-font)
420 (define start-line ,start-line)
421 (define stop-line ,stop-line)
422 (define stop-last-line ,stop-last-line)
424 (define tuplet ,tuplet)
425 (define volta ,volta)
428 ((eq? action-name 'beam) beam)
429 ((eq? action-name 'tuplet) tuplet)
430 ((eq? action-name 'bracket) bracket)
431 ((eq? action-name 'crescendo) crescendo)
432 ((eq? action-name 'dashed-line) dashed-line)
433 ((eq? action-name 'dashed-slur) dashed-slur)
434 ((eq? action-name 'decrescendo) decrescendo)
435 ((eq? action-name 'end-output) end-output)
436 ((eq? action-name 'experimental-on) experimental-on)
437 ((eq? action-name 'font-def) font-def)
438 ((eq? action-name 'font-switch) font-switch)
439 ((eq? action-name 'header-end) header-end)
440 ((eq? action-name 'lily-def) lily-def)
441 ((eq? action-name 'header) header)
442 ((eq? action-name 'invoke-char) invoke-char)
443 ((eq? action-name 'invoke-dim1) invoke-dim1)
444 ((eq? action-name 'placebox) placebox)
445 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
446 ((eq? action-name 'start-line) start-line)
447 ((eq? action-name 'stem) stem)
448 ((eq? action-name 'stop-line) stop-line)
449 ((eq? action-name 'stop-last-line) stop-last-line)
450 ((eq? action-name 'volta) volta)
451 (else (error "unknown tag -- PS-TEX " action-name))
457 (define (ps-scm action-name)
459 ;; alist containing fontname -> fontcommand assoc (both strings)
460 (define font-alist '())
461 (define font-count 0)
462 (define current-font "")
465 (define (cached-fontname i)
468 (make-string 1 (integer->char (+ 65 i)))))
470 (define (mag-to-size m)
471 (number->string (case m
474 (2 14) ; really: 14.400
475 (3 17) ; really: 17.280
476 (4 21) ; really: 20.736
477 (5 24) ; really: 24.888
478 (6 30) ; really: 29.856
482 (define (select-font font-name-symbol)
485 (c (assoc font-name-symbol font-name-alist))
490 (ly-warn (string-append
491 "Programming error: No such font known " (car font-name-symbol)))
492 "") ; issue no command
493 (string-append " " (cdr c) " "))
498 (define (font-load-command name-mag command)
502 (symbol->string (car name-mag))
504 (number->string (magstep (cdr name-mag)))
505 " 1000 div 12 mul scalefont setfont } bind def "
509 (define (beam width slope thick)
511 (numbers->string (list width slope thick)) " draw_beam" ))
514 (string-append "% " s))
516 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
518 (numbers->string (list arch_angle arch_width arch_height width height arch_thick thick)) " draw_bracket" ))
521 (invoke-char " show" i))
523 (define (crescendo thick w h cont )
525 (numbers->string (list w h (inexact->exact cont) thick))
528 ;; what the heck is this interface ?
529 (define (dashed-slur thick dash l)
531 (apply string-append (map control->string l))
532 (number->string thick)
534 (number->string dash)
536 (number->string (* 10 thick)) ;UGH. 10 ?
537 " ] 0 draw_dashed_slur"))
539 (define (dashed-line thick dash width)
541 (number->string width)
543 (number->string thick)
545 (number->string dash)
547 (number->string dash)
548 " ] 0 draw_dashed_line"))
550 (define (decrescendo thick w h cont)
552 (numbers->string (list w h (inexact->exact cont) thick))
553 " draw_decrescendo"))
559 (define (experimental-on) "")
561 (define (filledbox breapth width depth height)
562 (string-append (numbers->string (list breapth width depth height))
566 (define (font-def i s)
569 (substring s 0 (- (string-length s) 4))
570 " findfont 12 scalefont setfont} bind def \n"))
572 (define (font-switch i)
573 (string-append (font i) " "))
577 ;; URG: now we can't use scm output without Lily
578 (ly-gulp-file "lilyponddefs.ps")
579 " {exch pop //systemdict /run get exec} "
580 (ly-gulp-file "lily.ps")
581 "{ exch pop //systemdict /run get exec } "
584 (define (lily-def key val)
586 (if (string=? (substring key 0 (min (string-length "mudelapaper") (string-length key))) "mudelapaper")
587 (string-append "/" key " {" val "} bind def\n")
588 (string-append "/" key " (" val ") def\n")
592 (define (header creator generate)
595 "%%Creator: " creator generate "\n"))
597 (define (invoke-char s i)
599 "(\\" (inexact->string i 8) ") " s " " ))
601 (define (invoke-dim1 s d)
603 (number->string (* d (/ 72.27 72))) " " s ))
605 (define (placebox x y s)
607 (number->string x) " " (number->string y) " {" s "} placebox "))
609 (define (bezier-sandwich l thick)
611 (apply string-append (map control->string l))
612 (number->string thick)
613 " draw_bezier_sandwich"))
615 (define (start-line height)
618 (define (stem breapth width depth height)
619 (string-append (numbers->string (list breapth width depth height))
626 (string-append "(" s ") show "))
629 (define (volta h w thick vert_start vert_end)
631 (numbers->string (list h w thick (inexact->exact vert_start) (inexact->exact vert_end)))
634 (define (tuplet ht gap dx dy thick dir)
636 (numbers->string (list ht gap dx dy thick (inexact->exact dir)))
645 (cond ((eq? action-name 'all-definitions)
648 (define tuplet ,tuplet)
649 (define bracket ,bracket)
651 (define crescendo ,crescendo)
652 (define volta ,volta)
653 (define bezier-sandwich ,bezier-sandwich)
654 (define dashed-line ,dashed-line)
655 (define dashed-slur ,dashed-slur)
656 (define decrescendo ,decrescendo)
657 (define end-output ,end-output)
658 (define experimental-on ,experimental-on)
659 (define filledbox ,filledbox)
660 (define font-def ,font-def)
661 (define font-switch ,font-switch)
662 (define header-end ,header-end)
663 (define lily-def ,lily-def)
664 (define font-load-command ,font-load-command)
665 (define header ,header)
666 (define invoke-char ,invoke-char)
667 (define invoke-dim1 ,invoke-dim1)
668 (define placebox ,placebox)
669 (define select-font ,select-font)
670 (define start-line ,start-line)
672 (define stop-line ,stop-line)
673 (define stop-last-line ,stop-line)
676 ((eq? action-name 'tuplet) tuplet)
677 ((eq? action-name 'beam) beam)
678 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
679 ((eq? action-name 'bracket) bracket)
680 ((eq? action-name 'char) char)
681 ((eq? action-name 'crescendo) crescendo)
682 ((eq? action-name 'dashed-line) dashed-line)
683 ((eq? action-name 'dashed-slur) dashed-slur)
684 ((eq? action-name 'decrescendo) decrescendo)
685 ((eq? action-name 'experimental-on) experimental-on)
686 ((eq? action-name 'filledbox) filledbox)
687 ((eq? action-name 'select-font) select-font)
688 ((eq? action-name 'volta) volta)
689 (else (error "unknown tag -- PS-SCM " action-name))
694 (define (arg->string arg)
695 (cond ((number? arg) (inexact->string arg 10))
696 ((string? arg) (string-append "\"" arg "\""))
697 ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
699 (define (func name . args)
705 (map (lambda (x) (string-append " " (arg->string x))) args)))
711 (inexact->exact (/ x (abs x)))))
714 (define (as-scm action-name)
716 (define (beam width slope thick)
718 (func "set-line-char" "#")
719 (func "rline-to" width (* width slope))
723 (define (bezier-sandwich l thick)
730 (dy (- (cdr c3) (cdr c0)))
732 (c1-dx (- (car c1) x))
733 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
734 (dir (if (< c1-line-y (cdr c1)) 1 -1))
735 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
737 (func "rmove-to" x y)
738 (func "put" (if (< 0 dir) "/" "\\\\"))
739 (func "rmove-to" 1 (if (< 0 dir) 1 0))
740 (func "set-line-char" "_")
741 (func "h-line" (- dx 1))
742 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
743 (func "put" (if (< 0 dir) "\\\\" "/"))))))
745 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
747 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
749 (func "set-line-char" "|")
750 (func "rmove-to" 0 1)
751 (func "v-line" (+ height 1))
752 (func "rmove-to" 0 (+ height 1))
762 (define (experimental-on)
765 (define (filledbox breapth width depth height)
766 (let ((dx (+ width breapth))
767 (dy (+ depth height)))
769 (func "rmove-to" (* -1 breapth) (* -1 depth))
772 (func "set-line-char"
773 (if (<= dx 1) "|" "#"))
776 (func "set-line-char"
777 (if (<= dy 1) "-" "="))
778 (func "h-line" dx))))))
780 (define (font-load-command name-mag command)
781 (func "load-font" (car name-mag) (magstep (cdr name-mag))))
783 (define (header creator generate)
784 (func "header" creator generate))
789 ;; urg: this is good for half of as2text's execution time
790 (define (xlily-def key val)
791 (string-append "(define " key " " (arg->string val) ")\n"))
793 (define (lily-def key val)
795 (or (equal? key "mudelapaperlinewidth")
796 (equal? key "mudelapaperstaffheight"))
797 (string-append "(define " key " " (arg->string val) ")\n")
800 (define (placebox x y s)
801 (let ((ey (inexact->exact y)))
802 (string-append "(move-to " (number->string (inexact->exact x)) " "
803 (if (= 0.5 (- (abs y) (abs ey)))
808 (define (select-font font-name-symbol)
809 (let* ((c (assoc font-name-symbol font-name-alist)))
814 "Programming error: No such font known "
815 (car font-name-symbol)))
816 "") ; issue no command
817 (func "select-font" (car font-name-symbol)))))
819 (define (start-line height)
820 (func "start-line" height))
828 (define (volta h w thick vert-start vert-end)
831 (func "set-line-char" "|")
832 (func "rmove-to" 0 -4)
833 ;; definition strange-way around
837 (func "rmove-to" 1 h)
838 (func "set-line-char" "_")
839 (func "h-line" (- w 1))
840 (func "set-line-char" "|")
843 (func "rmove-to" (- w 1) (* -1 h))
844 (func "v-line" (* -1 h)))
847 (cond ((eq? action-name 'all-definitions)
850 (define bracket ,bracket)
852 ;;(define crescendo ,crescendo)
853 (define bezier-sandwich ,bezier-sandwich)
854 ;;(define dashed-slur ,dashed-slur)
855 ;;(define decrescendo ,decrescendo)
856 (define end-output ,end-output)
857 (define experimental-on ,experimental-on)
858 (define filledbox ,filledbox)
859 ;;(define font-def ,font-def)
860 (define font-load-command ,font-load-command)
861 ;;(define font-switch ,font-switch)
862 (define header ,header)
863 (define header-end ,header-end)
864 (define lily-def ,lily-def)
865 ;;(define invoke-char ,invoke-char)
866 ;;(define invoke-dim1 ,invoke-dim1)
867 (define placebox ,placebox)
868 (define select-font ,select-font)
869 (define start-line ,start-line)
870 ;;(define stem ,stem)
871 (define stop-line ,stop-line)
872 (define stop-last-line ,stop-line)
874 ;;(define tuplet ,tuplet)
875 (define volta ,volta)
877 ;;((eq? action-name 'tuplet) tuplet)
878 ;;((eq? action-name 'beam) beam)
879 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
880 ;;((eq? action-name 'bracket) bracket)
881 ((eq? action-name 'char) char)
882 ;;((eq? action-name 'crescendo) crescendo)
883 ;;((eq? action-name 'dashed-slur) dashed-slur)
884 ;;((eq? action-name 'decrescendo) decrescendo)
885 ;;((eq? action-name 'experimental-on) experimental-on)
886 ((eq? action-name 'filledbox) filledbox)
887 ((eq? action-name 'select-font) select-font)
888 ;;((eq? action-name 'volta) volta)
889 (else (error "unknown tag -- MUSA-SCM " action-name))
894 (define (gulp-file name)
895 (let* ((port (open-file name "r"))
896 (content (let loop ((text ""))
897 (let ((line (read-line port)))
898 (if (or (eof-object? line)
901 (loop (string-append text line "\n")))))))
905 ;; urg: Use when standalone, do:
906 ;; (define ly-gulp-file scm-gulp-file)
907 (define (scm-gulp-file name)
909 (cons (string-append (getenv 'LILYPONDPREFIX) "/ly")
910 (cons (string-append (getenv 'LILYPONDPREFIX) "/ps")
912 (let ((path (%search-load-path name)))
917 (define (scm-tex-output)
918 (eval (tex-scm 'all-definitions)))
920 (define (scm-ps-output)
921 (eval (ps-scm 'all-definitions)))
923 (define (scm-as-output)
924 (eval (as-scm 'all-definitions)))
926 (define (index-cell cell dir)
932 ; How should a bar line behave at a break?
934 (define (break-barline glyph dir)
935 (let ((result (assoc glyph
936 '((":|:" . (":|" . "|:"))
939 ("|:" . ("|" . "|:"))
940 ("|." . ("|." . nil))
941 (".|" . (nil . ".|"))
942 (":|" . (":|" . nil))
943 ("||" . ("||" . nil))
944 (".|." . (".|." . nil))
945 ("scorebar" . (nil . "scorepostbreak"))
946 ("brace" . (nil . "brace"))
947 ("bracket" . (nil . "bracket"))
951 (if (equal? result #f)
952 (ly-warn (string-append "Unknown bar glyph: `" glyph "'"))
953 (index-cell (cdr result) dir))