]> git.donarmstrong.com Git - lilypond.git/blob - src/textitem.cc
d19b4b813218acdc4b267ecaa4a08285b0b6e650
[lilypond.git] / src / textitem.cc
1 #include "request.hh"
2 #include "paper.hh"
3 #include "textitem.hh"
4 #include "stem.hh"
5 #include "molecule.hh"
6 #include "lookup.hh"
7
8 Text_item::Text_item(Text_req * r, int s)
9 {
10     dir = r->dir;
11     if (!dir)
12         dir = -1;
13     
14     specs = r->spec;
15     staffsize = s;
16     pos = 0;
17 }
18
19 void
20 Text_item::set_default_pos()
21 {
22     pos  = (dir > 0) ? staffsize + 2: -4;
23 }
24 void
25 Text_item::do_pre_processing()
26 {
27     set_default_pos();
28 }
29
30     
31 Molecule*
32 Text_item::brew_molecule() const
33 {
34     Molecule*    output = new Molecule(specs->create(paper()));
35     if(dir <0)
36         output->translate(Offset(0, -output->extent().y.length() ));
37     
38     output->translate(Offset(0, pos * paper()->internote()));
39     return output;
40 }