lilypond-devel
[Top][All Lists]
Advanced

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

Re: Why is NonMusicalPaperColumn.line-break-system-details.extra-offset


From: Jean Abou Samra
Subject: Re: Why is NonMusicalPaperColumn.line-break-system-details.extra-offset "upside down"?
Date: Sat, 1 Jan 2022 22:42:08 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1

Le 01/01/2022 à 22:21, Carl Sorensen a écrit :

On 1/1/22, 2:05 PM, "Kieren MacMillan" <kieren@kierenmacmillan.info> wrote:

     Hi Carl,
> I assume it is because the negative offset reduces the skyline of the broken (following) system, which allows the spacing engine to raise that system. But extra-offset doesn't (or at least shouldn't) affect the spacing engine, right?

extra-offset affects the position of grobs *relative to the staff containing 
them*.  When the Y position of a grob is increased, it either has no affect on 
the location of the staff, or it lowers the staff due to required spacing from 
the staff above.  Since after-line-breaking is the bottom staff, a positive Y 
extra-offset value should have no affect or lower the bottom staff, to be 
consistent with positive Y extra-offset for every other grob on the staff, it 
seems to me.

extra-offset doesn’t change the staff-staff spacing parameters, but it does 
change the grob locations used in the staff-staff spacing calculations.

I think this is all consistent, but I could be wrong.


I am pretty sure that page spacing calculations are
insensitive to extra offsets. For example:

\version "2.22.1"

<<
  \new Staff {
    \once \override Staff.Clef.Y-offset = -20
    c'1
  }
  \new Staff { c'1 }
>>

<<
  \new Staff {
    \once \override Staff.Clef.extra-offset = #'(0 . -20)
    c'1
  }
  \new Staff { c'1 }
>>


extra-offset of all grobs but a System itself is handled
in system.cc:

SCM
System::get_paper_system ()
{
  [...]
  for (vsize j = 0; j < entries.size (); j++)
    {
      Grob *g = entries[j].grob_;
      Stencil st = g->get_print_stencil ();

      if (scm_is_null (st.expr ()))
        continue;

      Offset o;
      for (const auto a : {X_AXIS, Y_AXIS})
        o[a] = g->relative_coordinate (this, a);

      Offset extra = from_scm (get_property (g, "extra-offset"),
                               Offset (0, 0))
                     * Staff_symbol_referencer::staff_space (g);

      /* Must copy the stencil, for we cannot change the stencil
         cached in G.  */

      st.translate (o + extra);

      *tail = scm_cons (st.expr (), SCM_EOL);
      tail = SCM_CDRLOC (*tail);
    }

  if (auto *me = get_stencil ())
    exprs = scm_cons (me->expr (), exprs);

  Interval x (extent (this, X_AXIS));
  Interval y (extent (this, Y_AXIS));
  Stencil sys_stencil (Box (x, y),
                       scm_cons (ly_symbol2scm ("combine-stencil"),
                                 exprs));
  [...]

  Paper_column *left_bound = get_bound (LEFT);
  SCM prop_init = get_property (left_bound, "line-break-system-details");
  Prob *pl = make_paper_system (prop_init);
  paper_system_set_stencil (pl, sys_stencil);

  /* information that the page breaker might need */
  Paper_column *right_bound = get_bound (RIGHT);
  set_property (pl, "vertical-skylines", get_property (this, "vertical-skylines"));   set_property (pl, "page-break-permission", get_property (right_bound, "page-break-permission"));   set_property (pl, "page-turn-permission", get_property (right_bound, "page-turn-permission"));   set_property (pl, "page-break-penalty", get_property (right_bound, "page-break-penalty"));   set_property (pl, "page-turn-penalty", get_property (right_bound, "page-turn-penalty"));

  [...]
}


So this takes extra-offset into account when constructing
the big stencil that gathers all stencils of a system's
grobs, but that big stencil's extent is taken from
the System's X-extent and Y-extent, which do not take
extra offsets into account, and same for the skyline.
The whole system is therefore insensitive to extra offsets
with regard to spacing (and so are the VerticalAxisGroups
for spacing between staves).

I don't know much about the code that places systems on
the page, but I think the issue is just that there are
two code paths applying extra-offsets, with two different
coordinate systems.

Kind regards,
Jean




reply via email to

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