lilypond-user
[Top][All Lists]
Advanced

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

Scheme syntax help ( I think)


From: Colin Baguley
Subject: Scheme syntax help ( I think)
Date: Sun, 16 Oct 2022 15:43:40 +0100

Hi there,
By reading this mailing list I've recently discovered how to add some text in a box to my music which doesn't
affect any other elements of the score. This is an example of what I mean.

\mark \markup {\with-dimensions-from \null
           \translate #'(1.0 . -4.0)
           \override #'(font-name . "Calibra Bold ")
           \fontsize #3
           \with-color #(x11-color "Red")
           \box   \whiteout  "Some text here" }

So, my next challenge was to  make this into a function so that I could alter the font, size, colour,
position etc on the fly so to speak but I'm struggling with Scheme syntax here.
I've managed to  work out position and fontsize, but struggling with the rest. Here is how far I've
got. Could someone  improve on this please [ and also comment on why the 'whiteout' isn't perfect ]

Thank you in anticipation.

\version "2.22.1"
specialbox = #(define-music-function
              ( coord marktext fsize   )
              ( pair? markup?  number?  )
     #{
     \mark \markup {\with-dimensions-from \null
           \translate #coord
           \override #'(font-name . "Calibra Bold")
           \fontsize #fsize
           \with-color #(x11-color "Red")
           \box   \whiteout  $marktext }
      #})
%---------------------------------------------------
melody = \relative c' {
\repeat unfold 4 {  c8 d e f g f e d } \break

\specialbox #'(0.0 . -4.0 ) #"Testing 123" #3  

\repeat unfold 4 { c8 d e f g f e d  } \break
}
%----------------------------------------------------
\score {
    \new Staff { \melody }
    \layout { }
}
%----------------------------------------------------

Attachment: specialbox.png
Description: PNG image


reply via email to

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