]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.20
authorfred <fred>
Sat, 21 Dec 1996 16:02:43 +0000 (16:02 +0000)
committerfred <fred>
Sat, 21 Dec 1996 16:02:43 +0000 (16:02 +0000)
src/textspanner.cc [new file with mode: 0644]

diff --git a/src/textspanner.cc b/src/textspanner.cc
new file mode 100644 (file)
index 0000000..e33efbb
--- /dev/null
@@ -0,0 +1,57 @@
+#include "paper.hh"
+#include "molecule.hh"
+#include "lookup.hh"
+#include "boxes.hh"
+#include "textspanner.hh"
+
+Text_spanner::Text_spanner(Directional_spanner*d)
+{
+    support = d;
+    align = 0;
+    style = "roman";
+}
+
+void
+Text_spanner::process()
+{
+    Offset tpos;
+
+    switch(align) {
+    case 0:
+       tpos = support->center();
+       break;
+    default:
+       assert(false);
+       break;
+    }
+    
+    Paperdef *pap_p = paper();
+    
+    Atom tsym (pap_p->lookup_->text(style, text, -align));
+    tsym.translate(tpos);
+    output = new Molecule;
+    output->add( tsym );    
+}
+
+void
+Text_spanner::preprocess()
+{
+    right = support->right;
+    left = support->left;
+    assert(left && right);
+}
+
+Interval
+Text_spanner::height()const
+{
+    return output->extent().y;
+}
+
+Spanner*
+Text_spanner::broken_at(PCol*c1, PCol*c2)const
+{
+    Text_spanner *n=new Text_spanner(*this);
+    n->left = c1;
+    n->right = c2;
+    return n;
+}