12 // scary! What if Symtable resizes on the fly...?
14 Symtable::lookup(String s) const
19 WARN<<"Unknown symbol " << s <<'\n';
25 Symtables::operator()(String s)
27 if (!done_reading){ // read on demand
28 *mlog << '(' << fname ;
33 return Assoc<String, Symtable*>::operator[](s);
39 Text_db symini(fname);
40 while (!symini.eof()) {
41 Text_record r( symini++);
42 assert (r[0] == "table");
45 Symtable * sp = new Symtable;
46 while (!symini.eof()){
56 for (int j=0; j < 4; j++)
57 dims.add( r[i++].fvalue() *1.0/CM_TO_PT);
59 Symbol s(tex, Box(dims));
66 Symtables the_sym_tables("symbol.ini");
70 Symbol::find_ball(int j)
73 Symtable * st = the_sym_tables("balls");
74 return st->lookup(String(j));
78 Symbol::find_rest(int j)
80 return the_sym_tables("rests")->lookup(String(j));
83 Symbol::find_bar(String s)
85 return the_sym_tables("bars")->lookup(s);
87 /****************************************************************/
90 struct Linestaf_symbol : Stretchable_symbol {
92 String operator ()(Real w);
93 Linestaf_symbol(int n) { lines = n;}
94 Interval height(Real) const { return Interval(0,lines*1/CM_TO_PT); }
99 // should be done in TeX
101 Linestaf_symbol::operator()(Real w)
104 s += "\\hbox to 0pt{";
105 s+= "\\vbox to 0pt{";
106 for (int i=0; i<lines; i++) {
107 if (i) s+= "\\vskip1pt";
108 s+= "\\hrule width " + String(w* HOR_TO_PT) +"pt";
114 const Stretchable_symbol *
115 Stretchable_symbol::get_linestaff(int n)
117 return new Linestaf_symbol(n);