lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Figured bass: font-shape and vertical spacing


From: Michael Lauer
Subject: Re: Figured bass: font-shape and vertical spacing
Date: Fri, 27 Apr 2007 15:30:13 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

A P <alpha_1960 <at> yahoo.com.au> writes:

> 
> 1. I'd like to use a 'medium' font-shape (rather than
> what looks like boldface) for the figured bass, but I
> can't work out how to do it.  The command
> 
[snip]

> Better still, I'd like to use the font that I'm using
> in the rest of the score (Garamond) for the figures,
> 
[snip]

The best thing I can figure out is to override figuredBassFormatter.  
See below: I copied the original from translation-functions.scm, and 
replaced the :#number markup.  The slashed-digit markup is left as an
exercise :-) .

 
> 2. Also, I'd like the figures to be above the staff
> (which I've worked out how to do), but I'd like them
> to  sit directly above the staff or corresponding note
> (if it sticks up above the staff), with relatively
> little white space in between (as it is in the
> facsimile that I'm typesetting).  Playing around with
> #'minimum-Y-extent doesn't work, and I think I
> understand why, but how can I do what I'd like?
> 

I'm not sure exactly what you're after, but there are a couple of 
potential issues:

--you may need to adjust minimum-Y-extent for both the Staff and the 
FiguredBasscontexts

--by default the figures are aligned along their tops, which isn't what 
you want for figures above the staff.  You can bottom-align them by setting
stacking-dir, which will also require you to flip the order of the figures 
in the "chords".

--if you don't want them aligned at all, I don't know what to do :-( .

Example:

\version "2.10.0"
\include "english.ly"

#(define (my-format-bass-figure figure event context)
  (let* ((fig (ly:event-property event 'figure))
     (fig-markup (if (number? figure)
             ((if (<= 10 figure)
                  (lambda (y) (make-translate-scaled-markup (cons -0.7 0) y))
                  identity)

              (if (eq? #t (ly:event-property event 'diminished))
                  (markup #:slashed-digit figure)
                  (markup #:fontsize 2
                          #:override '(font-name . "Garamond" ) 
                            (number->string figure 10))))
             #f
             ))
     (alt (ly:event-property event 'alteration))
     (alt-markup
      (if (number? alt)
          (markup
           #:general-align Y DOWN #:fontsize
           (if (not (= alt DOUBLE-SHARP))
           -2 2)
           (alteration->text-accidental-markup alt))
          
          #f))
     (plus-markup (if (eq? #t (ly:event-property event 'augmented))
              (markup #:number "+")
              #f))

     (alt-dir (ly:context-property context 'figuredBassAlterationDirection))
     (plus-dir (ly:context-property context 'figuredBassPlusDirection))
     )

    (if (and (not fig-markup) alt-markup)
    (begin
      (set! fig-markup (markup #:left-align #:pad-around 0.3 alt-markup))
      (set! alt-markup #f)))


    ;; hmm, how to get figures centered between note, and
    ;; lone accidentals too?
    
    ;;    (if (markup? fig-markup)
    ;;  (set!
    ;;   fig-markup (markup #:translate (cons 1.0 0)
    ;;                      #:hcenter fig-markup)))

    (if alt-markup
    (set! fig-markup
          (markup #:put-adjacent
              fig-markup X
              (if (number? alt-dir)
              alt-dir
              LEFT)
              #:pad-x 0.2 alt-markup
              )))

    
    (if plus-markup
    (set! fig-markup
          (if fig-markup
          (markup #:put-adjacent
              fig-markup
              X (if (number? plus-dir)
                plus-dir
                LEFT)
              #:pad-x 0.2 plus-markup)
          plus-markup)))
    
    (if (markup? fig-markup)
    (markup #:general-align Y -1 #:fontsize -2 fig-markup)
    empty-markup)

    ))
    

\score
{
    
     <<
     \new FiguredBass \figuremode  {
         < 6 >4 < 7\+ >8 < [_!] 6+  >
         < 6 >4 <[3+] 5 6>
     }
     \new Voice { \clef bass ds4 c d as }
     >>
     
     \layout
     {
         \context {
             \FiguredBass
             figuredBassFormatter = #my-format-bass-figure
             \override BassFigureAlignment #'stacking-dir = #UP
             \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0)
         }
         \context {
             \Staff
             \override VerticalAxisGroup #'minimum-Y-extent = #'(2 . 2)
         }
     }
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]