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))
140 (define (find-notehead-symbol duration style)
143 ((harmonic) "0mensural")
145 (string-append (number->string duration)
146 (if (< duration 0) "mensural" "")))
147 ((default) (number->string duration))
149 (string-append (number->string duration) (symbol->string style)))))
154 ;; this is silly, can't we use something like
155 ;; roman-0, roman-1 roman+1 ?
158 ("brace" . "feta-braces")
159 ("default" . "cmr10")
160 ("dynamic" . "feta-din")
164 ("typewriter" . "cmtt")
171 ("mark" . "feta-nummer")
172 ("finger" . "feta-nummer")
173 ("timesig" . "feta-nummer")
174 ("number" . "feta-nummer")
175 ("volta" . "feta-nummer"))
178 (define (string-encode-integer i)
181 ((< i 0) (string-append "n" (string-encode-integer (- i))))
183 (make-string 1 (integer->char (+ 65 (modulo i 26))))
184 (string-encode-integer (quotient i 26))
191 (cdr (assoc i '((-4 . 482)
204 (define script-alist '())
206 (define font-name-alist '())
207 (define (font-command name-mag)
209 (string-append "magfont"
210 (string-encode-integer (hashq (car name-mag) 1000000))
212 (string-encode-integer (cdr name-mag)))
216 (define (define-fonts names)
217 (set! font-name-alist (map font-command names))
220 (font-load-command (car x) (cdr x))) font-name-alist)
223 (define (fontify name exp)
224 (string-append (select-font name)
231 ; Make a function that checks score element for being of a specific type.
232 (define (make-type-checker symbol)
235 (if (eq? #t (ly-get-elt-property elt symbol))
243 ;;;;;;;;;;;;;;;;;;; TeX output
244 (define (tex-scm action-name)
249 (define (select-font font-name-symbol)
252 (c (assoc font-name-symbol font-name-alist))
257 (ly-warn (string-append
258 "Programming error: No such font known " (car font-name-symbol)))
259 "") ; issue no command
260 (string-append "\\" (cdr c)))
265 (define (beam width slope thick)
266 (embedded-ps ((ps-scm 'beam) width slope thick)))
268 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
269 (embedded-ps ((ps-scm 'bracket) arch_angle arch_width arch_height width height arch_thick thick)))
271 (define (dashed-slur thick dash l)
272 (embedded-ps ((ps-scm 'dashed-slur) thick dash l)))
274 (define (crescendo thick w h cont)
275 (embedded-ps ((ps-scm 'crescendo) thick w h cont)))
278 (string-append "\\char" (inexact->string i 10) " "))
280 (define (dashed-line thick dash w)
281 (embedded-ps ((ps-scm 'dashed-line) thick dash w)))
283 (define (decrescendo thick w h cont)
284 (embedded-ps ((ps-scm 'decrescendo) thick w h cont)))
286 (define (font-load-command name-mag command)
288 "\\font\\" command "="
289 (symbol->string (car name-mag))
291 (number->string (magstep (cdr name-mag)))
294 (define (embedded-ps s)
295 (string-append "\\embeddedps{" s "}"))
298 (string-append "% " s))
302 ; uncomment for some stats about lily memory
303 ; (display (gc-stats))
304 (string-append "\n\\EndLilyPondOutput"
308 (define (experimental-on)
311 (define (font-switch i)
315 (define (font-def i s)
317 "\\font" (font-switch i) "=" s "\n"))
323 ;; URG: ly-gulp-file: now we can't use scm output without Lily
325 ;; fixed in 1.3.4 for powerpc -- broken on Windows
326 (regexp-substitute/global #f "\n"
327 (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
328 (ly-gulp-file "lily.ps"))
330 "\\input lilyponddefs \\turnOnPostScript"))
332 (define (header creator generate)
334 "%created by: " creator generate "\n"))
336 (define (invoke-char s i)
338 "\n\\" s "{" (inexact->string i 10) "}" ))
340 (define (invoke-dim1 s d)
342 "\n\\" s "{" (number->dim d) "}"))
347 ;; need to do something to make this really safe.
349 (define (output-tex-string s)
350 (if security-paranoia
352 (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post)
353 (begin (display "warning: not paranoid") (newline) s))
356 (define (lily-def key val)
360 ;; fixed in 1.3.4 for powerpc -- broken on Windows
361 (regexp-substitute/global #f "_"
362 (output-tex-string key) 'pre "X" 'post)
363 (output-tex-string key))
364 "{" (output-tex-string val) "}\n"))
366 (define (number->dim x)
368 (ly-number->string x) " pt "))
370 (define (placebox x y s)
373 (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
375 (define (bezier-sandwich l thick)
376 (embedded-ps ((ps-scm 'bezier-sandwich) l thick)))
378 (define (start-line ht)
379 (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
382 "}\\vss}\\interscoreline\n")
383 (define (stop-last-line)
385 (define (filledbox breapth width depth height)
387 "\\kern" (number->dim (- breapth))
388 "\\vrule width " (number->dim (+ breapth width))
389 "depth " (number->dim depth)
390 "height " (number->dim height) " "))
393 (string-append "\\hbox{" (output-tex-string s) "}"))
395 (define (tuplet ht gapx dx dy thick dir)
396 (embedded-ps ((ps-scm 'tuplet) ht gapx dx dy thick dir)))
398 (define (volta h w thick vert_start vert_end)
399 (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end)))
402 ;; The procedures listed below form the public interface of TeX-scm.
403 ;; (should merge the 2 lists)
404 (cond ((eq? action-name 'all-definitions)
406 (define font-load-command ,font-load-command)
408 (define bezier-sandwich ,bezier-sandwich)
409 (define bracket ,bracket)
411 (define crescendo ,crescendo)
412 (define dashed-line ,dashed-line)
413 (define dashed-slur ,dashed-slur)
414 (define decrescendo ,decrescendo)
415 (define end-output ,end-output)
416 (define experimental-on ,experimental-on)
417 (define filledbox ,filledbox)
418 (define font-def ,font-def)
419 (define font-switch ,font-switch)
420 (define header-end ,header-end)
421 (define lily-def ,lily-def)
422 (define header ,header)
423 (define invoke-char ,invoke-char)
424 (define invoke-dim1 ,invoke-dim1)
425 (define placebox ,placebox)
426 (define select-font ,select-font)
427 (define start-line ,start-line)
428 (define stop-line ,stop-line)
429 (define stop-last-line ,stop-last-line)
431 (define tuplet ,tuplet)
432 (define volta ,volta)
435 ((eq? action-name 'beam) beam)
436 ((eq? action-name 'tuplet) tuplet)
437 ((eq? action-name 'bracket) bracket)
438 ((eq? action-name 'crescendo) crescendo)
439 ((eq? action-name 'dashed-line) dashed-line)
440 ((eq? action-name 'dashed-slur) dashed-slur)
441 ((eq? action-name 'decrescendo) decrescendo)
442 ((eq? action-name 'end-output) end-output)
443 ((eq? action-name 'experimental-on) experimental-on)
444 ((eq? action-name 'font-def) font-def)
445 ((eq? action-name 'font-switch) font-switch)
446 ((eq? action-name 'header-end) header-end)
447 ((eq? action-name 'lily-def) lily-def)
448 ((eq? action-name 'header) header)
449 ((eq? action-name 'invoke-char) invoke-char)
450 ((eq? action-name 'invoke-dim1) invoke-dim1)
451 ((eq? action-name 'placebox) placebox)
452 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
453 ((eq? action-name 'start-line) start-line)
454 ((eq? action-name 'stem) stem)
455 ((eq? action-name 'stop-line) stop-line)
456 ((eq? action-name 'stop-last-line) stop-last-line)
457 ((eq? action-name 'volta) volta)
458 (else (error "unknown tag -- PS-TEX " action-name))
464 (define (ps-scm action-name)
466 ;; alist containing fontname -> fontcommand assoc (both strings)
467 (define font-alist '())
468 (define font-count 0)
469 (define current-font "")
472 (define (cached-fontname i)
475 (make-string 1 (integer->char (+ 65 i)))))
477 (define (mag-to-size m)
478 (number->string (case m
481 (2 14) ; really: 14.400
482 (3 17) ; really: 17.280
483 (4 21) ; really: 20.736
484 (5 24) ; really: 24.888
485 (6 30) ; really: 29.856
489 (define (select-font font-name-symbol)
492 (c (assoc font-name-symbol font-name-alist))
497 (ly-warn (string-append
498 "Programming error: No such font known " (car font-name-symbol)))
499 "") ; issue no command
500 (string-append " " (cdr c) " "))
505 (define (font-load-command name-mag command)
509 (symbol->string (car name-mag))
511 (number->string (magstep (cdr name-mag)))
512 " 1000 div 12 mul scalefont setfont } bind def "
516 (define (beam width slope thick)
518 (numbers->string (list width slope thick)) " draw_beam" ))
521 (string-append "% " s))
523 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
525 (numbers->string (list arch_angle arch_width arch_height width height arch_thick thick)) " draw_bracket" ))
528 (invoke-char " show" i))
530 (define (crescendo thick w h cont )
532 (numbers->string (list w h (inexact->exact cont) thick))
535 ;; what the heck is this interface ?
536 (define (dashed-slur thick dash l)
538 (apply string-append (map control->string l))
539 (number->string thick)
541 (number->string dash)
543 (number->string (* 10 thick)) ;UGH. 10 ?
544 " ] 0 draw_dashed_slur"))
546 (define (dashed-line thick dash width)
548 (number->string width)
550 (number->string thick)
552 (number->string dash)
554 (number->string dash)
555 " ] 0 draw_dashed_line"))
557 (define (decrescendo thick w h cont)
559 (numbers->string (list w h (inexact->exact cont) thick))
560 " draw_decrescendo"))
566 (define (experimental-on) "")
568 (define (filledbox breapth width depth height)
569 (string-append (numbers->string (list breapth width depth height))
573 (define (font-def i s)
576 (substring s 0 (- (string-length s) 4))
577 " findfont 12 scalefont setfont} bind def \n"))
579 (define (font-switch i)
580 (string-append (font i) " "))
584 ;; URG: now we can't use scm output without Lily
585 (ly-gulp-file "lilyponddefs.ps")
586 " {exch pop //systemdict /run get exec} "
587 (ly-gulp-file "lily.ps")
588 "{ exch pop //systemdict /run get exec } "
591 (define (lily-def key val)
593 (if (string=? (substring key 0 (min (string-length "mudelapaper") (string-length key))) "mudelapaper")
594 (string-append "/" key " {" val "} bind def\n")
595 (string-append "/" key " (" val ") def\n")
599 (define (header creator generate)
602 "%%Creator: " creator generate "\n"))
604 (define (invoke-char s i)
606 "(\\" (inexact->string i 8) ") " s " " ))
608 (define (invoke-dim1 s d)
610 (number->string (* d (/ 72.27 72))) " " s ))
612 (define (placebox x y s)
614 (number->string x) " " (number->string y) " {" s "} placebox "))
616 (define (bezier-sandwich l thick)
618 (apply string-append (map control->string l))
619 (number->string thick)
620 " draw_bezier_sandwich"))
622 (define (start-line height)
625 (define (stem breapth width depth height)
626 (string-append (numbers->string (list breapth width depth height))
633 (string-append "(" s ") show "))
636 (define (volta h w thick vert_start vert_end)
638 (numbers->string (list h w thick (inexact->exact vert_start) (inexact->exact vert_end)))
641 (define (tuplet ht gap dx dy thick dir)
643 (numbers->string (list ht gap dx dy thick (inexact->exact dir)))
652 (cond ((eq? action-name 'all-definitions)
655 (define tuplet ,tuplet)
656 (define bracket ,bracket)
658 (define crescendo ,crescendo)
659 (define volta ,volta)
660 (define bezier-sandwich ,bezier-sandwich)
661 (define dashed-line ,dashed-line)
662 (define dashed-slur ,dashed-slur)
663 (define decrescendo ,decrescendo)
664 (define end-output ,end-output)
665 (define experimental-on ,experimental-on)
666 (define filledbox ,filledbox)
667 (define font-def ,font-def)
668 (define font-switch ,font-switch)
669 (define header-end ,header-end)
670 (define lily-def ,lily-def)
671 (define font-load-command ,font-load-command)
672 (define header ,header)
673 (define invoke-char ,invoke-char)
674 (define invoke-dim1 ,invoke-dim1)
675 (define placebox ,placebox)
676 (define select-font ,select-font)
677 (define start-line ,start-line)
679 (define stop-line ,stop-line)
680 (define stop-last-line ,stop-line)
683 ((eq? action-name 'tuplet) tuplet)
684 ((eq? action-name 'beam) beam)
685 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
686 ((eq? action-name 'bracket) bracket)
687 ((eq? action-name 'char) char)
688 ((eq? action-name 'crescendo) crescendo)
689 ((eq? action-name 'dashed-line) dashed-line)
690 ((eq? action-name 'dashed-slur) dashed-slur)
691 ((eq? action-name 'decrescendo) decrescendo)
692 ((eq? action-name 'experimental-on) experimental-on)
693 ((eq? action-name 'filledbox) filledbox)
694 ((eq? action-name 'select-font) select-font)
695 ((eq? action-name 'volta) volta)
696 (else (error "unknown tag -- PS-SCM " action-name))
701 (define (arg->string arg)
702 (cond ((number? arg) (inexact->string arg 10))
703 ((string? arg) (string-append "\"" arg "\""))
704 ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
706 (define (func name . args)
712 (map (lambda (x) (string-append " " (arg->string x))) args)))
718 (inexact->exact (/ x (abs x)))))
721 (define (as-scm action-name)
723 (define (beam width slope thick)
725 (func "set-line-char" "#")
726 (func "rline-to" width (* width slope))
730 (define (bezier-sandwich l thick)
737 (dy (- (cdr c3) (cdr c0)))
739 (c1-dx (- (car c1) x))
740 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
741 (dir (if (< c1-line-y (cdr c1)) 1 -1))
742 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
744 (func "rmove-to" x y)
745 (func "put" (if (< 0 dir) "/" "\\\\"))
746 (func "rmove-to" 1 (if (< 0 dir) 1 0))
747 (func "set-line-char" "_")
748 (func "h-line" (- dx 1))
749 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
750 (func "put" (if (< 0 dir) "\\\\" "/"))))))
752 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
754 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
756 (func "set-line-char" "|")
757 (func "rmove-to" 0 1)
758 (func "v-line" (+ height 1))
759 (func "rmove-to" 0 (+ height 1))
769 (define (experimental-on)
772 (define (filledbox breapth width depth height)
773 (let ((dx (+ width breapth))
774 (dy (+ depth height)))
776 (func "rmove-to" (* -1 breapth) (* -1 depth))
779 (func "set-line-char"
780 (if (<= dx 1) "|" "#"))
783 (func "set-line-char"
784 (if (<= dy 1) "-" "="))
785 (func "h-line" dx))))))
787 (define (font-load-command name-mag command)
788 (func "load-font" (car name-mag) (magstep (cdr name-mag))))
790 (define (header creator generate)
791 (func "header" creator generate))
796 ;; urg: this is good for half of as2text's execution time
797 (define (xlily-def key val)
798 (string-append "(define " key " " (arg->string val) ")\n"))
800 (define (lily-def key val)
802 (or (equal? key "mudelapaperlinewidth")
803 (equal? key "mudelapaperstaffheight"))
804 (string-append "(define " key " " (arg->string val) ")\n")
807 (define (placebox x y s)
808 (let ((ey (inexact->exact y)))
809 (string-append "(move-to " (number->string (inexact->exact x)) " "
810 (if (= 0.5 (- (abs y) (abs ey)))
815 (define (select-font font-name-symbol)
816 (let* ((c (assoc font-name-symbol font-name-alist)))
821 "Programming error: No such font known "
822 (car font-name-symbol)))
823 "") ; issue no command
824 (func "select-font" (car font-name-symbol)))))
826 (define (start-line height)
827 (func "start-line" height))
835 (define (volta h w thick vert-start vert-end)
838 (func "set-line-char" "|")
839 (func "rmove-to" 0 -4)
840 ;; definition strange-way around
844 (func "rmove-to" 1 h)
845 (func "set-line-char" "_")
846 (func "h-line" (- w 1))
847 (func "set-line-char" "|")
850 (func "rmove-to" (- w 1) (* -1 h))
851 (func "v-line" (* -1 h)))
854 (cond ((eq? action-name 'all-definitions)
857 (define bracket ,bracket)
859 ;;(define crescendo ,crescendo)
860 (define bezier-sandwich ,bezier-sandwich)
861 ;;(define dashed-slur ,dashed-slur)
862 ;;(define decrescendo ,decrescendo)
863 (define end-output ,end-output)
864 (define experimental-on ,experimental-on)
865 (define filledbox ,filledbox)
866 ;;(define font-def ,font-def)
867 (define font-load-command ,font-load-command)
868 ;;(define font-switch ,font-switch)
869 (define header ,header)
870 (define header-end ,header-end)
871 (define lily-def ,lily-def)
872 ;;(define invoke-char ,invoke-char)
873 ;;(define invoke-dim1 ,invoke-dim1)
874 (define placebox ,placebox)
875 (define select-font ,select-font)
876 (define start-line ,start-line)
877 ;;(define stem ,stem)
878 (define stop-line ,stop-line)
879 (define stop-last-line ,stop-line)
881 ;;(define tuplet ,tuplet)
882 (define volta ,volta)
884 ;;((eq? action-name 'tuplet) tuplet)
885 ;;((eq? action-name 'beam) beam)
886 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
887 ;;((eq? action-name 'bracket) bracket)
888 ((eq? action-name 'char) char)
889 ;;((eq? action-name 'crescendo) crescendo)
890 ;;((eq? action-name 'dashed-slur) dashed-slur)
891 ;;((eq? action-name 'decrescendo) decrescendo)
892 ;;((eq? action-name 'experimental-on) experimental-on)
893 ((eq? action-name 'filledbox) filledbox)
894 ((eq? action-name 'select-font) select-font)
895 ;;((eq? action-name 'volta) volta)
896 (else (error "unknown tag -- MUSA-SCM " action-name))
901 (define (gulp-file name)
902 (let* ((port (open-file name "r"))
903 (content (let loop ((text ""))
904 (let ((line (read-line port)))
905 (if (or (eof-object? line)
908 (loop (string-append text line "\n")))))))
912 ;; urg: Use when standalone, do:
913 ;; (define ly-gulp-file scm-gulp-file)
914 (define (scm-gulp-file name)
916 (cons (string-append (getenv 'LILYPONDPREFIX) "/ly")
917 (cons (string-append (getenv 'LILYPONDPREFIX) "/ps")
919 (let ((path (%search-load-path name)))
924 (define (scm-tex-output)
925 (eval (tex-scm 'all-definitions)))
927 (define (scm-ps-output)
928 (eval (ps-scm 'all-definitions)))
930 (define (scm-as-output)
931 (eval (as-scm 'all-definitions)))
933 (define (index-cell cell dir)
939 ; How should a bar line behave at a break?
941 (define (break-barline glyph dir)
942 (let ((result (assoc glyph
943 '((":|:" . (":|" . "|:"))
946 ("|:" . ("|" . "|:"))
947 ("|." . ("|." . nil))
948 (".|" . (nil . ".|"))
949 (":|" . (":|" . nil))
950 ("||" . ("||" . nil))
951 (".|." . (".|." . nil))
952 ("scorebar" . (nil . "scorepostbreak"))
953 ("brace" . (nil . "brace"))
954 ("bracket" . (nil . "bracket"))
958 (if (equal? result #f)
959 (ly-warn (string-append "Unknown bar glyph: `" glyph "'"))
960 (index-cell (cdr result) dir))