2 lyric-extender.cc -- implement Lyric_extender
3 source file of the GNU LilyPond music typesetter
5 (c) 1998--2003 Jan Nieuwenhuizen <janneke@gnu.org>
13 #include "molecule.hh"
14 #include "paper-column.hh"
15 #include "paper-def.hh"
16 #include "lyric-extender.hh"
17 #include "note-head.hh"
19 MAKE_SCHEME_CALLBACK (Lyric_extender,brew_molecule,1)
21 Lyric_extender::brew_molecule (SCM smob)
23 Spanner *me = unsmob_spanner (smob);
24 Item *l = me->get_bound (LEFT);
25 Item *r = me->get_bound (RIGHT);
26 Grob *common = l->common_refpoint (r, X_AXIS);
28 Real left_point = l->extent (common, X_AXIS)[RIGHT];
30 Real sl = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
34 It seems that short extenders are even lengthened to go past the note head, but
35 haven't found a pattern in it yet. --hwn 1/1/04
38 Real right_point = r->extent (common, X_AXIS)
39 [(Note_head::has_interface (r)) ? RIGHT : LEFT];
41 Real h = sl * gh_scm2double (me->get_grob_property ("thickness"));
45 Real w = right_point - left_point;
50 Molecule mol (Lookup::round_filled_box (Box (Interval (0,w), Interval (0,h)),
52 mol.translate_axis (left_point - me->relative_coordinate (common, X_AXIS), X_AXIS);
53 return mol.smobbed_copy ();
57 Lyric_extender::set_textitem (Spanner *me, Direction d, Grob *s)
60 me->add_dependency (s);
66 ADD_INTERFACE (Lyric_extender,"lyric-extender-interface",
67 "The extender is a simple line at the baseline of the lyric "
68 " that helps show the length of a melissima (tied/slurred note).",