]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tex-slur.cc
release: 0.0.78
[lilypond.git] / lily / tex-slur.cc
index 2cbe6e7acd2f3e88872e1444d2b3804988cf7dde..c1ba56bd89623823fd400fc0da71ba355dfc1af7 100644 (file)
@@ -1,9 +1,20 @@
+/*
+  tex-slur.cc -- implement Lookup::*slur
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include <math.h>
 #include "misc.hh"
 #include "lookup.hh"
 #include "molecule.hh"
 #include "dimen.hh"
 #include "debug.hh"
+#include "paper-def.hh"
+
+
 
 static
 char direction_char(int y_sign)
@@ -51,12 +62,13 @@ Lookup::half_slur_middlepart(Real &dx, int dir) const
     if (dir < 0)
        idx += 128;
 
+    assert (idx < 256);
 
     f+=String( "{" ) + String( idx ) + "}";
     s.tex = f;
     Atom a(s);
-    a.translate(Offset(dx/2,0));
-    s.tex = a.TeXstring();
+    a.translate_x(dx/2);
+    s.tex = a.TeX_string();
 
     return s;
 }
@@ -96,12 +108,12 @@ Lookup::half_slur(int dy, Real &dx, int dir, int xpart) const
        hidx = -hidx;
     hidx --;
     int idx =-1;
-    
 
     idx = widx * 16 + hidx;
     if (xpart < 0)
        idx += 128;
     
+    assert (idx < 256);
     f+=String( "{" ) + String( idx ) + "}";
 
     
@@ -116,7 +128,7 @@ Lookup::slur (int dy , Real &dx, int dir) const
     assert(dx >=0 && abs(dir) <= 1);
     int y_sign = sign(dy);
 
-    bool large = dy > 16;
+    bool large = abs(dy) > 8;
 
     if (y_sign) {
        large |= dx>= 4*16 PT;
@@ -139,7 +151,7 @@ Lookup::slur (int dy , Real &dx, int dir) const
     if (hidx <0)
        hidx = -hidx;
     hidx --; 
-    if (hidx > 16) {
+    if (hidx > 8) {
        WARN<<"slur to steep: " << dy << " shrinking (ugh)\n";
     }
     
@@ -165,13 +177,14 @@ Lookup::slur (int dy , Real &dx, int dir) const
            idx += 54;          
     }
     
+    assert (idx < 256);
     f+=String( "{" ) + String( idx ) + "}";
     s.tex = f;
 
     Atom a(s);
-    a.translate(Offset(dx/2,0));
+    a.translate_x(dx/2);
     s.dim = a.extent();
-    s.tex = a.TeXstring();
+    s.tex = a.TeX_string();
     return s;    
 }
 
@@ -182,7 +195,8 @@ Lookup::big_slur(int dy , Real &dx, int dir) const
     Real slur_extra =abs(dy)  /2.0 + 2; 
     int l_dy = int(Real (dy)/2 + slur_extra*dir);
     int r_dy =  dy - l_dy;
-    
+
+    Real internote_f = paper_l_->internote_f();
     Real left_wid = dx/4.0;
     Real right_wid = left_wid;
 
@@ -195,12 +209,12 @@ Lookup::big_slur(int dy , Real &dx, int dir) const
     Molecule mol;
     mol.add(l);
     Atom a(m);
-    a.translate(Offset(0,slur_extra * internote()));
+    a.translate_y(slur_extra * internote_f);
     mol.add_right(m);
     mol.add_right(r);
-    mol.translate(Offset(0, l_dy * internote()));
+    mol.translate_y( l_dy * internote_f);
     Symbol s;
-    s.tex = mol.TeXstring();
+    s.tex = mol.TeX_string();
     s.dim = mol.extent();
     return s;
 }