]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.9
authorfred <fred>
Mon, 11 Nov 1996 23:13:49 +0000 (23:13 +0000)
committerfred <fred>
Mon, 11 Nov 1996 23:13:49 +0000 (23:13 +0000)
src/paper.cc [new file with mode: 0644]

diff --git a/src/paper.cc b/src/paper.cc
new file mode 100644 (file)
index 0000000..8cd9833
--- /dev/null
@@ -0,0 +1,82 @@
+#include <math.h>
+
+#include "paper.hh"
+#include "debug.hh"
+#include "lookup.hh"
+#include "dimen.hh"
+#include "textdb.hh"
+
+double log2(double x) {
+    return log(x)  /log(2.0);
+}
+
+
+// golden ratio
+const Real PHI = (1+sqrt(5))/2;
+
+// see  Roelofs, p. 57
+Real
+Paperdef::duration_to_dist(Real d)
+{
+    return whole_width * pow(geometric_, log2(d));
+}
+Real
+Paperdef::rule_thickness()const
+{
+    return convert_dimen(0.4, "pt");
+}
+Paperdef::Paperdef()
+{
+    lookup_ = new Lookup();
+    parse();
+    linewidth = convert_dimen(15,"cm");                // in cm for now
+    whole_width= 8*note_width();
+    geometric_ = PHI;
+}
+
+void 
+Paperdef::parse()
+{
+    Text_db symini("symbol.ini");
+
+    
+    while (!symini.eof()) {
+       
+        Text_record  r(  symini++);
+       
+        if  (r[0] == "symboltables")
+            lookup_->parse(symini);     
+    }
+}
+
+Paperdef::~Paperdef()
+{
+    delete lookup_;
+}
+
+Real
+Paperdef::interline() const
+{
+    return lookup_->ball(4).dim.y.length();
+}
+Real
+Paperdef::note_width()const
+{
+    return lookup_->ball(4).dim.x.length( );
+}
+Real
+Paperdef::standard_height() const
+{
+    return convert_dimen(20,"pt");
+}
+
+void
+Paperdef::print() const
+{
+#ifndef NPRINT
+    mtor << "Paper {width: " << print_dimen(linewidth);
+    mtor << "whole: " << print_dimen(whole_width);
+    mtor << "out: " <<outfile;
+    mtor << "}\n";
+#endif
+}