bug-lilypond
[Top][All Lists]
Advanced

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

Re: self-alignment-X has negligible effects on dynamics


From: Janek Warchoł
Subject: Re: self-alignment-X has negligible effects on dynamics
Date: Mon, 28 Jul 2014 22:17:06 +0200

Hi,

2014-07-28 16:13 GMT+02:00 David Nalesnik <address@hidden>:
> In the following example, the ordinary overrides of self-alignment-X appear
> to have no effect on the position pf the dynamics (or an effect I can't
> see).  Large numbers are needed for an obvious shift.
>
> Is this a bug, or something I'm doing wrong?

You're misusing self-alignment-X.  This feature is *not* for shifting
stuff - it is meant for aligning particular point of an object on a
particular point of its parent.  For example, self-alignment-X = #LEFT
means "place this object so that its left edge (i.e. left end of
X-extent) is horizontally aligned with its parent's left edge".  It
doesn't mean "move stuff around". Look:

{
  % draw boxes around grobs, representing their extents
  \override DynamicText.stencil =
    #(make-stencil-boxer 0.03 0 ly:text-interface::print)
  \override NoteHead.stencil =
    #(make-stencil-boxer 0.03 0 ly:note-head::print)

  \override DynamicText.self-alignment-X = #RIGHT
  % forte's right edge is aligned with notehead's right edge
  c'4\f
  \override DynamicText.self-alignment-X = #LEFT
  % forte's left edge is aligned with notehead's left edge
  c'4\f
  % forte's center is aligned with notehead's center
  \override DynamicText.self-alignment-X = #CENTER
  c'4\f
}

% see what happens when we use wider dynamics:
{
  % draw boxes around grobs, representing their extents
  \override DynamicText.stencil =
    #(make-stencil-boxer 0.03 0 ly:text-interface::print)
  \override NoteHead.stencil =
    #(make-stencil-boxer 0.03 0 ly:note-head::print)

  \override DynamicText.self-alignment-X = #RIGHT
  % forte's right edge is aligned with notehead's right edge
  c'2\fff
  \override DynamicText.self-alignment-X = #LEFT
  % forte's left edge is aligned with notehead's left edge
  c'\fff
}

% Using numbers outside [-1, 1] interval for alignment doesn't make
% much sense.  What does it mean if self-alignment-X = #5 ?  What is
% aligned to what?  It's hard to say what this means in English at all.

% Of course, we could use some more alignment options.
% That's exactly what I'm doing in issue 4022.
% With https://code.google.com/p/lilypond/issues/detail?id=4022 ,
% this code will produce output as in the attachment:
{
  % draw boxes around grobs, representing their extents
  \override DynamicText.stencil =
    #(make-stencil-boxer 0.03 0 ly:text-interface::print)
  \override NoteHead.stencil =
    #(make-stencil-boxer 0.03 0 ly:note-head::print)

  \override DynamicText.self-alignment-X = #`(,RIGHT . ,LEFT)
  % forte's right edge is aligned with notehead's left edge
  c'2\f
  \override DynamicText.self-alignment-X = #`(,LEFT . ,RIGHT)
  % forte's left edge is aligned with notehead's right edge
  c'\f
}

% Now, if you want to "move stuff around", use X-offset, not
% self-alignment-X:
{
  \override DynamicText.stencil =
    #(make-stencil-boxer 0.03 0 ly:text-interface::print)
  \override NoteHead.stencil =
    #(make-stencil-boxer 0.03 0 ly:note-head::print)

  \override DynamicText.X-offset = -2.5
  c'2\f
  \override DynamicText.X-offset = 1
  c'\f
}

% Maybe some day we'll have a more unified interface for both
% moving stuff around and aligning it - i'm working on this - but
% for now these are separate tasks.

% Is this clearer now?

% Janek

Attachment: alignment-examples.png
Description: PNG image


reply via email to

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