X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftext-def.cc;h=faf0dae1c4cfc65862599f7ea89dbea837cd8fec;hb=1cf3d59c1559fb9774c4c1c8cae155cfe54a927c;hp=1e75aa83aec358037dd75034f44dc5464b33d715;hpb=2d15ed5f550100cc7427ed4585625216d35708d6;p=lilypond.git diff --git a/lily/text-def.cc b/lily/text-def.cc index 1e75aa83ae..faf0dae1c4 100644 --- a/lily/text-def.cc +++ b/lily/text-def.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1996,1997 Han-Wen Nienhuys + (c) 1996, 1997--1998 Han-Wen Nienhuys */ #include "debug.hh" @@ -11,7 +11,15 @@ #include "paper-def.hh" #include "molecule.hh" #include "text-def.hh" -#include "dimen.hh" +#include "dimension.hh" + +Direction +Text_def::staff_dir () const +{ + if (style_str_ == "finger") + return UP; + return DOWN; +} Interval Text_def::width (Paper_def * p) const @@ -20,7 +28,7 @@ Text_def::width (Paper_def * p) const 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(); + i += - (align_dir_ + 1)* i.center(); return i; } @@ -28,13 +36,13 @@ void Text_def::do_print() const { #ifndef NPRINT - DOUT << "align " <align_i_ && text_str_ == def->text_str_ + return align_dir_ == def->align_dir_ && text_str_ == def->text_str_ && style_str_ == def->style_str_; } Atom Text_def::get_atom (Paper_def *p, Direction) const { - return p->lookup_l()->text (style_str_, text_str_, -align_i_); + Atom a= p->lookup_l(0)->text (style_str_, text_str_); + + Real guess_width_f = text_str_.length_i() * a.dim_.x ().length (); // ugh + a.translate_axis (-(align_dir_ + 1)* guess_width_f/ 2, X_AXIS); + + return a; } void Text_def::print() const { DOUT << "Text `" << text_str_ << "\', style " << - style_str_ << "align " << align_i_ << '\n'; + style_str_ << "align " << align_dir_ << '\n'; }