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 name)
234 (not (not (memq name (ly-get-elt-property elt 'interfaces))))))
237 ;;;;;;;;;;;;;;;;;;; TeX output
238 (define (tex-scm action-name)
243 (define (select-font font-name-symbol)
246 (c (assoc font-name-symbol font-name-alist))
251 (ly-warn (string-append
252 "Programming error: No such font known " (car font-name-symbol)))
253 "") ; issue no command
254 (string-append "\\" (cdr c)))
259 (define (beam width slope thick)
260 (embedded-ps ((ps-scm 'beam) width slope thick)))
262 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
263 (embedded-ps ((ps-scm 'bracket) arch_angle arch_width arch_height width height arch_thick thick)))
265 (define (dashed-slur thick dash l)
266 (embedded-ps ((ps-scm 'dashed-slur) thick dash l)))
268 (define (crescendo thick w h cont)
269 (embedded-ps ((ps-scm 'crescendo) thick w h cont)))
272 (string-append "\\char" (inexact->string i 10) " "))
274 (define (dashed-line thick dash w)
275 (embedded-ps ((ps-scm 'dashed-line) thick dash w)))
277 (define (decrescendo thick w h cont)
278 (embedded-ps ((ps-scm 'decrescendo) thick w h cont)))
280 (define (font-load-command name-mag command)
282 "\\font\\" command "="
283 (symbol->string (car name-mag))
285 (number->string (magstep (cdr name-mag)))
288 (define (embedded-ps s)
289 (string-append "\\embeddedps{" s "}"))
292 (string-append "% " s))
296 ; uncomment for some stats about lily memory
297 ; (display (gc-stats))
298 (string-append "\n\\EndLilyPondOutput"
302 (define (experimental-on)
305 (define (font-switch i)
309 (define (font-def i s)
311 "\\font" (font-switch i) "=" s "\n"))
317 ;; URG: ly-gulp-file: now we can't use scm output without Lily
319 ;; fixed in 1.3.4 for powerpc -- broken on Windows
320 (regexp-substitute/global #f "\n"
321 (ly-gulp-file "lily.ps") 'pre " %\n" 'post)
322 (ly-gulp-file "lily.ps"))
324 "\\input lilyponddefs \\turnOnPostScript"))
326 (define (header creator generate)
328 "%created by: " creator generate "\n"))
330 (define (invoke-char s i)
332 "\n\\" s "{" (inexact->string i 10) "}" ))
334 (define (invoke-dim1 s d)
336 "\n\\" s "{" (number->dim d) "}"))
341 ;; need to do something to make this really safe.
343 (define (output-tex-string s)
344 (if security-paranoia
346 (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post)
347 (begin (display "warning: not paranoid") (newline) s))
350 (define (lily-def key val)
354 ;; fixed in 1.3.4 for powerpc -- broken on Windows
355 (regexp-substitute/global #f "_"
356 (output-tex-string key) 'pre "X" 'post)
357 (output-tex-string key))
358 "{" (output-tex-string val) "}\n"))
360 (define (number->dim x)
362 (ly-number->string x) " pt "))
364 (define (placebox x y s)
367 (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
369 (define (bezier-sandwich l thick)
370 (embedded-ps ((ps-scm 'bezier-sandwich) l thick)))
372 (define (start-line ht)
373 (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
376 "}\\vss}\\interscoreline")
377 (define (stop-last-line)
379 (define (filledbox breapth width depth height)
381 "\\kern" (number->dim (- breapth))
382 "\\vrule width " (number->dim (+ breapth width))
383 "depth " (number->dim depth)
384 "height " (number->dim height) " "))
387 (string-append "\\hbox{" (output-tex-string s) "}"))
389 (define (tuplet ht gapx dx dy thick dir)
390 (embedded-ps ((ps-scm 'tuplet) ht gapx dx dy thick dir)))
392 (define (volta h w thick vert_start vert_end)
393 (embedded-ps ((ps-scm 'volta) h w thick vert_start vert_end)))
396 ;; The procedures listed below form the public interface of TeX-scm.
397 ;; (should merge the 2 lists)
398 (cond ((eq? action-name 'all-definitions)
400 (define font-load-command ,font-load-command)
402 (define bezier-sandwich ,bezier-sandwich)
403 (define bracket ,bracket)
405 (define crescendo ,crescendo)
406 (define dashed-line ,dashed-line)
407 (define dashed-slur ,dashed-slur)
408 (define decrescendo ,decrescendo)
409 (define end-output ,end-output)
410 (define experimental-on ,experimental-on)
411 (define filledbox ,filledbox)
412 (define font-def ,font-def)
413 (define font-switch ,font-switch)
414 (define header-end ,header-end)
415 (define lily-def ,lily-def)
416 (define header ,header)
417 (define invoke-char ,invoke-char)
418 (define invoke-dim1 ,invoke-dim1)
419 (define placebox ,placebox)
420 (define select-font ,select-font)
421 (define start-line ,start-line)
422 (define stop-line ,stop-line)
423 (define stop-last-line ,stop-last-line)
425 (define tuplet ,tuplet)
426 (define volta ,volta)
429 ((eq? action-name 'beam) beam)
430 ((eq? action-name 'tuplet) tuplet)
431 ((eq? action-name 'bracket) bracket)
432 ((eq? action-name 'crescendo) crescendo)
433 ((eq? action-name 'dashed-line) dashed-line)
434 ((eq? action-name 'dashed-slur) dashed-slur)
435 ((eq? action-name 'decrescendo) decrescendo)
436 ((eq? action-name 'end-output) end-output)
437 ((eq? action-name 'experimental-on) experimental-on)
438 ((eq? action-name 'font-def) font-def)
439 ((eq? action-name 'font-switch) font-switch)
440 ((eq? action-name 'header-end) header-end)
441 ((eq? action-name 'lily-def) lily-def)
442 ((eq? action-name 'header) header)
443 ((eq? action-name 'invoke-char) invoke-char)
444 ((eq? action-name 'invoke-dim1) invoke-dim1)
445 ((eq? action-name 'placebox) placebox)
446 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
447 ((eq? action-name 'start-line) start-line)
448 ((eq? action-name 'stem) stem)
449 ((eq? action-name 'stop-line) stop-line)
450 ((eq? action-name 'stop-last-line) stop-last-line)
451 ((eq? action-name 'volta) volta)
452 (else (error "unknown tag -- PS-TEX " action-name))
458 (define (ps-scm action-name)
460 ;; alist containing fontname -> fontcommand assoc (both strings)
461 (define font-alist '())
462 (define font-count 0)
463 (define current-font "")
466 (define (cached-fontname i)
469 (make-string 1 (integer->char (+ 65 i)))))
471 (define (mag-to-size m)
472 (number->string (case m
475 (2 14) ; really: 14.400
476 (3 17) ; really: 17.280
477 (4 21) ; really: 20.736
478 (5 24) ; really: 24.888
479 (6 30) ; really: 29.856
483 (define (select-font font-name-symbol)
486 (c (assoc font-name-symbol font-name-alist))
491 (ly-warn (string-append
492 "Programming error: No such font known " (car font-name-symbol)))
493 "") ; issue no command
494 (string-append " " (cdr c) " "))
499 (define (font-load-command name-mag command)
503 (symbol->string (car name-mag))
505 (number->string (magstep (cdr name-mag)))
506 " 1000 div 12 mul scalefont setfont } bind def "
510 (define (beam width slope thick)
512 (numbers->string (list width slope thick)) " draw_beam" ))
515 (string-append "% " s))
517 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
519 (numbers->string (list arch_angle arch_width arch_height width height arch_thick thick)) " draw_bracket" ))
522 (invoke-char " show" i))
524 (define (crescendo thick w h cont )
526 (numbers->string (list w h (inexact->exact cont) thick))
529 ;; what the heck is this interface ?
530 (define (dashed-slur thick dash l)
532 (apply string-append (map control->string l))
533 (number->string thick)
535 (number->string dash)
537 (number->string (* 10 thick)) ;UGH. 10 ?
538 " ] 0 draw_dashed_slur"))
540 (define (dashed-line thick dash width)
542 (number->string width)
544 (number->string thick)
546 (number->string dash)
548 (number->string dash)
549 " ] 0 draw_dashed_line"))
551 (define (decrescendo thick w h cont)
553 (numbers->string (list w h (inexact->exact cont) thick))
554 " draw_decrescendo"))
560 (define (experimental-on) "")
562 (define (filledbox breapth width depth height)
563 (string-append (numbers->string (list breapth width depth height))
567 (define (font-def i s)
570 (substring s 0 (- (string-length s) 4))
571 " findfont 12 scalefont setfont} bind def \n"))
573 (define (font-switch i)
574 (string-append (font i) " "))
578 ;; URG: now we can't use scm output without Lily
579 (ly-gulp-file "lilyponddefs.ps")
580 " {exch pop //systemdict /run get exec} "
581 (ly-gulp-file "lily.ps")
582 "{ exch pop //systemdict /run get exec } "
585 (define (lily-def key val)
587 (if (string=? (substring key 0 (min (string-length "mudelapaper") (string-length key))) "mudelapaper")
588 (string-append "/" key " {" val "} bind def\n")
589 (string-append "/" key " (" val ") def\n")
593 (define (header creator generate)
596 "%%Creator: " creator generate "\n"))
598 (define (invoke-char s i)
600 "(\\" (inexact->string i 8) ") " s " " ))
602 (define (invoke-dim1 s d)
604 (number->string (* d (/ 72.27 72))) " " s ))
606 (define (placebox x y s)
608 (number->string x) " " (number->string y) " {" s "} placebox "))
610 (define (bezier-sandwich l thick)
612 (apply string-append (map control->string l))
613 (number->string thick)
614 " draw_bezier_sandwich"))
616 (define (start-line height)
619 (define (stem breapth width depth height)
620 (string-append (numbers->string (list breapth width depth height))
627 (string-append "(" s ") show "))
630 (define (volta h w thick vert_start vert_end)
632 (numbers->string (list h w thick (inexact->exact vert_start) (inexact->exact vert_end)))
635 (define (tuplet ht gap dx dy thick dir)
637 (numbers->string (list ht gap dx dy thick (inexact->exact dir)))
646 (cond ((eq? action-name 'all-definitions)
649 (define tuplet ,tuplet)
650 (define bracket ,bracket)
652 (define crescendo ,crescendo)
653 (define volta ,volta)
654 (define bezier-sandwich ,bezier-sandwich)
655 (define dashed-line ,dashed-line)
656 (define dashed-slur ,dashed-slur)
657 (define decrescendo ,decrescendo)
658 (define end-output ,end-output)
659 (define experimental-on ,experimental-on)
660 (define filledbox ,filledbox)
661 (define font-def ,font-def)
662 (define font-switch ,font-switch)
663 (define header-end ,header-end)
664 (define lily-def ,lily-def)
665 (define font-load-command ,font-load-command)
666 (define header ,header)
667 (define invoke-char ,invoke-char)
668 (define invoke-dim1 ,invoke-dim1)
669 (define placebox ,placebox)
670 (define select-font ,select-font)
671 (define start-line ,start-line)
673 (define stop-line ,stop-line)
674 (define stop-last-line ,stop-line)
677 ((eq? action-name 'tuplet) tuplet)
678 ((eq? action-name 'beam) beam)
679 ((eq? action-name 'bezier-sandwich) bezier-sandwich)
680 ((eq? action-name 'bracket) bracket)
681 ((eq? action-name 'char) char)
682 ((eq? action-name 'crescendo) crescendo)
683 ((eq? action-name 'dashed-line) dashed-line)
684 ((eq? action-name 'dashed-slur) dashed-slur)
685 ((eq? action-name 'decrescendo) decrescendo)
686 ((eq? action-name 'experimental-on) experimental-on)
687 ((eq? action-name 'filledbox) filledbox)
688 ((eq? action-name 'select-font) select-font)
689 ((eq? action-name 'volta) volta)
690 (else (error "unknown tag -- PS-SCM " action-name))
695 (define (arg->string arg)
696 (cond ((number? arg) (inexact->string arg 10))
697 ((string? arg) (string-append "\"" arg "\""))
698 ((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
700 (define (func name . args)
706 (map (lambda (x) (string-append " " (arg->string x))) args)))
712 (inexact->exact (/ x (abs x)))))
715 (define (as-scm action-name)
717 (define (beam width slope thick)
719 (func "set-line-char" "#")
720 (func "rline-to" width (* width slope))
724 (define (bezier-sandwich l thick)
731 (dy (- (cdr c3) (cdr c0)))
733 (c1-dx (- (car c1) x))
734 (c1-line-y (+ (cdr c0) (* c1-dx rc)))
735 (dir (if (< c1-line-y (cdr c1)) 1 -1))
736 (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
738 (func "rmove-to" x y)
739 (func "put" (if (< 0 dir) "/" "\\\\"))
740 (func "rmove-to" 1 (if (< 0 dir) 1 0))
741 (func "set-line-char" "_")
742 (func "h-line" (- dx 1))
743 (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
744 (func "put" (if (< 0 dir) "\\\\" "/"))))))
746 (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
748 (func "rmove-to" (+ width 1) (- (/ height -2) 1))
750 (func "set-line-char" "|")
751 (func "rmove-to" 0 1)
752 (func "v-line" (+ height 1))
753 (func "rmove-to" 0 (+ height 1))
763 (define (experimental-on)
766 (define (filledbox breapth width depth height)
767 (let ((dx (+ width breapth))
768 (dy (+ depth height)))
770 (func "rmove-to" (* -1 breapth) (* -1 depth))
773 (func "set-line-char"
774 (if (<= dx 1) "|" "#"))
777 (func "set-line-char"
778 (if (<= dy 1) "-" "="))
779 (func "h-line" dx))))))
781 (define (font-load-command name-mag command)
782 (func "load-font" (car name-mag) (magstep (cdr name-mag))))
784 (define (header creator generate)
785 (func "header" creator generate))
790 ;; urg: this is good for half of as2text's execution time
791 (define (xlily-def key val)
792 (string-append "(define " key " " (arg->string val) ")\n"))
794 (define (lily-def key val)
796 (or (equal? key "mudelapaperlinewidth")
797 (equal? key "mudelapaperstaffheight"))
798 (string-append "(define " key " " (arg->string val) ")\n")
801 (define (placebox x y s)
802 (let ((ey (inexact->exact y)))
803 (string-append "(move-to " (number->string (inexact->exact x)) " "
804 (if (= 0.5 (- (abs y) (abs ey)))
809 (define (select-font font-name-symbol)
810 (let* ((c (assoc font-name-symbol font-name-alist)))
815 "Programming error: No such font known "
816 (car font-name-symbol)))
817 "") ; issue no command
818 (func "select-font" (car font-name-symbol)))))
820 (define (start-line height)
821 (func "start-line" height))
829 (define (volta h w thick vert-start vert-end)
832 (func "set-line-char" "|")
833 (func "rmove-to" 0 -4)
834 ;; definition strange-way around
838 (func "rmove-to" 1 h)
839 (func "set-line-char" "_")
840 (func "h-line" (- w 1))
841 (func "set-line-char" "|")
844 (func "rmove-to" (- w 1) (* -1 h))
845 (func "v-line" (* -1 h)))
848 (cond ((eq? action-name 'all-definitions)
851 (define bracket ,bracket)
853 ;;(define crescendo ,crescendo)
854 (define bezier-sandwich ,bezier-sandwich)
855 ;;(define dashed-slur ,dashed-slur)
856 ;;(define decrescendo ,decrescendo)
857 (define end-output ,end-output)
858 (define experimental-on ,experimental-on)
859 (define filledbox ,filledbox)
860 ;;(define font-def ,font-def)
861 (define font-load-command ,font-load-command)
862 ;;(define font-switch ,font-switch)
863 (define header ,header)
864 (define header-end ,header-end)
865 (define lily-def ,lily-def)
866 ;;(define invoke-char ,invoke-char)
867 ;;(define invoke-dim1 ,invoke-dim1)
868 (define placebox ,placebox)
869 (define select-font ,select-font)
870 (define start-line ,start-line)
871 ;;(define stem ,stem)
872 (define stop-line ,stop-line)
873 (define stop-last-line ,stop-line)
875 ;;(define tuplet ,tuplet)
876 (define volta ,volta)
878 ;;((eq? action-name 'tuplet) tuplet)
879 ;;((eq? action-name 'beam) beam)
880 ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
881 ;;((eq? action-name 'bracket) bracket)
882 ((eq? action-name 'char) char)
883 ;;((eq? action-name 'crescendo) crescendo)
884 ;;((eq? action-name 'dashed-slur) dashed-slur)
885 ;;((eq? action-name 'decrescendo) decrescendo)
886 ;;((eq? action-name 'experimental-on) experimental-on)
887 ((eq? action-name 'filledbox) filledbox)
888 ((eq? action-name 'select-font) select-font)
889 ;;((eq? action-name 'volta) volta)
890 (else (error "unknown tag -- MUSA-SCM " action-name))
895 (define (gulp-file name)
896 (let* ((port (open-file name "r"))
897 (content (let loop ((text ""))
898 (let ((line (read-line port)))
899 (if (or (eof-object? line)
902 (loop (string-append text line "\n")))))))
906 ;; urg: Use when standalone, do:
907 ;; (define ly-gulp-file scm-gulp-file)
908 (define (scm-gulp-file name)
910 (cons (string-append (getenv 'LILYPONDPREFIX) "/ly")
911 (cons (string-append (getenv 'LILYPONDPREFIX) "/ps")
913 (let ((path (%search-load-path name)))
918 (define (scm-tex-output)
919 (eval (tex-scm 'all-definitions)))
921 (define (scm-ps-output)
922 (eval (ps-scm 'all-definitions)))
924 (define (scm-as-output)
925 (eval (as-scm 'all-definitions)))
927 (define (index-cell cell dir)
933 ; How should a bar line behave at a break?
935 (define (break-barline glyph dir)
936 (let ((result (assoc glyph
937 '((":|:" . (":|" . "|:"))
940 ("|:" . ("|" . "|:"))
941 ("|." . ("|." . nil))
942 (".|" . (nil . ".|"))
943 (":|" . (":|" . nil))
944 ("||" . ("||" . nil))
945 (".|." . (".|." . nil))
946 ("scorebar" . (nil . "scorepostbreak"))
947 ("brace" . (nil . "brace"))
948 ("bracket" . (nil . "bracket"))
952 (if (equal? result #f)
953 (ly-warn (string-append "Unknown bar glyph: `" glyph "'"))
954 (index-cell (cdr result) dir))