1 #(set-global-staff-size 16)
5 ;; some helper functions
7 (define (filter-out pred lst)
8 (filter (lambda (x) (not (pred x))) lst))
10 (define (filter-out-group glyph-list substring)
11 (filter-out (lambda (x) (string-contains x substring)) glyph-list))
13 (define (filter-out-groups glyph-list . substrings)
14 (let loop ((new glyph-list) (rem substrings))
17 (loop (filter-out-group new (car rem))
20 (define (get-group glyph-list substring)
21 (filter (lambda (x) (string-contains x substring)) glyph-list))
25 (ly:otf-glyph-list (ly:system-font-load "emmentaler-20"))))
29 ;; define these 3 groups first since they're
30 ;; harder to get with (get-group ...)
32 '("plus" "comma" "hyphen" "period"
33 "zero" "one" "two" "three" "four"
34 "five" "six" "seven" "eight" "nine"))
36 (define default-noteheads
37 '("noteheads.uM2" "noteheads.dM2"
38 "noteheads.sM1" "noteheads.sM1double"
44 '("space" "f" "m" "p" "r" "s" "z"))
46 ;; remove them from the glyph-list
48 (lambda (x) (set! glyph-list (delete x glyph-list)))
55 ;; extract ancient-music groups before extracting default
56 ;; accidentals, rests, etc. to prevent duplication.
57 (define vaticana (get-group glyph-list "vaticana"))
58 (define medicaea (get-group glyph-list "medicaea"))
59 (define hufnagel (get-group glyph-list "hufnagel"))
60 (define neomensural (get-group glyph-list "neomensural"))
62 ;; remove neomensural before defining mensural; otherwise, searching
63 ;; for "mensural" would return "neomensural" matches too.
72 ;; get the rest of the ancient-music groups
73 (define mensural (get-group glyph-list "mensural"))
74 (define petrucci (get-group glyph-list "petrucci"))
75 (define solesmes (get-group glyph-list "solesmes"))
77 ;; remove them from the glyph-list
85 ;; This would only get "rests.2classical".
86 ;; We're leaving it with the other rests for now.
87 ;; (define classical (get-group glyph-list "classical"))
88 ;; (set! glyph-list (filter-out-groups glyph-list "classical"))
92 ;; get everything else except noteheads.
93 ;; * Some accidentals contain "slash" substring, so extract
94 ;; "accidentals" before extracting "slash" (noteheads).
95 ;; * Also use "pedal." not "pedal", for example, to prevent things
96 ;; like "scripts.upedalheel" ending up in the "pedal." list.
97 ;; * This doesn't apply to the ancient stuff because searching for
98 ;; "vaticana." (as an example) would miss things like
100 (define clefs (get-group glyph-list "clefs."))
101 (define timesig (get-group glyph-list "timesig."))
102 (define accidentals (get-group glyph-list "accidentals."))
103 (define rests (get-group glyph-list "rests."))
104 (define flags (get-group glyph-list "flags."))
105 (define dots (get-group glyph-list "dots."))
106 (define scripts (get-group glyph-list "scripts."))
107 (define arrowheads (get-group glyph-list "arrowheads."))
108 (define brackettips (get-group glyph-list "brackettips."))
109 (define pedal (get-group glyph-list "pedal."))
110 (define accordion (get-group glyph-list "accordion."))
112 ;; remove them from the glyph-list
130 ;; get special noteheads
131 (define cross (get-group glyph-list "cross"))
132 (define diamond (get-group glyph-list "diamond"))
133 (define harmonic (get-group glyph-list "harmonic"))
134 (define slash (get-group glyph-list "slash"))
135 (define triangle (get-group glyph-list "triangle"))
136 (define xcircle (get-group glyph-list "xcircle"))
138 (define special-noteheads
146 ;; remove special noteheads from the glyph-list
158 ;; any remaining glyphs containing "noteheads." should be shape-notes.
159 (define shape-note-noteheads (get-group glyph-list "noteheads."))
161 ;; remove shape-note-noteheads from the glyph-list
162 (set! glyph-list (filter-out-group glyph-list "noteheads."))
166 ;; simple debug test for any glyphs that didn't make it.
168 (if (null? glyph-list)
169 (format #t "No glyphs are missing from the table.\n")
170 (format #t "You missed these glyphs: ~a\n" glyph-list)))
172 ) % end of (begin ...)
175 %% ugh. text on toplevel is a bit broken...
177 oddHeaderMarkup = \markup {}
178 evenHeaderMarkup = \markup {}
179 oddFooterMarkup = \markup {}
180 evenFooterMarkup = \markup {}
185 #(define-markup-command (doc-char layout props name) (string?)
186 (interpret-markup layout props
187 (let* ((n (string-length name)))
189 ;; split long glyph names near the middle at dots
190 (let* ((middle-pos (round (/ n 2)))
191 (left-dot-pos (string-rindex name #\. 0 middle-pos))
192 (right-dot-pos (string-index name #\. middle-pos))
193 (left-distance (if (number? left-dot-pos)
194 (- middle-pos left-dot-pos)
196 (right-distance (if (number? right-dot-pos)
197 (- right-dot-pos middle-pos)
199 (split-pos (if (> left-distance right-distance)
202 (left (substring name 0 split-pos))
203 (right (substring name split-pos)))
205 #:pad-to-box '(0 . 36) '(-2 . 2) #:column (#:typewriter left
206 #:typewriter #:concat (" " right))
207 #:pad-to-box '(-2 . 4) '(-3.5 . 3.5) #:huge #:musicglyph name))
209 #:pad-to-box '(0 . 36) '(-2 . 2) #:typewriter name
210 #:pad-to-box '(-2 . 4) '(-3.5 . 3.5) #:huge #:musicglyph name)))))
212 #(define-markup-list-command (doc-chars layout props names) (list?)
213 (define (min-length lst n)
214 "(min (length lst) n)"
215 (if (or (null? lst) (<= n 0))
217 (1+ (min-length (cdr lst) (1- n)))))
218 (define (doc-chars-aux names acc)
219 (let* ((n (min-length names 2))
220 (head (take names n))
221 (tail (drop names n)))
225 (cons (make-line-markup (map make-doc-char-markup head))
227 (interpret-markup-list layout props (doc-chars-aux names (list))))