]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.41
authorfred <fred>
Sun, 24 Mar 2002 20:04:33 +0000 (20:04 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:04:33 +0000 (20:04 +0000)
bin/clean-embeds.sh [new file with mode: 0644]
bin/flower.py [new file with mode: 0644]
flower/include/string-convert.hh
flower/string-convert.cc
input/sleur.ly
input/slurs.ly
lily/main.cc
lily/slur.cc
lily/tie.cc
mf/feta-autometric.mf

diff --git a/bin/clean-embeds.sh b/bin/clean-embeds.sh
new file mode 100644 (file)
index 0000000..1b53f85
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+rm -f feta-sleur-[0-9x\-]*.mf
+rm -f feta-sleur-[0-9x\-]*.log
+rm -f feta-beum-[0-9x\-]*.mf
+rm -f feta-beum-[0-9x\-]*.log
+rm -f feta-embed.aux
+rm -f missfont.log
+clean-fonts sleur
+clean-fonts beum
diff --git a/bin/flower.py b/bin/flower.py
new file mode 100644 (file)
index 0000000..5625599
--- /dev/null
@@ -0,0 +1,35 @@
+#!@PYTHON@
+
+# 
+# flower.py -- python flower lib
+# 
+# source file of the GNU LilyPond music typesetter
+# 
+# (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+# 
+
+class File:
+    """silly wrapper for Python file object."""
+    def __init__ (self,nm, mode='r'):
+       if nm:
+           self.file_ = open (nm, mode);
+       elif mode == 'w':
+           self.file_ = sys.stdout
+       else:
+           self.file_ = sys.stdin
+           
+       self.eof_ = 0;
+    def readline (self):
+       l=  self.file_.readline ();
+       if not l:
+           self.eof_ = 1;
+       return l;
+    def write (self, str):
+       self.file_.write (str)
+    def eof (self):
+       return self.eof_
+    def close (self):
+       self.file_.close ()
+    def __del__ (self):
+       self.close ();
+
index 1d3f5d0300130f72326f1e9ee8037410c7e19d06..72149f78ec3c4969034abce31b335f9cd5183aad 100644 (file)
@@ -36,6 +36,7 @@ public:
     static String i2dec_str (int i, int length_i, char ch);
     static String rational_str (Rational);
     static String pointer_str (void const *);
+    static String precision_str (double x, int n);
     static String i64_str (I64, char const * fmt = 0);
 };
 
index a8f661904890af4daa967368a604fc8565f96c2f..23ab488cf3d776e80496dbf9351abd1e61dd5850 100644 (file)
@@ -221,7 +221,7 @@ String_convert::double_str (double f, char const* fmt)
 }
 
 /**
-  Make a string from a single character.
+Make a string from a single character.
 
   @param
   #n# is a repetition count, default value is 1
@@ -261,3 +261,41 @@ String_convert::pointer_str (void const *l)
   snprintf (buffer, STRING_BUFFER_LEN, "%p", l);     // assume radix 10
   return String (buffer);
 }
+
+/**
+  Convert a double to a string.
+
+  @param
+  #n# is the number of nonzero digits
+ */
+String
+String_convert::precision_str (double x, int n)
+{
+  String format = "%." + String (0 >? n - 1) + "e";
+  String str = double_str (abs (x), format.ch_C ());
+
+  int exp = str.right_str (3).value_i ();
+  str = str.left_str (str.len () - 4);
+
+  while (str[str.len () - 1] == '0')
+    str = str.left_str (str.len () - 1);
+  if (str[str.len () - 1] == '.')
+    str = str.left_str (str.len () - 1);
+
+  if (exp == 0)
+    return (sign (x) > 0 ? str : "-" + str);
+
+  str = str.left_str (1) + str.cut (2, INT_MAX);
+  int dot = 1 + exp;
+  if (dot <= 0)
+    str = "0." + String ('0', -dot) + str;
+  else if (dot >= str.len ())
+    str += String ('0', dot - str.len ());
+  else if (( dot > 0) && (dot < str.len ()))
+    str = str.left_str (dot) + '.' + str.cut (dot, INT_MAX);
+  else
+    assert (0);
+
+  return (sign (x) > 0 ? str : "-" + str);
+}
+
index c712abda2cdc3883f083674af9b2730260d27e8a..bcb6e45846f080e25b3db265ab5d156d379a3560 100644 (file)
@@ -5,16 +5,37 @@ TestedFeatures =       "This file tests Feta embedded slurs"
         "(Feta definitively is not an abbreviation of Font-En-TjA)";
 }
 
-%{ remember to:
-rm `find /var/lib/texmf -name "feta-sleur-*"`
-%}
-
 \version "0.1.7";
 
+shortlong = \melodic{
+       c4()c( c c  |
+       c c c c |
+       c c c c |
+       c c c )c |
+}
+
+dirs = \melodic {
+       \octave c';
+       c'1() g' () c () g () c |
+}
+
+complex = \melodic{
+       \octave c';
+       'c16( 'e( 'g( 'b( d( f( a( c'~ )))))))c4 c4 |
+       \octave c''';
+       'c16( a( f( d( 'b( 'g( 'e( 'c~ )))))))c4 c4 |
+}
+
+beum = \melodic{
+       [c8 c] c4 c4 c4 |
+}
+
 \score{
        \melodic{ 
-               \octave c'
-               ;c'1() g' () c () g () c 
+               \shortlong
+               \dirs
+               \complex
+               \beum
        }
        \paper{ }
 }
index 26ff241da3835b1ef0a30d2c9938ff3df2d4901d..caf87a3f4c1b4271146fcd5218427a5baeb155b2 100644 (file)
@@ -4,6 +4,7 @@
 \score{
        \melodic{\octave c';
                \duration "last";
+
                'c4 ~ 'c c'' ~ c'' ~ g ~ c ~
                d ~ e ~ f ~ g ~
                a ~ b ~ 'c ~ c
                < { c ~ d }
                  { e ~ f }
                >
-       \multi 2 <
-       { \stemup c'8 ~g ~e( ~c~ [c'~ g' e' )c'] c'' ~ c'' c~c }
-       { \stemdown c (e g )c'~( [b a g )d]     r2 } 
-       >
+%      \multi 2 <
+%      { \stemup c'8 ~g ~e( ~c~ [c'~ g' e' )c'] c'' ~ c'' c~c }
+%      { \stemdown c (e g )c'~( [b a g )d]     r2 } 
+%      >
+
+       {
+%              \octave c';
+%              'c16( 'e( 'g( 'b( d( f( a( c'~ )))))))c4 c4 |
+%              \octave c''';
+%              'c16( a( f( d( 'b( 'g( 'e( 'c~ )))))))c4 c4 |
+%              \octave c';
+%              c'1() g' () c () g () c |
 
+               c4()c( c c  |
+               c c c c |
+               c c c c |
+               c c c )c |
+       }
+       }
        }
 }
index 4bed727ec5f7809b5b79642e53dcf969f2afb92e..17d1997dc534adcbce0afbe88ccab3201171983e 100644 (file)
@@ -38,7 +38,7 @@ Long_option_init theopts[] = {
   {0, "debug", 'd'},
   {1, "init", 'i'},
   {1, "include", 'I'},
-  {0, "no-midi", 'M'},
+  {0, "no-paper", 'M'},
   {0, "no-postscript", 'P'},
   {0, "ignore-version", 'V'},
   {0,0,0}
index c7be481d4ce4005260fa327d50bad95e77be4a67..cc2471bec7f5f20f74b259658e77071ef19285aa 100644 (file)
@@ -86,7 +86,23 @@ Slur::do_post_processing()
   encompass_arr_.sort (Note_column_compare);
   if (!dir_)
     set_default_dir();
-  Real inter_f = paper()->internote_f ();
+  Real interline_f = paper ()->interline_f ();
+  Real inter_f = interline_f / 2;
+
+  /* 
+   [OSU]: slur and tie placement
+
+   slurs:
+   * x = centre of head (upside-down: inner raakpunt stem) - d * gap
+
+   * y = length < 5ss : horizontal raakpunt + d * 0.25 ss
+     y = length >= 5ss : y next interline - d * 0.25 ss
+     --> height <= 5 length ?? we use <= 3 length, now...
+
+   * suggested gap = ss / 5;
+   */
+  // jcn: 1/5 seems so small?
+  Real gap_f = interline_f / 2; // 5;
   
   Drul_array<Note_column*> extrema;
   extrema[LEFT] = encompass_arr_[0];
@@ -103,10 +119,16 @@ Slur::do_post_processing()
            *(spanned_drul_[d]->width ().length () -0.5*nw_f);
        }
       else if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_) 
-       dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height()[dir_]);
+        {
+         dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height()[dir_]);
+         /* normal slur from notehead centre to notehead centre, minus gap */
+         dx_f_drul_[d] += -d * gap_f;
+       }
       else 
-       dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval()[dir_])* inter_f;
-      dy_f_drul_[d] += dir_ * inter_f;
+        {
+         dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval()[dir_])* inter_f;
+       }
+      dy_f_drul_[d] += dir_ * interline_f;
     }
   while ((d *= -1) != LEFT);
 }
index a181bedde3361eca34c04eb94e19fed8fa749610..fb929047e6eb2f572d5670c0a7b443fdea11c840 100644 (file)
@@ -60,15 +60,29 @@ Tie::do_add_processing()
 void
 Tie::do_post_processing()
 {
-  Real nw_f = paper()->note_width ();
-  Real space_f = paper()->interline_f ();
+  Real nw_f = paper ()->note_width ();
+  Real interline_f = paper ()->interline_f ();
   assert (head_l_drul_[LEFT] || head_l_drul_[RIGHT]);
 
+  /* 
+   [OSU]: slur and tie placement
+
+   ties:
+   * x = inner raakpunt - d * gap
+
+   * y = length < 5ss : horizontal raakpunt
+     y = length >= 5ss : y next interline - d * 0.25 ss
+     --> height <= 5 length ?? we use <= 3 length, now...
+
+   * suggested gap = ss / 5;
+   */
+  // jcn: 1/5 seems so small?
+  Real gap_f = interline_f / 2; // 5;
+
   Direction d = LEFT;
   do
     {
-      dy_f_drul_[d] =  
-       .5 *space_f * (head_l_drul_[d] 
+      dy_f_drul_[d] = .5 * interline_f * (head_l_drul_[d] 
                       ? head_l_drul_[d]->position_i_
                       : head_l_drul_[(Direction)-d]->position_i_);
     }
@@ -78,23 +92,25 @@ Tie::do_post_processing()
     {
       if (head_l_drul_[d] && head_l_drul_[d]->extremal_i_)
        {
-         dy_f_drul_[d] += dir_ * space_f;
-         dx_f_drul_[d] += d * 0.25 * nw_f;
+         /* normal tie between noteheads, with gap of space */
+         dx_f_drul_[d] += -d * (0.5 * nw_f + gap_f);
+         /* attach to outer 3/4 end of head */
+         dy_f_drul_[d] += dir_ * 0.25 * interline_f;
        }
       else if (head_l_drul_[d])
-       dx_f_drul_[d] += d*0.5 * nw_f;
+       {
+         dx_f_drul_[d] += d*0.5 * nw_f;
+       }
       else
        {
          dy_f_drul_[d] = dy_f_drul_[(Direction) -d];
-         dx_f_drul_[d] = -d *(spanned_drul_[d]->width ().length () 
-                              -0.5* nw_f);
+         dx_f_drul_[d] = -d * (spanned_drul_[d]->width ().length () 
+                               -0.5 * nw_f);
        }
     }
   while ((d *= -1) != LEFT);
 }
 
-
-
 void
 Tie::do_substitute_dependency (Score_elem*o, Score_elem*n)
 {
index 3b1b79868475f6a97c4cb07bd918551a8657525d..8d53d521501998d98836d8ff7bc69bd448046afe 100644 (file)
@@ -43,8 +43,6 @@ enddef;
 def hround_pixels(expr sharped) = hround(sharped * hppp) enddef;
 def vround_pixels(expr sharped) = vround(sharped * vppp) enddef;
 
-
-
 def tand(expr alpha) = 
        (sind alpha/cosd alpha)
        enddef;