lilypond-1.3.67
[lilypond.git] / lily / text-def.cc
blobb25937290e23cee3b1dda56a98f5376eb3159c71
1 /*
2 text-def.cc -- implement Text_def
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include <ctype.h>
10 #include "debug.hh"
11 #include "lookup.hh"
12 #include "paper-def.hh"
13 #include "molecule.hh"
14 #include "text-def.hh"
16 Direction
17 Text_def::staff_dir () const
19 if (style_str_ == "finger")
20 return UP;
21 return DOWN;
25 void
26 Text_def::do_print() const
28 #ifndef NPRINT
29 DOUT << "align " << align_dir_ << " `" << text_str_ << "'";
30 #endif
33 Text_def::Text_def()
35 align_dir_ = RIGHT;
36 style_str_ = "roman";
39 bool
40 Text_def::do_equal_b (General_script_def const *gdef) const
42 Text_def const *def= dynamic_cast<Text_def const*>(gdef);
43 return def&& align_dir_ == def->align_dir_ && text_str_ == def->text_str_
44 && style_str_ == def->style_str_;
47 Molecule
48 Text_def::get_molecule (Paper_def *p, Direction) const
50 Molecule a= p->lookup_l(0)->text (style_str_, text_str_);
52 a.translate_axis (-(align_dir_ + 1)* a.dim_[X_AXIS].center (), X_AXIS);
54 return a;
57 void
58 Text_def::print() const
60 DOUT << "Text `" << text_str_ << "\', style " <<
61 style_str_ << "align " << align_dir_ << '\n';