Discussion:
Spacing issue after Mark and TextScript
David Sumbler
2018-11-21 12:24:29 UTC
Permalink
%%%%%%%%%%%%%%%%%%%
\version "2.19.81"

#(set-global-staff-size 12)

indent = #0

{ \textLengthOn
\time 5/4
r2 r4.
\override Score.RehearsalMark.self-alignment-X = #-1
\override Score.RehearsalMark.font-size = #5
\mark \markup {"After the thirty-third encore, the Emperor arose."}
\hide TextScript
r8\fermata_"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
r4 |
%%% \noBreak
R4*5 | R4*5 | R4*5 |
}
%%%%%%%%%%%%%%%%%%%

When the above is compiled, the spacing for notes/rests after the Mark
and TextScript is increased. This becomes even more obvious if
\noBreak is uncommented: the final crotchet rest of the first bar and
the whole bar rest of the second now take up so much horizontal space
that the line runs outside of the right-hand margin, as is shown in the
attached image. Meanwhile the rests at the start of the first bar are
squashed together to make room for the unnecessary empty spaces later
in the line. Things are restored to normal after a line break.

If I remove either the RehearsalMark or the TextScript, the problem
disappears. The purpose of the textscript is to prevent the crotchet
rest appearing before the "Mark" is finished.

I have used the same kind of structure in numerous other places in this
piece without problems, and despite nearly a day of experimentation I
can't see why this case behaves differently. (There are reasons for
presenting these texts as Marks rather than Text attached to a rest,
but they are not relevant to the problem.)

Any suggestions? Is there perhaps a way of resetting the spacing
parameters to something sensible?

David
Pedro Pessoa
2018-11-21 16:26:42 UTC
Permalink
Hey David. Not sure if I got how you want it to be, but - with the \nobreak
uncommented) - if you add tree more m's to the TextScript, it produces
something which looks right. Don't know why.

Pessoa

mailing_Spacing_issue_after_Mark_and_TextScript.png
<Loading Image...>




--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html
David Sumbler
2018-11-23 14:28:10 UTC
Permalink
-----Original Message-----
From: David Sumbler <***@aeolia.co.uk>
Reply
-To: ***@aeolia.co.uk
To: lilypond-***@gnu.org
Subject: Spacing issue after Mark and TextScript
Date: Wed, 21 Nov 2018 12:24:29 +0000

%%%%%%%%%%%%%%%%%%%
\version "2.19.81"

#(set-global-staff-size 12)

indent = #0

{ \textLengthOn
\time 5/4
r2 r4.
\override Score.RehearsalMark.self-alignment-X = #-1
\override Score.RehearsalMark.font-size = #5
\mark \markup {"After the thirty-third encore, the Emperor arose."}
\hide TextScript
r8\fermata_"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
r4 |
%%% \noBreak
R4*5 | R4*5 | R4*5 |
}
%%%%%%%%%%%%%%%%%%%

When the above is compiled, the spacing for notes/rests after the Mark
and TextScript is increased. This becomes even more obvious if
\noBreak is uncommented: the final crotchet rest of the first bar and
the whole bar rest of the second now take up so much horizontal space
that the line runs outside of the right-hand margin, as is shown in the
attached image. Meanwhile the rests at the start of the first bar are
squashed together to make room for the unnecessary empty spaces later
in the line. Things are restored to normal after a line break.

If I remove either the RehearsalMark or the TextScript, the problem
disappears. The purpose of the textscript is to prevent the crotchet
rest appearing before the "Mark" is finished.

I have used the same kind of structure in numerous other places in this
piece without problems, and despite nearly a day of experimentation I
can't see why this case behaves differently. (There are reasons for
presenting these texts as Marks rather than Text attached to a rest,
but they are not relevant to the problem.)

Any suggestions? Is there perhaps a way of resetting the spacing
parameters to something sensible?

David

-----Original Message-----
From: Pedro Pessoa <***@gmail.com>
To: lilypond-***@gnu.org
Subject: Re: Spacing issue after Mark and TextScript
Date: Wed, 21 Nov 2018 09:26:42 -0700 (MST)

Hey David. Not sure if I got how you want it to be, but - with the
\nobreak
uncommented) - if you add tree more m's to the TextScript, it produces
something which looks right. Don't know why.

Pessoa

mailing_Spacing_issue_after_Mark_and_TextScript.png
<
http://lilypond.1069038.n5.nabble.com/file/t5699/mailing_Spacing_issue_after_Mark_and_TextScript.png> 

--


True - it looks as if the spacing text (the "mmmm"-s) needs to be as
far as possible exactly the same length as the TextScript.

But add even one more "m" and the right-hand end of the staff is again
noticeably beyond the right margin.

And even with the "correct" number of "m"s, so that the end of the line
appears in (roughly?) the right place, the rests at the beginning of
the line are ridiculously compressed together. The space give to the
crotchet rest at the end of the bar is far greater than that allowed
for the dotted crotchet earlier in the same bar.

Does anyone have any idea what is going on here?

David
Thomas Morley
2018-11-24 21:28:06 UTC
Permalink
Post by David Sumbler
-----Original Message-----
Reply
Subject: Spacing issue after Mark and TextScript
Date: Wed, 21 Nov 2018 12:24:29 +0000
%%%%%%%%%%%%%%%%%%%
\version "2.19.81"
#(set-global-staff-size 12)
indent = #0
{ \textLengthOn
\time 5/4
r2 r4.
\override Score.RehearsalMark.self-alignment-X = #-1
\override Score.RehearsalMark.font-size = #5
\mark \markup {"After the thirty-third encore, the Emperor arose."}
\hide TextScript
r8\fermata_"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
r4 |
%%% \noBreak
R4*5 | R4*5 | R4*5 |
}
%%%%%%%%%%%%%%%%%%%
When the above is compiled, the spacing for notes/rests after the Mark
and TextScript is increased. This becomes even more obvious if
\noBreak is uncommented: the final crotchet rest of the first bar and
the whole bar rest of the second now take up so much horizontal space
that the line runs outside of the right-hand margin, as is shown in the
attached image. Meanwhile the rests at the start of the first bar are
squashed together to make room for the unnecessary empty spaces later
in the line. Things are restored to normal after a line break.
If I remove either the RehearsalMark or the TextScript, the problem
disappears. The purpose of the textscript is to prevent the crotchet
rest appearing before the "Mark" is finished.
I have used the same kind of structure in numerous other places in this
piece without problems, and despite nearly a day of experimentation I
can't see why this case behaves differently. (There are reasons for
presenting these texts as Marks rather than Text attached to a rest,
but they are not relevant to the problem.)
Any suggestions? Is there perhaps a way of resetting the spacing
parameters to something sensible?
David
-----Original Message-----
Subject: Re: Spacing issue after Mark and TextScript
Date: Wed, 21 Nov 2018 09:26:42 -0700 (MST)
Hey David. Not sure if I got how you want it to be, but - with the \nobreak
uncommented) - if you add tree more m's to the TextScript, it produces
something which looks right. Don't know why.
Pessoa
mailing_Spacing_issue_after_Mark_and_TextScript.png
<
http://lilypond.1069038.n5.nabble.com/file/t5699/mailing_Spacing_issue_after_Mark_and_TextScript.png>
--
True - it looks as if the spacing text (the "mmmm"-s) needs to be as
far as possible exactly the same length as the TextScript.
But add even one more "m" and the right-hand end of the staff is again
noticeably beyond the right margin.
And even with the "correct" number of "m"s, so that the end of the line
appears in (roughly?) the right place, the rests at the beginning of
the line are ridiculously compressed together. The space give to the
crotchet rest at the end of the bar is far greater than that allowed
for the dotted crotchet earlier in the same bar.
Does anyone have any idea what is going on here?
David
I noticed with version 2.12.3 the output is as desired.

Then I identified the first commit which changes the behaviour. First
bad commit is:

commit 53db923e715126eb9463220526b4838fbfd3dad4
Author: Andrew Hawryluk <***@gmail.com>
Date: Sat Jan 15 13:42:03 2011 -0700

Change keep-inside-line defaults to true.

As discussed in Issue #1470, the default should be changed so that
good layout with a slight performance hit is the default.

https://sourceforge.net/p/testlilyissues/issues/1470/
https://codereview.appspot.com/4243041/
Which is LilyPond-version 2.13.52


Tbh, I never noticed bad behaviour caused by this patch before.
I suspect something rotten is present elsewhere, though I've no clue
what it might be or where to look...


Nevertheless, you could revert the settings done by this patch globally with:

\layout {
\context {
\Score
\override NonMusicalPaperColumn.keep-inside-line = #'()
\override PaperColumn.keep-inside-line = #'()
}
}

This may have some unwanted effects, though.
Less invasive would be:

#(set-global-staff-size 12)

indent = #0

{ \textLengthOn
\time 5/4
r2 r4.

\overrideProperty Score.NonMusicalPaperColumn.keep-inside-line #'()
\overrideProperty Score.PaperColumn.keep-inside-line #'()
\override Score.RehearsalMark.self-alignment-X = #-1
\override Score.RehearsalMark.font-size = #4
\mark \markup {"After the thirty-third encore, the Emperor arose."}
\hide TextScript
r8\fermata_"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
r4 |
\noBreak
R4*5 | R4*5 | R4*5 |
}


HTH,
Harm
Thomas Morley
2018-11-24 21:36:11 UTC
Permalink
'
Am Sa., 24. Nov. 2018 um 22:28 Uhr schrieb Thomas Morley
Post by Thomas Morley
Post by David Sumbler
-----Original Message-----
Reply
Subject: Spacing issue after Mark and TextScript
Date: Wed, 21 Nov 2018 12:24:29 +0000
%%%%%%%%%%%%%%%%%%%
\version "2.19.81"
#(set-global-staff-size 12)
indent = #0
{ \textLengthOn
\time 5/4
r2 r4.
\override Score.RehearsalMark.self-alignment-X = #-1
\override Score.RehearsalMark.font-size = #5
\mark \markup {"After the thirty-third encore, the Emperor arose."}
\hide TextScript
r8\fermata_"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
r4 |
%%% \noBreak
R4*5 | R4*5 | R4*5 |
}
%%%%%%%%%%%%%%%%%%%
When the above is compiled, the spacing for notes/rests after the Mark
and TextScript is increased. This becomes even more obvious if
\noBreak is uncommented: the final crotchet rest of the first bar and
the whole bar rest of the second now take up so much horizontal space
that the line runs outside of the right-hand margin, as is shown in the
attached image. Meanwhile the rests at the start of the first bar are
squashed together to make room for the unnecessary empty spaces later
in the line. Things are restored to normal after a line break.
If I remove either the RehearsalMark or the TextScript, the problem
disappears. The purpose of the textscript is to prevent the crotchet
rest appearing before the "Mark" is finished.
I have used the same kind of structure in numerous other places in this
piece without problems, and despite nearly a day of experimentation I
can't see why this case behaves differently. (There are reasons for
presenting these texts as Marks rather than Text attached to a rest,
but they are not relevant to the problem.)
Any suggestions? Is there perhaps a way of resetting the spacing
parameters to something sensible?
David
-----Original Message-----
Subject: Re: Spacing issue after Mark and TextScript
Date: Wed, 21 Nov 2018 09:26:42 -0700 (MST)
Hey David. Not sure if I got how you want it to be, but - with the \nobreak
uncommented) - if you add tree more m's to the TextScript, it produces
something which looks right. Don't know why.
Pessoa
mailing_Spacing_issue_after_Mark_and_TextScript.png
<
http://lilypond.1069038.n5.nabble.com/file/t5699/mailing_Spacing_issue_after_Mark_and_TextScript.png>
--
True - it looks as if the spacing text (the "mmmm"-s) needs to be as
far as possible exactly the same length as the TextScript.
But add even one more "m" and the right-hand end of the staff is again
noticeably beyond the right margin.
And even with the "correct" number of "m"s, so that the end of the line
appears in (roughly?) the right place, the rests at the beginning of
the line are ridiculously compressed together. The space give to the
crotchet rest at the end of the bar is far greater than that allowed
for the dotted crotchet earlier in the same bar.
Does anyone have any idea what is going on here?
David
I noticed with version 2.12.3 the output is as desired.
Then I identified the first commit which changes the behaviour. First
commit 53db923e715126eb9463220526b4838fbfd3dad4
Date: Sat Jan 15 13:42:03 2011 -0700
Change keep-inside-line defaults to true.
As discussed in Issue #1470, the default should be changed so that
good layout with a slight performance hit is the default.
https://sourceforge.net/p/testlilyissues/issues/1470/
https://codereview.appspot.com/4243041/
Which is LilyPond-version 2.13.52
Tbh, I never noticed bad behaviour caused by this patch before.
I suspect something rotten is present elsewhere, though I've no clue
what it might be or where to look...
\layout {
\context {
\Score
\override NonMusicalPaperColumn.keep-inside-line = #'()
\override PaperColumn.keep-inside-line = #'()
}
}
This may have some unwanted effects, though.
c/p error :(
check without changing 'set-global-staff-size'
Post by Thomas Morley
#(set-global-staff-size 12)
indent = #0
{ \textLengthOn
\time 5/4
r2 r4.
\overrideProperty Score.NonMusicalPaperColumn.keep-inside-line #'()
\overrideProperty Score.PaperColumn.keep-inside-line #'()
\override Score.RehearsalMark.self-alignment-X = #-1
\override Score.RehearsalMark.font-size = #4
\mark \markup {"After the thirty-third encore, the Emperor arose."}
\hide TextScript
r8\fermata_"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
r4 |
\noBreak
R4*5 | R4*5 | R4*5 |
}
HTH,
Harm
David Sumbler
2018-11-25 12:30:03 UTC
Permalink
-----Original Message-----
From: Thomas Morley <***@gmail.com>
To: David Sumbler <***@aeolia.co.uk>
CC: ***@gmail.com, lilypond-user <lilypond-***@gnu.org>
Subject: Re: Spacing issue after Mark and TextScript
Date: Sat, 24 Nov 2018 22:28:06 +0100

Am Fr., 23. Nov. 2018 um 15:28 Uhr schrieb David Sumbler <
Post by David Sumbler
-----Original Message-----
Reply
Subject: Spacing issue after Mark and TextScript
Date: Wed, 21 Nov 2018 12:24:29 +0000
%%%%%%%%%%%%%%%%%%%
\version "2.19.81"
#(set-global-staff-size 12)
indent = #0
{ \textLengthOn
\time 5/4
r2 r4.
\override Score.RehearsalMark.self-alignment-X = #-1
\override Score.RehearsalMark.font-size = #5
\mark \markup {"After the thirty-third encore, the Emperor arose."}
\hide TextScript
r8\fermata_"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
r4 |
%%% \noBreak
R4*5 | R4*5 | R4*5 |
}
%%%%%%%%%%%%%%%%%%%
When the above is compiled, the spacing for notes/rests after the Mark
and TextScript is increased. This becomes even more obvious if
\noBreak is uncommented: the final crotchet rest of the first bar and
the whole bar rest of the second now take up so much horizontal space
that the line runs outside of the right-hand margin, as is shown in the
attached image. Meanwhile the rests at the start of the first bar are
squashed together to make room for the unnecessary empty spaces later
in the line. Things are restored to normal after a line break.
If I remove either the RehearsalMark or the TextScript, the problem
disappears. The purpose of the textscript is to prevent the crotchet
rest appearing before the "Mark" is finished.
I have used the same kind of structure in numerous other places in this
piece without problems, and despite nearly a day of experimentation I
can't see why this case behaves differently. (There are reasons for
presenting these texts as Marks rather than Text attached to a rest,
but they are not relevant to the problem.)
Any suggestions? Is there perhaps a way of resetting the spacing
parameters to something sensible?
David
-----Original Message-----
Subject: Re: Spacing issue after Mark and TextScript
Date: Wed, 21 Nov 2018 09:26:42 -0700 (MST)
Hey David. Not sure if I got how you want it to be, but - with the \nobreak
uncommented) - if you add tree more m's to the TextScript, it
produces
something which looks right. Don't know why.
Pessoa
mailing_Spacing_issue_after_Mark_and_TextScript.png
<
http://lilypond.1069038.n5.nabble.com/file/t5699/mailing_Spacing_issue_after_Mark_and_TextScript.png>
Post by David Sumbler
;
--
True - it looks as if the spacing text (the "mmmm"-s) needs to be as
far as possible exactly the same length as the TextScript.
But add even one more "m" and the right-hand end of the staff is again
noticeably beyond the right margin.
And even with the "correct" number of "m"s, so that the end of the line
appears in (roughly?) the right place, the rests at the beginning of
the line are ridiculously compressed together. The space give to the
crotchet rest at the end of the bar is far greater than that allowed
for the dotted crotchet earlier in the same bar.
Does anyone have any idea what is going on here?
David
I noticed with version 2.12.3 the output is as desired.

Then I identified the first commit which changes the behaviour. First
bad commit is:

commit 53db923e715126eb9463220526b4838fbfd3dad4
Author: Andrew Hawryluk <***@gmail.com>
Date: Sat Jan 15 13:42:03 2011 -0700

Change keep-inside-line defaults to true.

As discussed in Issue #1470, the default should be changed so that
good layout with a slight performance hit is the default.

https://sourceforge.net/p/testlilyissues/issues/1470/
https://codereview.appspot.com/4243041/
Which is LilyPond-version 2.13.52


Tbh, I never noticed bad behaviour caused by this patch before.
I suspect something rotten is present elsewhere, though I've no clue
what it might be or where to look...


Nevertheless, you could revert the settings done by this patch globally
with:

\layout {
\context {
\Score
\override NonMusicalPaperColumn.keep-inside-line = #'()
\override PaperColumn.keep-inside-line = #'()
}
}

This may have some unwanted effects, though.
Less invasive would be:

#(set-global-staff-size 12)

indent = #0

{ \textLengthOn
\time 5/4
r2 r4.

\overrideProperty Score.NonMusicalPaperColumn.keep-inside-line #'()
\overrideProperty Score.PaperColumn.keep-inside-line #'()
\override Score.RehearsalMark.self-alignment-X = #-1
\override Score.RehearsalMark.font-size = #4
\mark \markup {"After the thirty-third encore, the Emperor arose."}
\hide TextScript
r8\fermata_"mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm"
r4 |
\noBreak
R4*5 | R4*5 | R4*5 |
}

HTH,
Harm

*****************

Once again, I am overwhelmed by the time and effort you must have given
to this, and by the depth of your understanding of the inner workings
of Lilypond. Thank you so much.

I have used your "less invasive" version, and with this I can get the
result I wanted. I actually have the line finishing with the word
"tacet" in a white-out box, in such a way that the stave appears to
finish early followed by "tacet" ending at the margin. I also did this
in an earlier movement, but without any obvious spacing problems
showing up.

The parameters NonMusicalPaperColumn and suchlike have long been a
mystery to me. If it can be done reasonably succinctly, could you
perhaps explain what NonMusicalPaperColumn.keep-inside-line #'() and
PaperColumn.keep-inside-line #'() actually do?

David
Phil Holmes
2018-11-25 15:09:41 UTC
Permalink
----- Original Message -----
Post by David Sumbler
The parameters NonMusicalPaperColumn and suchlike have long been a
mystery to me. If it can be done reasonably succinctly, could you
perhaps explain what NonMusicalPaperColumn.keep-inside-line #'() and
PaperColumn.keep-inside-line #'() actually do?
David
The old NR says:

Checking to make sure that text scripts and lyrics are within the margins
requires additional
calculations. In cases where slightly faster performance is desired, use

\override Score.PaperColumn #'keep-inside-line = ##f

and

keep-inside-line (boolean)
If set, this column cannot have objects sticking into the margin.

Hope that makes sense.

--
Phil Holmes
Thomas Morley
2018-11-25 16:38:31 UTC
Permalink
Post by Phil Holmes
----- Original Message -----
Post by David Sumbler
The parameters NonMusicalPaperColumn and suchlike have long been a
mystery to me. If it can be done reasonably succinctly, could you
perhaps explain what NonMusicalPaperColumn.keep-inside-line #'() and
PaperColumn.keep-inside-line #'() actually do?
David
Checking to make sure that text scripts and lyrics are within the margins
requires additional
calculations. In cases where slightly faster performance is desired, use
\override Score.PaperColumn #'keep-inside-line = ##f
and
keep-inside-line (boolean)
If set, this column cannot have objects sticking into the margin.
Hope that makes sense.
--
Phil Holmes
To illustrate what Phil wrote, compile the following code with and
without the relevant overrides:

\score {
<<
{
\repeat unfold 16 { c'4 \noBreak }
\tempo "Allegro molto, ma non troppo"
c'
\repeat unfold 31 c'4
}
\new Lyrics \lyricmode {
\repeat unfold 19 xy
whateverlongtext
\repeat unfold 28 xy
}
\layout {
\context {
\Score
\override NonMusicalPaperColumn.keep-inside-line = #'()
\override PaperColumn.keep-inside-line = #'()
}
}
}


Though I think there's a bug somewhere.

Play around with the code below.
I made it so, that you only need to change one numeric value in the
function call, i.e. increase the 0.00 in \addScore #(+ 64.25 0.00)
As soon as 0.01 is chosen the StaffSymbol's extent is increased
although there's really no need for (larger numbers make it more
obvious).
I suspect the extents of TextScript and Mark are _added_, whereas one
should take the _maximum_ of both.
Maybe some confusing happens because TextScript is usually in
PaperColumn's elements whereas the others are in the
NonMusicalPaperColumn's elements, but here I'm really guessing...
Interestingly the value 64.25 is very close to half of the line-width
plus left/right-margin-_default_ (not the scaled left/right-margin).

But here the code for testing:

\version "2.19.82"


%% A boxed stencil with settable width, for Mark and TextScript
#(define (x-var-stil x)
(box-stencil (ly:make-stencil '() (cons 0 x) '(-1 . 1)) 0 0))

%% A procedure to display StaffSymbol.stencil, line-width,
%% left- and right-margin
#(define print-staff-symbol-stil-length
(lambda (staff-symbol)
(format #t
"\n\tStaffSymbol.stencil has length: ~a
\tline-width is: ~a
\tleft-margin is: ~a
\trightmargin is: ~a\n"
(interval-length
(ly:stencil-extent (ly:staff-symbol::print staff-symbol) X))
(ly:output-def-lookup (ly:grob-layout staff-symbol) 'line-width)
(ly:output-def-lookup (ly:grob-layout staff-symbol) 'left-margin)
(ly:output-def-lookup (ly:grob-layout staff-symbol) 'right-margin))))

%% A void function adding a score to current book. The score has a
%% RehearsalMark and a TextScript. Those grobs stencil-width are set by the
%% 'val'-argument.
addScore =
#(define-void-function (val)(number?)
(add-score
#{

\score {
{ \mark \default c'1 _"" \noBreak 1 1 }
\layout {
indent = 0
\context {
\Score
\omit BarNumber
\override RehearsalMark.stencil = #(x-var-stil val)
%\override NonMusicalPaperColumn.keep-inside-line = #'()
%\override PaperColumn.keep-inside-line = #'()
}
\context {
\Staff
\override StaffSymbol.after-line-breaking =
#print-staff-symbol-stil-length
}
\context {
\Voice
\textLengthOn
\override TextScript.stencil = #(x-var-stil val)
}
}
}
#}))

\addScore #(+ 64.25 0.00)

Anyone with further insights?


Cheers,
Harm
David Sumbler
2018-11-25 21:51:43 UTC
Permalink
-----Original Message-----
From: Thomas Morley <***@gmail.com>
To: Phil Holmes <***@philholmes.net>
CC: David Sumbler <***@aeolia.co.uk>, Pedro Pessoa <
***@gmail.com>, lilypond-user <lilypond-***@gnu.org>
Subject: Re: Spacing issue after Mark and TextScript
Date: Sun, 25 Nov 2018 17:38:31 +0100

Am So., 25. Nov. 2018 um 16:09 Uhr schrieb Phil Holmes <
Post by Phil Holmes
----- Original Message -----
Post by David Sumbler
The parameters NonMusicalPaperColumn and suchlike have long been a
mystery to me. If it can be done reasonably succinctly, could you
perhaps explain what NonMusicalPaperColumn.keep-inside-line #'() and
PaperColumn.keep-inside-line #'() actually do?
David
Checking to make sure that text scripts and lyrics are within the margins
requires additional
calculations. In cases where slightly faster performance is desired, use
\override Score.PaperColumn #'keep-inside-line = ##f
and
keep-inside-line (boolean)
If set, this column cannot have objects sticking into the margin.
Hope that makes sense.
--
Phil Holmes
To illustrate what Phil wrote, compile the following code with and
without the relevant overrides:

\score {
<<
{
\repeat unfold 16 { c'4 \noBreak }
\tempo "Allegro molto, ma non troppo"
c'
\repeat unfold 31 c'4
}
\new Lyrics \lyricmode {
\repeat unfold 19 xy
whateverlongtext
\repeat unfold 28 xy
}
\layout {
\context {
\Score
\override NonMusicalPaperColumn.keep-inside-line = #'()
\override PaperColumn.keep-inside-line = #'()
}
}
}


Though I think there's a bug somewhere.

Play around with the code below.
I made it so, that you only need to change one numeric value in the
function call, i.e. increase the 0.00 in \addScore #(+ 64.25 0.00)
As soon as 0.01 is chosen the StaffSymbol's extent is increased
although there's really no need for (larger numbers make it more
obvious).
I suspect the extents of TextScript and Mark are _added_, whereas one
should take the _maximum_ of both.
Maybe some confusing happens because TextScript is usually in
PaperColumn's elements whereas the others are in the
NonMusicalPaperColumn's elements, but here I'm really guessing...
Interestingly the value 64.25 is very close to half of the line-width
plus left/right-margin-_default_ (not the scaled left/right-margin).

But here the code for testing:

\version "2.19.82"


%% A boxed stencil with settable width, for Mark and TextScript
#(define (x-var-stil x)
(box-stencil (ly:make-stencil '() (cons 0 x) '(-1 . 1)) 0 0))

%% A procedure to display StaffSymbol.stencil, line-width,
%% left- and right-margin
#(define print-staff-symbol-stil-length
(lambda (staff-symbol)
(format #t
"\n\tStaffSymbol.stencil has length: ~a
\tline-width is: ~a
\tleft-margin is: ~a
\trightmargin is: ~a\n"
(interval-length
(ly:stencil-extent (ly:staff-symbol::print staff-symbol) X))
(ly:output-def-lookup (ly:grob-layout staff-symbol) 'line-width)
(ly:output-def-lookup (ly:grob-layout staff-symbol) 'left-margin)
(ly:output-def-lookup (ly:grob-layout staff-symbol) 'right-
margin))))

%% A void function adding a score to current book. The score has a
%% RehearsalMark and a TextScript. Those grobs stencil-width are set by
the
%% 'val'-argument.
addScore =
#(define-void-function (val)(number?)
(add-score
#{

\score {
{ \mark \default c'1 _"" \noBreak 1 1 }
\layout {
indent = 0
\context {
\Score
\omit BarNumber
\override RehearsalMark.stencil = #(x-var-stil val)
%\override NonMusicalPaperColumn.keep-inside-line = #'()
%\override PaperColumn.keep-inside-line = #'()
}
\context {
\Staff
\override StaffSymbol.after-line-breaking =
#print-staff-symbol-stil-length
}
\context {
\Voice
\textLengthOn
\override TextScript.stencil = #(x-var-stil val)
}
}
}
#}))

\addScore #(+ 64.25 0.00)

Anyone with further insights?


Cheers,
Harm

*****************

I have often wondered what the "Column" in PaperColumn etc. refers to.
Now I understand that it refers to all the objects within a line of a
score.

The keep-inside-line parameter is a boolean, which defaults to #t. But
I find myself somewhat confused. In the above code, if the keep-
inside-line override is commented out, or if keep-inside-line is set to
##t (which is in any case the default), the staff extends beyond the
right-hand margin. If keep-inside-line is set to ##f or #'(), the
staff conforms to the margins. This is contrary to what one would
expect from NR 1.8.1, 2.1.2 and A18. It is also the exact opposite of
what the name "keep-inside-line" suggests: a better name would seem to
be "allow-outside-margin".

Also I note that in this particular case, changing
NonMusicalPaperColumn.keep-inside-line has no effect. Only
PaperColumn.keep-inside-line affects the output. Does
NonMusicalPaperColumn perhaps do the same job for passages of pure
markup?

David
Thomas Morley
2018-11-25 23:33:01 UTC
Permalink
Post by David Sumbler
The keep-inside-line parameter is a boolean, which defaults to #t. But
I find myself somewhat confused. In the above code, if the keep-
inside-line override is commented out, or if keep-inside-line is set to
##t (which is in any case the default), the staff extends beyond the
right-hand margin. If keep-inside-line is set to ##f or #'(), the
staff conforms to the margins. This is contrary to what one would
expect from NR 1.8.1, 2.1.2 and A18. It is also the exact opposite of
what the name "keep-inside-line" suggests: a better name would seem to
be "allow-outside-margin".
Well, you wrote "in the code above", though I posted two different
codings. Which one do you refer to?

(1)
The first was meant to illustrate the current default behaviour, i.e.
keep-inside-line is #t
See the attached files.
keep-inside-line-01.ly is the current default
keep-inside-line-02.ly unsets keep-inside-line
Outcome of both is as I would expect.

(2)
The second [with \addScore #(+ 64.25 0.00)] points to a possible bug,
which may occur under certain circumstances.
Ofcourse there you can expect strange behaviour, this code is _meant
_to spot it.
Post by David Sumbler
Also I note that in this particular case, changing
NonMusicalPaperColumn.keep-inside-line has no effect. Only
PaperColumn.keep-inside-line affects the output. Does
NonMusicalPaperColumn perhaps do the same job for passages of pure
markup?
Don't know, never tested.
Though it does not make much sense to set keep-inside-line differently
for PaperColumn and NonMusicalPaperColumn, imho.

Btw, you can make them visible with:

\layout {
\context {
\Score
%% Enable only one, too confusing otherwise
%\override PaperColumn.stencil = #ly:paper-column::print
\override NonMusicalPaperColumn.stencil = #ly:paper-column::print
}
}

IR says:
Function: ly:paper-column::print
Optional stencil for PaperColumn orNonMusicalPaperColumn. Draws
the rank number of each column, its moment in time, a blue arrow
showing the ideal distance, and a red arrow showing the minimum
distance between columns.


Cheers,
Harm

Loading...