lilypond-user
[Top][All Lists]
Advanced

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

Re: Dynamics differently positioned on rests than on notes


From: Neil Puttock
Subject: Re: Dynamics differently positioned on rests than on notes
Date: Fri, 23 Jul 2010 16:51:22 +0100

On 23 July 2010 16:01, Reinhold Kainhofer <address@hidden> wrote:
> I'm running into a problem with a score there lots of dynamic signs are placed
> on a rest at the beginning of a measure. These dynamics are placed too far to
> the left, causing them to collide with the barline...
>
> Attached is an example.
> Isn't this a bug?

I think so.

This is the same problem you get with the Dynamics context, where the
dynamics are aligned to paper columns.

This, from New_dynamic_engraver::acknowledge_note_column (),  is
probably the source of the bug:

 227   if (script_ && !script_->get_parent (X_AXIS))
 228     {
 229       extract_grob_set (info.grob (), "note-heads", heads);
 230       if (heads.size ())
 231         {
 232           Grob *head = heads[0];
 233           script_->set_parent (head, X_AXIS);
 234           Self_alignment_interface::set_center_parent (script_, X_AXIS);
 235         }
 236     }

Where there's only a rest, the NoteColumn has no cached noteheads, so
the default X-parent lands on a PaperColumn, and there's no centring.

Perhaps something like this would be better (obviously would need a
comment to explain the special case for a NoteColumn containing a
single rest):

  if (script_ && !script_->get_parent (X_AXIS))
    {

      extract_grob_set (info.grob (), "note-heads", heads);
      Grob *x_parent = (heads.size ()
                        ? heads[0]
                        : unsmob_grob (info.grob ()->get_object ("rest")));
        if (x_parent)
          {
            script_->set_parent (x_parent, X_AXIS);
            Self_alignment_interface::set_center_parent (script_, X_AXIS);
          }
    }

Cheers,
Neil



reply via email to

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