Hi Andrew,

On Fri, May 24, 2013 at 8:05 AM, Andrew Bernard <andrew.bern...@gmail.com>wrote:

> What is the best way to change the font and size of a time signature? For
> the contemporary scores that I am setting, the traditional engraved
> old-fashioned face for time signatures just looks out of place, and, like
> some other engravers, I am attempting to match a very idiosyncratic
> handwritten style in the manuscript.
>
> I have:
>
>   \override Staff.TimeSignature #'stencil = #ly:text-interface::print
>   \override Staff.TimeSignature #'text = \markup {  \abs-fontsize #14.5
> \bold \override #'(baseline-skip . 2.5) \center-column { \line { 16 } \line
> { 4 } } }
>
> This works, but seems terribly clumsy. Is there a more elegant way?
>

The solution is to wrap your markup in some sort of function.

You could do something like this:

myTimeSig =
#(define-music-function (parser location num denom)
  (string? string?)
  #{
    \override Staff.TimeSignature #'text =
    \markup {
      \abs-fontsize #14.5 \bold \override #'(baseline-skip . 2.5)
      \center-column {
        \line { #num }
        \line { #denom }
      }
    }
  #})

\new Staff {
  \override Staff.TimeSignature #'stencil = #ly:text-interface::print
  \myTimeSig "16" "4"
  \time 16/4
  \repeat unfold 16 c''4
  \myTimeSig "15" "4"
  \time 15/4
  \repeat unfold 15 c''4
  \myTimeSig "5" "8"
  \time 5/8
  c''8 c'' c'' c'' c''
}

%%%%

I'm including this because it's fairly straightforward to do this sort of
thing based on the existing documentation.  (See the Extending manual.)

One drawback, of course, is that you need to call the function with each
change in time signature.

The following function draws the information from the time signature's
properties:

#(define (myTimeSigDeluxe grob)
  (let* ((fraction (ly:grob-property grob 'fraction))
         (num (car fraction))
         (denom (cdr fraction)))
     #{
       \markup {
 \abs-fontsize #14.5 \bold \override #'(baseline-skip . 2.5)
 \center-column {
   \line { #(number->string num) }
   \line { #(number->string denom) }
 }
       }
     #}))

\new Staff {
  \override Staff.TimeSignature #'stencil = #ly:text-interface::print
  \override Staff.TimeSignature #'text = #myTimeSigDeluxe
  \time 16/4
  \repeat unfold 16 c''4
  \time 15/4
  \repeat unfold 15 c''4
  \time 5/8
  c''8 c'' c'' c'' c''
}

%%%%

HTH,
David
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to