]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lyric-hyphen.cc
* configure.in: Test for and accept lmodern if EC fonts not found.
[lilypond.git] / lily / lyric-hyphen.cc
index f608ddc77f2c91c0f509aa79a26b9e2f35d52128..62bcce8a54be2ffec01f8c8101281ae32dcfefe5 100644 (file)
@@ -6,16 +6,13 @@
   (c) 2003--2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
-#include <math.h>
+#include "lyric-hyphen.hh"
+
+#include <cmath>
 
-#include "box.hh"
 #include "lookup.hh"
-#include "molecule.hh"
-#include "paper-def.hh"
+#include "output-def.hh"
 #include "paper-column.hh"
-#include "spanner.hh"
-#include "item.hh"
-#include "lyric-hyphen.hh"
 #include "moment.hh"
 
 MAKE_SCHEME_CALLBACK (Hyphen_spanner,print,1)
@@ -27,7 +24,7 @@ Hyphen_spanner::print (SCM smob)
                            me->get_bound (RIGHT));
 
   if (bounds[LEFT]->break_status_dir ()
-      && Paper_column::when_mom (bounds[LEFT]) == Paper_column::when_mom (bounds[RIGHT]->get_column()))
+      && Paper_column::when_mom (bounds[LEFT]) == Paper_column::when_mom (bounds[RIGHT]->get_column ()))
     return SCM_EOL;
   
   Grob * common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);
@@ -44,14 +41,14 @@ Hyphen_spanner::print (SCM smob)
     }
   while (flip (&d) != LEFT);
   
-  Real lt = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
-  Real th = robust_scm2double (me->get_grob_property ("thickness"), 1) * lt ;
-  Real h = robust_scm2double (me->get_grob_property ("height"), 0.5);
+  Real lt = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real th = robust_scm2double (me->get_property ("thickness"), 1) * lt ;
+  Real h = robust_scm2double (me->get_property ("height"), 0.5);
 
   // interval?
   
-  Real dp = robust_scm2double (me->get_grob_property ("dash-period"), 1.0);
-  Real dl = robust_scm2double (me->get_grob_property ("length"), .5 );
+  Real dp = robust_scm2double (me->get_property ("dash-period"), 1.0);
+  Real dl = robust_scm2double (me->get_property ("length"), .5 );
 
   if (dp < dl)
     dp = 1.5 * dl;
@@ -74,14 +71,14 @@ Hyphen_spanner::print (SCM smob)
   space_left = space_left >? 0.0;
   
   Box b (Interval (0, dl), Interval (h,h+th));
-  Molecule dash_mol (Lookup::round_filled_box (b, 0.8 * lt));
+  Stencil dash_mol (Lookup::round_filled_box (b, 0.8 * lt));
 
-  Molecule total;
+  Stencil total;
   for (int i = 0; i < n; i++)
     {
-      Molecule m (dash_mol);
+      Stencil m (dash_mol);
       m.translate_axis (span_points[LEFT] + i * dp + space_left / 2, X_AXIS);
-      total.add_molecule (m);
+      total.add_stencil (m);
     }
 
   total.translate_axis ( -me->relative_coordinate (common, X_AXIS), X_AXIS);
@@ -98,14 +95,21 @@ Hyphen_spanner::set_spacing_rods (SCM smob)
   Rod r;
   Spanner*sp = dynamic_cast<Spanner*> (me);
   r.distance_ =
-    robust_scm2double (me->get_grob_property ("minimum-length"), 0);
+    robust_scm2double (me->get_property ("minimum-length"), 0);
+
   Direction d=LEFT;
-  do {
-    r.item_l_drul_[d] = sp->get_bound (d);
-    r.distance_ += r.item_l_drul_[d]->extent (r.item_l_drul_[d], X_AXIS)[-d];
-  } while (flip (&d) != LEFT);
+  do
+    {
+      r.item_l_drul_[d] = sp->get_bound (d);
+      if (r.item_l_drul_[d])
+       r.distance_ += r.item_l_drul_[d]->extent (r.item_l_drul_[d], X_AXIS)[-d];
+    }
+  while (flip (&d) != LEFT);
 
-  r.add_to_cols ();
+  if (r.item_l_drul_[LEFT]
+      && r.item_l_drul_[RIGHT])
+    r.add_to_cols ();
+  
   return SCM_UNSPECIFIED;
 }