lilypond-user
[Top][All Lists]
Advanced

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

Re: How to display timesig.C22 on 4/2 instead of 2/2


From: Valentin Petzel
Subject: Re: How to display timesig.C22 on 4/2 instead of 2/2
Date: Sat, 08 Jul 2023 19:19:34 +0200

Hello William,

you can lookup ly:time-signature::print in scm/time-signature.scm. You will 
find that Lilypond uses a formatting procedure given by the 'style property. 
You can add such a procedure using

add-simple-time-signature-style

In scm/time-signature-settings.scm you will find the existing implementations. 
For example the C-style uses this procedure:

(define-public (make-c-time-signature-markup fraction)
  "Make markup for the @q{C} time signature style."
  (let ((n (car fraction))
        (d (cdr fraction)))
    ;; check specific fractions to avoid warnings when no glyph exists
    (if (or (and (= n 2) (= d 2))
            (and (= n 4) (= d 4)))
        (make-glyph-time-signature-markup 'C fraction)
        (make-compound-meter-markup fraction))))

We can now simply adapt this to do what you want:

#(define-public (make-early-c-time-signature-markup fraction)
  (let ((n (car fraction))
        (d (cdr fraction)))
    ;; check specific fractions to avoid warnings when no glyph exists
    (if (and (= n 4) (= d 2))
        (make-glyph-time-signature-markup 'C '(2 . 2))
        (make-compound-meter-markup fraction))))

#(add-simple-time-signature-style 'early-c
                                  make-early-c-time-signature-markup)

{
  \override Staff.TimeSignature.style = #'early-c
  \time 4/2
  c\breve
}

Cheers,
Valentin

Am Samstag, 8. Juli 2023, 18:37:58 CEST schrieb William Rehwinkel via LilyPond 
user discussion:
> Dear list,
> 
> I am having trouble finding the source code which displays the glyphs 
> timesig.C44 and C22 in place of 4/4 and 2/2 time signatures.
> 
> The reason is I would like to override this so that timesig.C22 displays 
> on 4/2 time signature for early music which uses the /brevetactus/. I 
> know this could be done with substituting a text-interface for the time 
> signature stencil, but it would be nice if I could put this in my 
> style-sheet and "set and forget" it.
> 
> Thank you,
> -William
> 
> -- 
> + ------------------------------------------- +
> 
> |   William Rehwinkel - Oberlin College and   |
> |   
> |                          Conservatory '24   |
> |
> |william@williamrehwinkel.net          |
> |
> | PGP key:                                    |
> |
> |https://ftp.williamrehwinkel.net/pubkey.txt  |
> 
> + ------------------------------------------- +
> 

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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