]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.2
authorfred <fred>
Thu, 10 Oct 1996 12:56:12 +0000 (12:56 +0000)
committerfred <fred>
Thu, 10 Oct 1996 12:56:12 +0000 (12:56 +0000)
symbol.hh [new file with mode: 0644]
symtable.cc

diff --git a/symbol.hh b/symbol.hh
new file mode 100644 (file)
index 0000000..464a423
--- /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
index a63bc195c8984867d68a49d29bf1671dad1510af..8b87e2fc99a893130426f1075878963f2efbdce5 100644 (file)
@@ -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)