]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/text-def.cc
patch::: 0.1.31.jcn1: minder ugh
[lilypond.git] / lily / text-def.cc
index a9e95ef68d4fc2bd424dccac193de3422482f8e7..c41bfeb58a404bc90c42f019826a98bee6727b62 100644 (file)
 #include "dimen.hh"
 
 Interval
-Text_def::width(Paper_def * p) const
+Text_def::width (Paper_def * p) const
 {
-    Atom a = get_atom(p,0);
+  Atom a = get_atom (p,CENTER);
 
-    Real guess_width_f = text_str_.length_i() * a.sym.dim.x.length(); // ugh
-    Interval i(0, guess_width_f);
-    i += - (align_i_ + 1)* i.center();
-    return i;
+  Real guess_width_f = text_str_.length_i() * a.dim_.x ().length (); // ugh
+  Interval i (0, guess_width_f);
+  i += - (align_i_ + 1)* i.center();
+  return i;
 }
 
+void
+Text_def::do_print() const
+{
+#ifndef NPRINT
+  DOUT << "align " <<align_i_ << " `" << text_str_ << "'";
+#endif
+}
 
 Text_def::Text_def()
 {   
-    align_i_ = 1;                      // right
-    style_str_ = "roman";
+  align_i_ = 1;                        // right
+  style_str_ = "roman";
 }
+
 bool
-Text_def::do_equal_b(Text_def const &def)const
+Text_def::do_equal_b (General_script_def const *gdef) const
 {
-    return align_i_ == def.align_i_ && text_str_ == def.text_str_
-       && style_str_ == def.style_str_;
+  Text_def const *def= (Text_def*)gdef;
+  return align_i_ == def->align_i_ && text_str_ == def->text_str_
+       && style_str_ == def->style_str_;
 }
 
 Atom
-Text_def::get_atom(Paper_def *p, int ) const
+Text_def::get_atom (Paper_def *p, Direction) const
 {
-    return p->lookup_l()->text(style_str_, text_str_, -align_i_);
+  return p->lookup_l()->text (style_str_, text_str_, -align_i_);
 }
 
 void
 Text_def::print() const
 {
-    mtor << "Text `" << text_str_ << "\', style " <<
+  DOUT << "Text `" << text_str_ << "\', style " <<
        style_str_ << "align " << align_i_ << '\n';
 }
-IMPLEMENT_STATIC_NAME(Text_def);
+
+
+IMPLEMENT_IS_TYPE_B1(Text_def,General_script_def);