From: fred Date: Thu, 10 Oct 1996 12:56:12 +0000 (+0000) Subject: lilypond-0.0.2 X-Git-Tag: release/1.5.59~7119 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6e0f210c1df61e8dba89ba6df02cbd299231149b;p=lilypond.git lilypond-0.0.2 --- diff --git a/symbol.hh b/symbol.hh new file mode 100644 index 0000000000..464a423742 --- /dev/null +++ b/symbol.hh @@ -0,0 +1,26 @@ +#ifndef SYMBOL_HH +#define SYMBOL_HH +#include "string.hh" +#include "boxes.hh" +struct Symbol { + String tex; + Box dim; + + Symbol (String, Box ); + static const Symbol*find_ball(int); + static const Symbol*find_rest(int); + static const Symbol*find_bar(String); + Symbol() ; +}; + +/// a symbol with a variable width +struct Stretchable_symbol { +public: + + /// return a string for a symbol in this width. + virtual String operator ()(Real width)=0; + virtual Interval height(Real width) const =0; + static const Stretchable_symbol* get_linestaff(int n); +}; + +#endif diff --git a/symtable.cc b/symtable.cc index a63bc195c8..8b87e2fc99 100644 --- a/symtable.cc +++ b/symtable.cc @@ -1,11 +1,12 @@ #include "misc.hh" #include "debug.hh" #include "real.hh" -#include "tex.hh" +#include "symbol.hh" #include "assoc.hh" #include "symtable.hh" #include "const.hh" + Symtable* Symtables::operator()(String s) { @@ -22,21 +23,14 @@ void Symtables::read() { Text_db symini(fname); - while (1) { - if (symini.eof()) - break; + while (!symini.eof()) { Text_record r( symini++); - if (!r.sz()) - continue; - assert (r[0] == "table"); String tabnam = r[1]; Symtable * sp = new Symtable; - while (1) { + while (!symini.eof()){ r = symini++; - if (!r.sz()) - continue; if (r[0] == "end") break; @@ -61,7 +55,7 @@ Symtables the_sym_tables("symbol.ini"); const Symbol* Symbol::find_ball(int i) { - int j = intlog2(i); + int j = intlog2(i)+1; if (j > 4) j = 4; Symtable * st = the_sym_tables("balls"); return &(*st)[String(j)]; @@ -71,7 +65,7 @@ Symbol::find_ball(int i) const Symbol* Symbol::find_rest(int i) { - int j = intlog2(i); + int j = intlog2(i)+1; return &(*the_sym_tables("rests"))[String(j)]; } const Symbol* @@ -86,7 +80,11 @@ struct Linestaf_symbol : Stretchable_symbol { int lines; String operator ()(Real w); Linestaf_symbol(int n) { lines = n;} + Interval height(Real) const { return Interval(0,lines*1/CM_TO_PT); } }; + + + // should be done in TeX String Linestaf_symbol::operator()(Real w)