Thomas Morley <thomasmorle...@gmail.com> 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.

>From 90aaea796acefa5bf294c6d5ed473b1168307019 Mon Sep 17 00:00:00 2001
From: David Kastrup <d...@gnu.org>
Date: Sat, 28 Sep 2019 21:52:11 +0200
Subject: [PATCH] Warn about \balloonText outside of chords

---
 lily/balloon-engraver.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lily/balloon-engraver.cc b/lily/balloon-engraver.cc
index 23be7406a5..86de83f4f9 100644
--- a/lily/balloon-engraver.cc
+++ b/lily/balloon-engraver.cc
@@ -18,7 +18,7 @@
 */
 
 #include "engraver.hh"
-
+#include "international.hh"
 #include "stream-event.hh"
 #include "item.hh"
 
@@ -40,6 +40,11 @@ class Balloon_engraver : public Engraver
 void
 Balloon_engraver::listen_annotate_output (Stream_event *ev)
 {
+  if (!scm_is_symbol (ev->get_property ("symbol")))
+    {
+      ev->origin ()->warning (_ ("\\balloonText can only be used inside of chords"));
+      return;
+    }
   events_.push_back (ev);
 }
 
-- 
2.20.1


-- 
David Kastrup
_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to