lilypond-user
[Top][All Lists]
Advanced

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

Making accidentals truly take up no horizontal space


From: Trevor Bača
Subject: Making accidentals truly take up no horizontal space
Date: Wed, 14 Feb 2007 21:53:54 -0600

Hi,

Tip or trick directed primarily at the proportional notation crowd.

For some time I've wondered how to get accidentals to truly take up no
horizontal space. I first thought the answer would be in turning on
strict-note-spacing because strict-note-spacing causes the horziontal
space of clefs and time signatures to take up no horizontal space. But
for accidentals the answer turns out to be overriding accidental
X-extent to zero.

Here were the files that brought me to that conclusion.

First, here's a pair of scores that render right on top of each other
and show that both the sharp and natural do, in fact, add extra
horizontal space. We can see this easily because the second score not
only does not align exactly with the first score but actually takes up
more horizontal space overall.

%%% BEGIN EX 1 %%%

\version "2.11.18"

\paper { ragged-right = ##t }

\new Staff {
  \set Score.proportionalNotationDuration = #(ly:make-moment 1 32)
  c'16
  c'16
  c'16
  c'16
  c'16
  c'16
  c'16
  c'16
}

\new Staff {
  \set Score.proportionalNotationDuration = #(ly:make-moment 1 32)
  c'16
  cis'16
  c'16
  c'16
  c'16
  c'16
  c'16
  c'16
}

%%% END EX 1 %%%


From here we can try turning on strict-note-spacing, but we notice
that strict-note-spacing does nothing to the accidentals.

%%% BEGIN EX 2 %%%

\new Staff {
  \set Score.proportionalNotationDuration = #(ly:make-moment 1 32)
  \override Score.SpacingSpanner #'strict-note-spacing = ##t
  c'16
  cis'16
  c'16
  c'16
  c'16
  c'16
  c'16
  c'16
}

%%% END EX 2 %%


However, if we override accidental X-extent to zero, we've
accomplished the first part of the goal.

%%% BEGIN EX 3 %%%

\new Staff {
  \set Score.proportionalNotationDuration = #(ly:make-moment 1 32)
  \override Accidental #'X-extent = #'(0 . 0)
  c'16
  cis'16
  c'16
  c'16
  c'16
  c'16
  c'16
  c'16
}

%%% END EX 3 %%%


The accidentals no truly consume no horizontal space. But we have to
fix the overprint. I'm sure that one of the Scheme Gurus can do this
super-elegantly (and I'm pretty sure the method is by overriding
Accidental #'X-offset-callbacks), but I have absolutely no idea how to
do this.

Instead, there's always extra-offset.

%%% BEGIN EX 4 %%%

\new Staff {
  \set Score.proportionalNotationDuration = #(ly:make-moment 1 32)
  \override Accidental #'X-extent = #'(0 . 0)
  \override Accidental #'extra-offset = #'(-1 . 0)
  c'16
  cis'16
  c'16
  c'16
  c'16
  c'16
  c'16
  c'16
}

%%% END EX 4 %%%


I was quite excited when I figured this out after thinking about one
of Mats's posts on overriding X-extent for dynamics. I think this is
the first time I've finally realized how to use X-extent: pass in a
PAIR of numbers, not a single number. That means that zero X-extent is
#'X-extent = #'(0 . 0) rather than #'X-extent = #0.


--
Trevor Bača
address@hidden

reply via email to

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