X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fhyphen-spanner.cc;h=16c31b5d8aa7be9607229e1695e3e47e81606579;hb=refs%2Ftags%2Frelease%2F1.7.18;hp=1a35efaaed73a4fd3be307bf0458e754657f40eb;hpb=0c1ce854cfb2b9ad594526e359ec206fdd9b21fe;p=lilypond.git diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index 1a35efaaed..16c31b5d8a 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1999 Glen Prideaux + (c) 1999--2003 Glen Prideaux (adapted from lyric-extender) */ @@ -24,7 +24,7 @@ MAKE_SCHEME_CALLBACK (Hyphen_spanner,brew_molecule,1) SCM Hyphen_spanner::brew_molecule (SCM smob) { - Spanner * sp = dynamic_cast (unsmob_grob (smob)); + Spanner * sp = unsmob_spanner (smob); Grob * common = sp; Direction d = LEFT; @@ -45,7 +45,7 @@ Hyphen_spanner::brew_molecule (SCM smob) } while (flip (&d) != LEFT); - Real lt = sp->paper_l ()->get_var ("stafflinethickness"); + Real lt = sp->get_paper ()->get_var ("linethickness"); Real th = gh_scm2double (sp->get_grob_property ("thickness")) * lt ; Real h = gh_scm2double (sp->get_grob_property ("height")); @@ -58,8 +58,12 @@ Hyphen_spanner::brew_molecule (SCM smob) { bounds[LEFT] -= gh_scm2double (space); } - Real w = bounds.length (); + /* + we should probably do something more intelligent when bounds is + empty, but at least this doesn't crash. + */ + Real w = bounds.empty_b () ? 0 : bounds.length (); /* for length, use a geometric mean of the available space and some minimum */ @@ -76,7 +80,7 @@ Hyphen_spanner::brew_molecule (SCM smob) the offset for stuff */ /* This test for being on the first column has been shamelessly ripped from spanner.cc */ - Paper_column *sc = dynamic_cast (sp->get_bound (LEFT)->column_l ()); + Paper_column *sc = dynamic_cast (sp->get_bound (LEFT)->get_column ()); if (sc != NULL && sc->break_status_dir () == RIGHT) { @@ -93,21 +97,28 @@ Hyphen_spanner::brew_molecule (SCM smob) } Box b (Interval (-l/2,l/2), Interval (h,h+th)); Molecule mol (Lookup::filledbox (b)); - mol.translate_axis (bounds.center () - -sp->relative_coordinate (common, X_AXIS), - X_AXIS); + Real ct = bounds.empty_b () ? 0 : bounds.center () ; + mol.translate_axis (ct -sp->relative_coordinate (common, X_AXIS), X_AXIS); return mol.smobbed_copy (); } void Hyphen_spanner::set_textitem (Direction d, Grob* b) { - elt_l_->set_bound (d, b); - elt_l_->add_dependency (b); + elt_->set_bound (d, b); + elt_->add_dependency (b); } Hyphen_spanner::Hyphen_spanner (Spanner*s) { - elt_l_ = s; + elt_ = s; } + + +ADD_INTERFACE (Hyphen_spanner, "lyric-hyphen-interface", + "A centred hyphen is a simple line between lyrics used to divide +syllables. The length of the hyphen line should stretch based on the +size of the gap between syllables.", + "thickness height minimum-length maximum-length word-space"); +