]> git.donarmstrong.com Git - lilypond.git/blob - input/manual/font-table.ly
Merge branch 'master' of ssh+git://gpercival@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / input / manual / font-table.ly
1 #(set-global-staff-size 16)
2
3 \paper {
4   %% ugh. text on toplevel is a bit broken...
5
6   oddHeaderMarkup = \markup {}
7   evenHeaderMarkup = \markup {}
8   oddFooterMarkup = \markup {}
9   evenFooterMarkup = \markup {}
10   }
11
12 \version "2.11.20"
13
14 #(define (doc-char name)
15    (let* ((n (string-length name)))
16      (if (> n 24)
17          ;; split long glyph names near the middle at dots
18          (let* ((middle-pos (round (/ n 2)))
19                 (left-dot-pos (string-rindex name #\. 0 middle-pos))
20                 (right-dot-pos (string-index name #\. middle-pos))
21                 (left-distance (if (number? left-dot-pos)
22                                    (- middle-pos left-dot-pos)
23                                    middle-pos))
24                 (right-distance (if (number? right-dot-pos)
25                                     (- right-dot-pos middle-pos)
26                                     middle-pos))
27                 (split-pos (if (> left-distance right-distance)
28                                right-dot-pos
29                                left-dot-pos))
30                 (left (substring name 0 split-pos))
31                 (right (substring name split-pos)))
32            (make-line-markup
33             (list
34              (make-pad-to-box-markup
35               '(0 . 36)
36               '(-2 . 2)
37               (make-column-markup
38                (list
39                 (make-typewriter-markup left)
40                 (make-typewriter-markup
41                  (make-concat-markup
42                   (list "  " right))))))
43              (make-pad-to-box-markup
44               '(-2 . 4)
45               '(-3.5 . 3.5)
46               (make-huge-markup (make-musicglyph-markup name))))))
47          (make-line-markup
48           (list
49            (make-pad-to-box-markup
50             '(0 . 36)
51             '(-2 . 2)
52             (make-typewriter-markup name))
53            (make-pad-to-box-markup
54             '(-2 . 4)
55             '(-3.5 . 3.5)
56             (make-huge-markup (make-musicglyph-markup name))))))))
57
58 #(define (min-length lst n)
59    "(min         (length lst) n)"
60    (if (or (null? lst) (<= n 0))
61        0
62        (1+ (min-length (cdr lst) (1- n)))))
63
64 #(define (doc-chars names acc)
65    (let*
66        ((n (min-length names 2))
67         (head (take names n))
68         (tail (drop names n)))
69      (if (null? head)
70          acc
71          (doc-chars tail
72                     (cons
73                      (make-line-markup (map doc-char head))
74                      acc)))))
75
76 #(define (group-lines lines)
77    (let*
78        ((n (min-length lines 25))
79         (head (take lines n))
80         (tail (drop lines n)))
81      (cons
82       (make-column-markup head)
83       (if (null? tail)
84           '()
85           (group-lines tail)))))
86
87 #(let*
88      ((glyphs (delete ".notdef"
89                       (ly:otf-glyph-list
90                        (ly:font-load "emmentaler-20"))))
91       (lines (doc-chars glyphs '()))
92       (pages (group-lines (reverse lines))))
93   (collect-scores-for-book
94    parser
95    (map (lambda (x)
96          (make-override-markup '(word-space . 4) x))
97     pages)))