lilypond-user
[Top][All Lists]
Advanced

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

Re: Convert staff-spaces to mm on the fly?


From: Richard Shann
Subject: Re: Convert staff-spaces to mm on the fly?
Date: Mon, 30 Dec 2024 14:35:21 +0000
User-agent: Evolution 3.46.4-2

On Sun, 2024-12-29 at 16:14 +0000, Timothy Lanfear wrote:
> On 29/12/2024 12:57, Richard Shann wrote:
>  
> > Is there a way of writing
> > 
> > \override #'(line-width . 100)
> > 
> > so that the value is interpreted as mm rather than staff-spacings?
> > 
> > Richard
> > 
> Recent 2.25 releases have the scheme function to-staff-space,
> Otherwise you can get the conversion factor from the paper.
> \version "2.25.22"
> 
> staffspaceinmm = #(ly:output-def-lookup $defaultpaper 'staff-space)
> 
> lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
> do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
> enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
> ut aliquip ex ea commodo consequat. Duis aute irure dolor in
> reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
> pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
> culpa qui officia deserunt mollit anim id est laborum."
> 
> \layout { indent = 0 }
> {
>   c'1^\markup { \override #`(line-width . ,(/ 100 staffspaceinmm))
> \wordwrap-string { \lorem } }
>   \break
>   c'1^\markup { \override #`(line-width . ,(to-staff-space 100 'mm))
> \wordwrap-string { \lorem } }
> }
> 
> 

Thank you for this code. Trying it out, I see that there is something
here I have not got understood. This MWE should explain all - I was
hoping that the text "Interlude" would appear centered between the two
systems, but its position still depends on the staff size:

8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><

\version "2.24"

staffspaceinmm = #(ly:output-def-lookup $defaultpaper 'staff-space)

#(set-default-paper-size "a4")
%#(set-global-staff-size 10)
#(set-global-staff-size 18)

\layout { indent = 0 }
{
 \repeat unfold #40 c'2
 \break \mark \markup { \override #`(line-width .  ,(/ 175 staffspaceinmm)) 
                          \fill-line { " " \lower #10 "Interlude" " " } } 
 \repeat unfold #40 c'2
}

8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><

This centers "Interlude" with the global staff size set to 18 but not
10.

Thanks again

Richard Shann






reply via email to

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