lilypond-user
[Top][All Lists]
Advanced

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

Display Question Mark at center of a measure


From: Rajesh Baskar
Subject: Display Question Mark at center of a measure
Date: Thu, 13 Jan 2022 16:44:47 -0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

Hi,

I'm tying to display a question mark at the center of the 1st measure in a 2 measure score.

I have got this working with hard-coding the offset (3 . 4.5) but this will not work when the number of notes in a measure is larger than 3. Is there a way to get this to work dynamically where the question mark moves to the center of the measure irrespective of the length of a measure.

Thanks for all the help.
Dav.


\version "2.22.0"
boxify =
#(define-music-function
  (grob-path) (key-list?)
  (define proc (grob-transformer 'stencil
   (lambda (grob orig) (grob-interpret-markup grob #{
    \markup \override #'(box-padding . 1.25)
            \override #'(thickness . 1)
            \box \stencil #orig #}))))
  #{ \override $grob-path . stencil = #proc #})

\include "english.ly" \header {tagline = "" }
\score {\new Staff {
  \override Score.SpacingSpanner.strict-note-spacing = ##t
  \set Score.proportionalNotationDuration = #(ly:make-moment 1/4)
  \set Staff.midiInstrument = #"Acoustic Grand Piano"
  \key c \major \numericTimeSignature
  \time 4/4
  \clef bass
  \override TextScript.font-size = #7
 -\markup {\with-color "#6A00F4" "?" }
  \override TextScript.extra-offset = #'(3 . 4.5)

  \override Staff.MeasureCounter.staff-padding = #4.5
  \startMeasureCount
  \hideNotes b2 c
  \unHideNotes a c'4 g
   \stopMeasureCount
  \bar "||"}
        \layout {
              \context {
                     \Staff
                     \consists Measure_counter_engraver
                     \boxify MeasureCounter
                        }
                }
        \midi { \tempo 4 =92}
}




reply via email to

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