--- /dev/null
+#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
#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)
{
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;
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)];
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*
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)