lilypond-user
[Top][All Lists]
Advanced

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

Re: Spacing issue after Mark and TextScript


From: David Sumbler
Subject: Re: Spacing issue after Mark and TextScript
Date: Sun, 25 Nov 2018 21:51:43 +0000

-----Original Message-----
From: Thomas Morley <address@hidden>
To: Phil Holmes <address@hidden>
CC: David Sumbler <address@hidden>, Pedro Pessoa <
address@hidden>, lilypond-user <address@hidden>
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 <
address@hidden>:
> 
> ----- Original Message -----
> From: "David Sumbler" <address@hidden>
> 
> > 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
> 

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




reply via email to

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