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 event context)
66 (let* ((fig (ly:music-property event 'figure))
67 (fig-markup (if (number? figure)
69 ;; this is not very elegant, but center-aligning all digits
70 ;; is problematic with other markups, and shows problems
71 ;; in the (lack of) overshoot of feta alphabet glyphs.
74 (lambda (y) (make-translate-scaled-markup (cons -0.7 0) y))
77 (if (eq? #t (ly:music-property event 'diminished))
78 (markup #:slashed-digit figure)
79 (markup #:number (number->string figure 10))))
82 (alt (ly:music-property event 'alteration))
86 #:general-align Y DOWN #:fontsize
87 (if (not (= alt DOUBLE-SHARP))
89 (alteration->text-accidental-markup alt))
92 (plus-markup (if (eq? #t (ly:music-property event 'augmented))
96 (alt-dir (ly:context-property context 'figuredBassAlterationDirection))
97 (plus-dir (ly:context-property context 'figuredBassPlusDirection))
100 (if (and (not fig-markup) alt-markup)
102 (set! fig-markup (markup #:left-align #:pad-around 0.3 alt-markup))
103 (set! alt-markup #f)))
106 ;; hmm, how to get figures centered between note, and
107 ;; lone accidentals too?
109 ;; (if (markup? fig-markup)
111 ;; fig-markup (markup #:translate (cons 1.0 0)
112 ;; #:hcenter fig-markup)))
116 (markup #:put-adjacent
118 (if (number? alt-dir)
121 #:pad-x 0.2 alt-markup
128 (markup #:put-adjacent
130 X (if (number? plus-dir)
133 #:pad-x 0.2 plus-markup)
136 (if (markup? fig-markup)
137 (markup #:fontsize -2 fig-markup)