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>
8 (define-public (denominator-tuplet-formatter mus)
9 (number->string (ly:music-property mus 'denominator)))
11 (define-public (fraction-tuplet-formatter mus)
13 (number->string (ly:music-property mus 'denominator))
15 (number->string (ly:music-property mus 'numerator))))
18 (define-public (format-metronome-markup event context)
19 (let* ((dur (ly:music-property event 'tempo-unit))
20 (count (ly:music-property event 'metronome-count))
21 (note-mark (make-smaller-markup
22 (make-note-by-number-markup (ly:duration-log dur)
23 (ly:duration-dot-count dur)
27 (make-general-align-markup Y DOWN note-mark)
28 (make-simple-markup "=")
29 (make-simple-markup (number->string count))))))
31 (define-public (format-mark-alphabet mark context)
32 (make-bold-markup (make-markalphabet-markup (1- mark))))
34 (define-public (format-mark-box-alphabet mark context)
35 (make-bold-markup (make-box-markup (make-markalphabet-markup (1- mark)))))
37 (define-public (format-mark-circle-alphabet mark context)
38 (make-bold-markup (make-circle-markup (make-markalphabet-markup (1- mark)))))
40 (define-public (format-mark-letters mark context)
41 (make-bold-markup (make-markletter-markup (1- mark))))
43 (define-public (format-mark-numbers mark context)
44 (make-bold-markup (number->string mark)))
46 (define-public (format-mark-barnumbers mark context)
47 (make-bold-markup (number->string (ly:context-property context 'currentBarNumber))))
49 (define-public (format-mark-box-letters mark context)
50 (make-bold-markup (make-box-markup (make-markletter-markup (1- mark)))))
52 (define-public (format-mark-circle-letters mark context)
53 (make-bold-markup (make-circle-markup (make-markletter-markup (1- mark)))))
55 (define-public (format-mark-box-numbers mark context)
56 (make-bold-markup (make-box-markup (number->string mark))))
58 (define-public (format-mark-circle-numbers mark context)
59 (make-bold-markup (make-circle-markup (number->string mark))))
61 (define-public (format-mark-box-barnumbers mark context)
62 (make-bold-markup (make-box-markup
63 (number->string (ly:context-property context 'currentBarNumber)))))
65 (define-public (format-mark-circle-barnumbers mark context)
66 (make-bold-markup (make-circle-markup
67 (number->string (ly:context-property context 'currentBarNumber)))))
70 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
72 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
74 (define-public (format-bass-figure figure event context)
75 (let* ((fig (ly:music-property event 'figure))
76 (fig-markup (if (number? figure)
78 ;; this is not very elegant, but center-aligning all digits
79 ;; is problematic with other markups, and shows problems
80 ;; in the (lack of) overshoot of feta alphabet glyphs.
83 (lambda (y) (make-translate-scaled-markup (cons -0.7 0) y))
86 (if (eq? #t (ly:music-property event 'diminished))
87 (markup #:slashed-digit figure)
88 (markup #:number (number->string figure 10))))
91 (alt (ly:music-property event 'alteration))
95 #:general-align Y DOWN #:fontsize
96 (if (not (= alt DOUBLE-SHARP))
98 (alteration->text-accidental-markup alt))
101 (plus-markup (if (eq? #t (ly:music-property event 'augmented))
102 (markup #:number "+")
105 (alt-dir (ly:context-property context 'figuredBassAlterationDirection))
106 (plus-dir (ly:context-property context 'figuredBassPlusDirection))
109 (if (and (not fig-markup) alt-markup)
111 (set! fig-markup (markup #:left-align #:pad-around 0.3 alt-markup))
112 (set! alt-markup #f)))
115 ;; hmm, how to get figures centered between note, and
116 ;; lone accidentals too?
118 ;; (if (markup? fig-markup)
120 ;; fig-markup (markup #:translate (cons 1.0 0)
121 ;; #:hcenter fig-markup)))
125 (markup #:put-adjacent
127 (if (number? alt-dir)
130 #:pad-x 0.2 alt-markup
137 (markup #:put-adjacent
139 X (if (number? plus-dir)
142 #:pad-x 0.2 plus-markup)
145 (if (markup? fig-markup)
146 (markup #:fontsize -2 fig-markup)