Hi Kevin,

Thank you so much for all the effort you've put into this!
I think this has already become useable but I still have a few suggestions:

1. Due to the nature of text scripts, they can't be clicked on and directed to 
the code in Frescobaldi, this may make debugging the score a bit more 
difficult, but it won't affect the outcome once the score is finished, so it 
shouldn't be a big problem.

2. Compound time signatures are now automatically formatted into normal time 
signatures (see attachment) I think this can be fixed relatively easily by 
reformatting the markup.

3. It would be great if extra space can be arranged for the time signature 
before the line break instead of aligning it to the left side of the last bar.

4. This is not a personal request, however, some people may prefer aligning the 
time signature to the centre instead of the right side of the barline like the 
example in the original snippet. http://lsr.di.unimi.it/LSR/Snippet?id=272 I 
wonder how hard this can be implemented into this custom engraver.

Overall, I think this is a massive improvement from the last version and I 
greatly appreciate your help.

Best,
Leo
\version "2.19.0"

#(define (Time_signature_markup_engraver context)
   (let ((time-sig '())
         (time-sig-copy #f)
         (previous-was-grace #f)) ; to avoid printing twice at grace notes
     (make-engraver
      (acknowledgers
       ((time-signature-interface engraver grob source-engraver)
        (let* ((current-moment (ly:context-current-moment context))
               (grace-nom (ly:moment-grace-numerator current-moment)))
          (if (not (eqv? 0 grace-nom))
              (begin
               (set! previous-was-grace #t)
               (set! time-sig grob))
              (if (and (eqv? 0 grace-nom) previous-was-grace)
                  (begin
                   (set! previous-was-grace #f)
                   (set! time-sig '()))
                  (set! time-sig grob))))))
      ((process-acknowledged engraver)
       (and (not (null? time-sig))
            (let* ((time-sig-copy (ly:engraver-make-grob
                                   engraver
                                   'TextScript
                                   time-sig))
                   (copy-prop (lambda (prop)
                                (ly:grob-set-property!
                                 time-sig-copy
                                 prop
                                 (ly:grob-property time-sig prop))))
                   (prop-list '(fraction style font-size)))
              (map copy-prop prop-list)
              (ly:grob-set-property! time-sig-copy 'stencil
                ly:time-signature::print)
              (ly:grob-set-parent! time-sig-copy Y time-sig)
              (ly:grob-set-parent! time-sig-copy X time-sig)
              (set! time-sig '())
              )))
      ((stop-translation-timestep engraver)
       (set! time-sig-copy #f)))))

#(define (left-align-at-end grob)
   (and (and (ly:item? grob)
             (equal? (ly:item-break-dir grob) LEFT))
        (ly:grob-set-property! grob 'self-alignment-X 1)))

timeSignatures = {
  \tempo 4 = 80
  \time 4/4 s1
  \time 3/8 s4.
  \time 3/4 s2.
  \time 4/4 s1
  \time 2/4 s2
  \compoundMeter #'((2 4) (1 16))
  s1* 9/16
}

\score {
  \layout {
    \context {
      \Score
      \override MetronomeMark.break-align-symbols = #'(clef time-signature)
      \remove "Bar_number_engraver"
    }
    \context {
      \Staff
      \override MultiMeasureRest.spacing-pair = #'(clef . staff-bar)
      \remove "Time_signature_engraver"
    }
    \context {
      \Score
    }
  }
  <<
    \new Dynamics \with {
      \consists "Axis_group_engraver"
      \consists "Time_signature_engraver"
      \override TimeSignature.stencil = ##f
      \override TimeSignature.font-size = #8
      \numericTimeSignature
      \consists \Time_signature_markup_engraver
      \override TextScript.before-line-breaking = #left-align-at-end
    }
    {
      \timeSignatures
    }
   
    \new StaffGroup \with {} <<
   
      \new Staff \with {
        \consists "Bar_number_engraver"
      }    
      \relative c' {
        \textLengthOn
        \time 4/4
        c4 ( _\markup \column {
          "← Objects failed to appear"
          "below the time signature"
          "when using \\textLengthOn"
        }
        \textLengthOff
        d4 e4 f4 )
        \time 3/8
        a'4 ( g8 ) 
        \time 3/4
        R2. 
        \time 4/4
        c1 
        \time 2/4
        a8 ^\markup \column {
          "← Time signature appear twice" 
          "when one staff has a grace note" 
          "as the first note in a bar"
        } g8 f8 e8
        \compoundMeter #'((2 4) (1 16))
        a2 g16
      }
   
      \new Staff \relative c' {
        \time 4/4
        R1
        \time 3/8
        R4.
        \clef bass
        \time 3/4
        a,2. \> \startTextSpan 
        \break
        \time 4/4
        c2 _\markup \column {
          "  "
          "↑"
          "Harpin stops below the time signature"
        }
        ^\markup \column {
          "TextSpanner stops below the time signature"
          "↓"
        }
        e2 \! \stopTextSpan
        \clef treble
        \time 2/4
        \acciaccatura f'8 a8 
        g8 f8 e8
        \compoundMeter #'((2 4) (1 16))
        a2 g16
      }
   
      \new Staff \relative c' { 
        \clef bass 
        \time 4/4
        R1 
        \time 3/8
        R4. 
        \time 3/4
        R2. 
        \time 4/4
        c1
        \time 2/4
        a8 g8 f8 e8
        \compoundMeter #'((2 4) (1 16))
        a2 g16
      }
    >>
  >>
}

Reply via email to