bug-lilypond
[Top][All Lists]
Advanced

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

Re: \balloonText applied to single note errors with symbol->string ??


From: Thomas Morley
Subject: Re: \balloonText applied to single note errors with symbol->string ??
Date: Sun, 29 Sep 2019 12:53:28 +0200

Am Sa., 28. Sept. 2019 um 21:54 Uhr schrieb David Kastrup <address@hidden>:
>
> Thomas Morley <address@hidden> writes:
>
> > Hi,
> >
> > the code below
> >
> > \layout { \context { \Voice \consists "Balloon_engraver" } }
> > { c'-\balloonText #'(2 . 0) \markup { "1" } }
> >
> > returns (in 2.21.0):
> > ERROR: In procedure symbol->string:
> > ERROR: Wrong type argument in position 1 (expecting symbol): ()
> >
> > 2.18.2 gives a more useful message:
> > /home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
> > In procedure symbol->string in expression (process-procedure book
> > paper ...):
> > /home/hermann/lilypond/usr/share/lilypond/current/scm/lily-library.scm:242:8:
> > Wrong type argument in position 1 (expecting symbol): ()
> >
> > Though, I've no clue where symbol->string comes into the game...
>
> In lily/balloon-engraver.cc
>
> > Ofcourse the NR recommends to use balloonText _inside_ of chords, and
> > indeed the problem goes away, wrapping the note in an event-chord.
> > But shouldn't it work as a postevent to a single note, too??
>
> The implementation does not work with separate AnnotateOutput events
> (more exactly, they require specifying the particular grob type to use
> since usually a number of grobs could be annotated).  One could try to
> capture all rhythmic-events and annotate them all.  It's all reasonably
> icky stuff that should at one point of time be upgraded to look like
> what we do with footnotes.  As a stopgap measure, one could use the
> following patch for a bit nicer behavior.

Hi David,

thanks for the explanations.
A warning directly pointing to the problem is of course very helpful.

Though, how about making balloonText work outside of chords? Therefore
one could provide an optional default argument, i.e. NoteHead, for
in-chord usage.
balloonGrobText could rely on it then.
See the code below.
The persisting problem is ofcourse how to annotate a single item of
multiple others of the same kind in an event-chord?
I found no nice way to do so, neither with current state of master nor
with my suggestion.

\version "2.21.0" %% works for lower versions as well

balloonText-test =
#(define-event-function (grob offset text)
  ((symbol? 'NoteHead) number-pair? markup?)
   (_i "Attach @var{text} at @var{offset} (use like @code{\\tweak})")
   (make-music 'AnnotateOutputEvent
               'symbol grob
               'X-offset (car offset)
               'Y-offset (cdr offset)
               'text text))

balloonGrobText-test =
#(define-music-function (grob-name offset text)
   ((symbol? 'NoteHead) number-pair? markup?)
   (_i "Attach @var{text} to @var{grob-name} at offset @var{offset}
 (use like @code{\\once})")
   (make-event-chord (list (balloonText-test grob-name offset text))))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\layout { \context { \Voice \consists "Balloon_engraver" } }

{
    \balloonLengthOn
    %% "post-event" for NoteHead (default), Flag, Rest, Fingering, NoteHead in
    %% event-chord
    c'4-\balloonText-test #'(1 . 5) "NoteHead"
    d'8-\balloonText-test Flag #'(2 . -2) "Flag"
    r-\balloonText-test Rest #'(2 . 4) "Rest"
    e'4-1-\balloonText-test Fingering #'(1 . 5) "Fingering"
    <d' f'-\balloonText-test #'(2 . -2) "NoteHead" a'>
}

{
  %% "\once \override" for Stem, Rest, NoteHead (default)
  \balloonGrobText-test Stem #'(3 . 4) "I'm a Stem"
  b4
  \balloonGrobText-test Rest #'(-4 . -4) "I'm a rest"
  r
  \balloonGrobText-test #'(4 . -4) "I'm a note head"
  c'
  %% How to annotate a single Item in an event-chord, like one Fingering among
  %% multiple ones?
  %% balloonGrobText-test catches all, \balloonText-test always the NoteHead
  %%   (as well as the default \balloonGrobText and \balloonText)
  \balloonGrobText-test StringNumber #'(1 . 1) "I'm a string number"
  <
    e'\2 -\balloonText-test StringNumber #'(1 . 2) "Fail for StringNumber"
    g'\4
  >
}


Thanks,
  Harm



reply via email to

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