1 ;;;; translation-functions.scm --
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 1998--2006 Han-Wen Nienhuys <hanwen@cs.uu.nl>
6 ;;;; Jan Nieuwenhuizen <janneke@gnu.org>
9 (define-public (format-metronome-markup event context)
10 (let* ((dur (ly:music-property event 'tempo-unit))
11 (count (ly:music-property event 'metronome-count))
12 (note-mark (make-smaller-markup
13 (make-note-by-number-markup (ly:duration-log dur)
14 (ly:duration-dot-count dur)
18 (make-general-align-markup Y DOWN note-mark)
19 (make-simple-markup "=")
20 (make-simple-markup (number->string count))))))
22 (define-public (format-mark-alphabet mark context)
23 (make-bold-markup (make-markalphabet-markup (1- mark))))
25 (define-public (format-mark-box-alphabet mark context)
26 (make-bold-markup (make-box-markup (make-markalphabet-markup (1- mark)))))
28 (define-public (format-mark-circle-alphabet mark context)
29 (make-bold-markup (make-circle-markup (make-markalphabet-markup (1- mark)))))
31 (define-public (format-mark-letters mark context)
32 (make-bold-markup (make-markletter-markup (1- mark))))
34 (define-public (format-mark-numbers mark context)
35 (make-bold-markup (number->string mark)))
37 (define-public (format-mark-barnumbers mark context)
38 (make-bold-markup (number->string (ly:context-property context 'currentBarNumber))))
40 (define-public (format-mark-box-letters mark context)
41 (make-bold-markup (make-box-markup (make-markletter-markup (1- mark)))))
43 (define-public (format-mark-circle-letters mark context)
44 (make-bold-markup (make-circle-markup (make-markletter-markup (1- mark)))))
46 (define-public (format-mark-box-numbers mark context)
47 (make-bold-markup (make-box-markup (number->string mark))))
49 (define-public (format-mark-circle-numbers mark context)
50 (make-bold-markup (make-circle-markup (number->string mark))))
52 (define-public (format-mark-box-barnumbers mark context)
53 (make-bold-markup (make-box-markup
54 (number->string (ly:context-property context 'currentBarNumber)))))
56 (define-public (format-mark-circle-barnumbers mark context)
57 (make-bold-markup (make-circle-markup
58 (number->string (ly:context-property context 'currentBarNumber)))))
61 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
65 (define-public (format-bass-figure figure stream-event context)
66 (let* ((event (ly:event-property stream-event 'music-cause ))
67 (fig (ly:music-property event 'figure))
68 (fig-markup (if (number? figure)
70 ;; this is not very elegant, but center-aligning all digits
71 ;; is problematic with other markups, and shows problems
72 ;; in the (lack of) overshoot of feta alphabet glyphs.
75 (lambda (y) (make-translate-scaled-markup (cons -0.7 0) y))
78 (if (eq? #t (ly:music-property event 'diminished))
79 (markup #:slashed-digit figure)
80 (markup #:number (number->string figure 10))))
83 (alt (ly:music-property event 'alteration))
87 #:general-align Y DOWN #:fontsize
88 (if (not (= alt DOUBLE-SHARP))
90 (alteration->text-accidental-markup alt))
93 (plus-markup (if (eq? #t (ly:music-property event 'augmented))
97 (alt-dir (ly:context-property context 'figuredBassAlterationDirection))
98 (plus-dir (ly:context-property context 'figuredBassPlusDirection))
101 (if (and (not fig-markup) alt-markup)
103 (set! fig-markup (markup #:left-align #:pad-around 0.3 alt-markup))
104 (set! alt-markup #f)))
107 ;; hmm, how to get figures centered between note, and
108 ;; lone accidentals too?
110 ;; (if (markup? fig-markup)
112 ;; fig-markup (markup #:translate (cons 1.0 0)
113 ;; #:hcenter fig-markup)))
117 (markup #:put-adjacent
119 (if (number? alt-dir)
122 #:pad-x 0.2 alt-markup
129 (markup #:put-adjacent
131 X (if (number? plus-dir)
134 #:pad-x 0.2 plus-markup)
137 (if (markup? fig-markup)
138 (markup #:fontsize -2 fig-markup)