Hi Torsten,
thanks for these explanations.
Am 29.07.2018 um 19:22 schrieb Torsten Hämmerle:
Trevor Bača-2 wrote
Torsten, how are you achieving the text centered above the pair of half
notes in the original example (ie, in the measure top-headed with
"Minima")? Try as I might, I can't get it!
Hi Trevor,
You've got me there! ;)
Standard \textLengthOn will push away neighbouring notes and you won't get
the markup text to neatly and symmetrically align with the barlines without
some tweaking.
\textLengthOn just sets the following two properties:
\override TextScript.extra-spacing-width = #'(-0.0 . 0.4)
\override TextScript.extra-spacing-height = #'(-inf.0 . +inf.0)
By adapting extra-spacing-width, we can actually set the left and right
"margins" of the text. This way, we can attach the TextScript to the second
note and make it overlap the first note.
Finally (this is not necessary, though) I've shifted both notes to the right
by using extra-offset to better match the original.
<http://lilypond.1069038.n5.nabble.com/file/t3887/textlength-modified.png>
%%%%%%%
{
\override TextScript.self-alignment-X = #CENTER
% custom version of \textLengthOn:
\override TextScript.extra-spacing-width = #'(2.6 . 0.4) % default:
#'(-0.0 . 0.4)
\override TextScript.extra-spacing-height = #'(-inf.0 . +inf.0)
% Shift NoteHead and Stem to the right
\override NoteHead.extra-offset = #'(5 . 0)
\override Stem.extra-offset = #'(5 . 0)
R1
\bar "||"
c''2 c''^\markup \line { \typewriter "#'extra-offset" "trickery" }
\bar "||"
}
%%%%%%
HTH,
Torsten
So if I see correctly this means your essentially doing a regular
\textLengthOn that would push the neighboring notes away but prevent
that by manually setting a "negative padding". And this has to be
adjusted to the content around the element with the markup on it. Which
makes it even less likely to get a decently working solution as a
*function* that automatically determines the widths to set. I can
imagine going through the note columns of the current system/measure and
do some calculations, but earlier intense experiments with this area (I
had to create manually drawn slur replacments) make be doubt that the
width values needed for this are available at the point where I still
can change the extra-spacing-width.
Plus: it seems this approach is problematic when more than one other
note is in the area covered by the text (see attached PNG):
%%%%%%%
{
\override TextScript.self-alignment-X = #CENTER
\override TextScript.extra-spacing-width = #'(5 . 0.4)
\override TextScript.extra-spacing-height = #'(-inf.0 . +inf.0)
R1
\bar "||"
c''4 c'' c''2^\markup \line { \typewriter "#'extra-offset" "trickery" }
\bar "||"
}
%%%%%%
Best
Urs, who is trying further ...
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user