Hi Harm,
thank you for this. From the *behaviour* this seems like what I need,
but I have a few questions that may make it not really usable for my case.
Am 24.10.2018 um 18:25 schrieb Thomas Morley:
Am Di., 23. Okt. 2018 um 08:28 Uhr schrieb Urs Liska <li...@openlilylib.org>:
Hi,
I want to use TextScript.staff-padding to produce markup elements that
are aligned to their baseline. In order to prevent the texts from moving
vertically to avoid collisions I used \textLengthOn (or its spelled-out
variant):
\version "2.19.82"
test =
#(define-event-function (text)(markup?)
#{
-\tweak extra-spacing-width #(cons -0.0 0.4)
-\tweak extra-spacing-height #(cons -inf.0 +inf.0)
-\tweak staff-padding 3
-\markup #text
#})
\relative {
c''8 ^\test "foobar" d16 c
c8 ^\test "foobar" d16 ^\test "John Doe" c
}
However, this does not only push the next notes when there actually is
some neighboring text (as in the second beat of the following example)
but also when it wouldn't be needed (see atttached image):
Uncommenting the extra-spacing... tweaks will result in the texts moving
vertically which is not desired.
Is there another approach to make the following note columns move - but
only if there *is* something in the way?
Thanks
Urs
Hi Urs,
from your description it sounds you need sort of a spanner with
adjustable length.
Attached some coding hacking TextSpanner.
What do you think?
I didn't understand the code in detail, but am I right that
* the code basically prints the texts as the start of a TextSpanner
* \endTextSpanners parses a music expression and adds a \stopTextSpan
automatically for any \startTextSpan
* \testII creates such a \startTextSpan to be processed by
\endTextSpanners
?
If so this means that all the music must be wrapped in an
\endTextSpanners expression, isn't it? If this is true then I would be
quite a stretch to integrate this solution into my environment, because
the input files are part of the edition in this case. They will be made
available within a TEI file and therefore have to be extremely clean. So
far there is exactly one \include and then either a single music
expression (for a single-voice music example) or several music variables
plus a custom \loadTemplate command that loads a file with a \score
block to make use of the music variables.
For the first case (simple music expression) I can achieve the result by
calling \endTextSpanners at the very end of the include file so the
music expression will be used as the argument for the function. But for
the other cases I'm not sure how I could arrange my files. In addition I
only need this functionality in a subset of my >560 files, but such a
solution could probably not be optional in the way I'm doing it
elsewhere in the project. (The main include file loads a
<filename>-include.ily file if that is present on disk. Within that
optional file I can place a layout block, edition-engraver mods and an
arbitrary number of \loadTool commands. While this latter function
probably isn't necessary for efficiency reasons (it would probably be
easier to simply include all the available code for each compiled file),
it is a nice way to document the specific needs of an example.)
I think I'll do some more experiments with the code itself before trying
to integrate this.
Hm, as said I don't fully understand the code. But if I'm not mistaken
\endTextSpanners works by first identifying a music expression that
holds a \startTextSpan event and then adding a \stopTextSpan event to
the note, rest or chord. Would it be possible to achieve the same thing
directly from a music-function or event-function? Maybe if \testII
wouldn't be an event function but a music-function taking the
note/rest/chord as an argument, like
\testII ##t "John Doe" c'
where the TextSpanner is added to the c' ?
Best
Urs
Cheers,
Harm
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user