\book {
\relative c'' {
-\once \override FootnoteSpanner #'spanner-placement = #-0.7
\footnoteGrob #'Hairpin
#'(0.5 . 0.5)
\markup { \tiny "1." }
- \markup { 1. \justify { Goes to the second broken spanner. } }
+ \markup { 1. \justify { Goes to the first broken spanner. } }
b4\< c d a
b c d a
b c d a
b c d a
b c d a\!
-\once \override FootnoteSpanner #'spanner-placement = #1.0
+\once \override FootnoteSpanner #'spanner-placement = #RIGHT
\footnoteGrob #'Hairpin
#'(0.5 . 0.5)
\markup { \tiny "2." }
return internal_balloon_print (me, p, off);
}
-// ugh...code dup...hopefully can be consolidated w/ above one day
MAKE_SCHEME_CALLBACK (Balloon_interface, print_spanner, 1);
SCM
Balloon_interface::print_spanner (SCM smob)
{
Spanner *me = unsmob_spanner (smob);
- Grob *orig = me->original ();
+ Spanner *orig = dynamic_cast<Spanner *> (me->original ());
if (orig)
{
- // TODO : consolidate code dup from System::get_footnote_grobs_in_range
- int pos = orig->spanned_rank_interval ()[LEFT];
- Real spanner_placement = min (1.0,
- max (robust_scm2double (me->get_property ("spanner-placement"), -1.0),
- -1.0));
+ Direction spanner_placement = robust_scm2dir (me->get_property ("spanner-placement"), LEFT);
- spanner_placement = (spanner_placement + 1.0) / 2.0;
- int rpos = orig->spanned_rank_interval ()[RIGHT];
- pos = (int)((rpos - pos) * spanner_placement + pos + 0.5);
+ Spanner *wanted = (spanner_placement != RIGHT)
+ ? orig->broken_intos_[0]
+ : orig->broken_intos_.back ();
- if (pos < me->spanned_rank_interval () [LEFT])
- return SCM_EOL;
- if (pos >= me->spanned_rank_interval () [RIGHT] && (me->spanned_rank_interval () [RIGHT] != orig->spanned_rank_interval () [RIGHT]))
+ if (me != wanted)
return SCM_EOL;
}
bool end_of_line_visible = true;
if (Spanner *s = dynamic_cast<Spanner *>(footnote_grobs_[i]))
{
- Real spanner_placement = min (1.0,
- max (robust_scm2double (s->get_property ("spanner-placement"), -1.0),
- -1.0));
+ Direction spanner_placement = robust_scm2dir (s->get_property ("spanner-placement"), LEFT);
+ if (spanner_placement == CENTER)
+ spanner_placement = LEFT;
- spanner_placement = (spanner_placement + 1.0) / 2.0;
- int rpos = s->spanned_rank_interval ()[RIGHT];
- pos = (int)((rpos - pos) * spanner_placement + pos + 0.5);
+ pos = s->spanned_rank_interval ()[spanner_placement];
}
if (Item *item = dynamic_cast<Item *>(footnote_grobs_[i]))
end_of_line_visible = (LEFT == item->break_status_dir ());
}
- if (pos < (int)start)
+ if (pos < int (start))
continue;
- if (pos > (int)end)
+ if (pos > int (end))
break;
- if (pos == (int)start && end_of_line_visible)
+ if (pos == int (start) && end_of_line_visible)
continue;
- if (pos == (int)end && !end_of_line_visible)
+ if (pos == int (end) && !end_of_line_visible)
continue;
if (!footnote_grobs_[i]->is_live ())
continue;
(spacing-wishes ,ly:grob-array? "An array of note spacing or staff spacing
objects.")
(span-start ,boolean? "Is the note head at the start of a spanner?")
- (spanner-placement ,number? "The place of an annotation on a spanner.
-Note that this number must be between -1 and 1, with -1 representing the
-beginning of the spanner and 1 representing the end. The annotation will
-still be placed at the left or right extremity of the spanner, but this
-number ensures that when line breaking happens, the annotation is assigned
-to the correct broken piece and the footnote is put on the correct page.
-An important caveat is that this number applies to column ranks, not staff
-space. For example, 0 will place the annotation at the middle column of
-its parent's span, which may be to the right or left of the physical middle
-of the spanner.")
+ (spanner-placement ,ly:dir? "The place of an annotation on a spanner.
+LEFT is for the first spanner, and RIGHT is for the last. CENTER will
+place it on the broken spanner that falls closest to the center of the length
+of the entire spanner, although this behavior is unpredictable in situations
+with lots of rhythmic diversity. For predictable results, use LEFT and RIGHT.")
(staff-grouper ,ly:grob? "The staff grouper we belong to.")
(staff-symbol ,ly:grob? "The staff symbol grob that we are in.")
(stem ,ly:grob? "A pointer to a @code{Stem} object.")
(annotation-balloon . #f)
(annotation-line . #t)
(footnote-text . ,(grob::calc-property-by-copy 'footnote-text))
- (spanner-placement . -1.0)
+ (spanner-placement . LEFT)
(stencil . ,ly:balloon-interface::print-spanner)
(text . ,(grob::calc-property-by-copy 'text))
(Y-extent . #f)