From cd5ac5fb010a98ad48ddbdbeeb04e91f7a2f2592 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:04:33 +0000 Subject: [PATCH] lilypond-0.1.41 --- bin/clean-embeds.sh | 10 ++++++++ bin/flower.py | 35 ++++++++++++++++++++++++++++ flower/include/string-convert.hh | 1 + flower/string-convert.cc | 40 +++++++++++++++++++++++++++++++- input/sleur.ly | 33 +++++++++++++++++++++----- input/slurs.ly | 23 ++++++++++++++---- lily/main.cc | 2 +- lily/slur.cc | 30 ++++++++++++++++++++---- lily/tie.cc | 38 +++++++++++++++++++++--------- mf/feta-autometric.mf | 2 -- 10 files changed, 185 insertions(+), 29 deletions(-) create mode 100644 bin/clean-embeds.sh create mode 100644 bin/flower.py diff --git a/bin/clean-embeds.sh b/bin/clean-embeds.sh new file mode 100644 index 0000000000..1b53f85ecb --- /dev/null +++ b/bin/clean-embeds.sh @@ -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 index 0000000000..5625599e7a --- /dev/null +++ b/bin/flower.py @@ -0,0 +1,35 @@ +#!@PYTHON@ + +# +# flower.py -- python flower lib +# +# source file of the GNU LilyPond music typesetter +# +# (c) 1997 Han-Wen Nienhuys +# + +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 (); + diff --git a/flower/include/string-convert.hh b/flower/include/string-convert.hh index 1d3f5d0300..72149f78ec 100644 --- a/flower/include/string-convert.hh +++ b/flower/include/string-convert.hh @@ -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); }; diff --git a/flower/string-convert.cc b/flower/string-convert.cc index a8f6619048..23ab488cf3 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -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); +} + diff --git a/input/sleur.ly b/input/sleur.ly index c712abda2c..bcb6e45846 100644 --- a/input/sleur.ly +++ b/input/sleur.ly @@ -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{ } } diff --git a/input/slurs.ly b/input/slurs.ly index 26ff241da3..caf87a3f4c 100644 --- a/input/slurs.ly +++ b/input/slurs.ly @@ -4,6 +4,7 @@ \score{ \melodic{\octave c'; \duration "last"; + 'c4 ~ 'c c'' ~ c'' ~ g ~ c ~ d ~ e ~ f ~ g ~ a ~ b ~ 'c ~ c @@ -16,10 +17,24 @@ < { 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 | + } + } } } diff --git a/lily/main.cc b/lily/main.cc index 4bed727ec5..17d1997dc5 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -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} diff --git a/lily/slur.cc b/lily/slur.cc index c7be481d4c..cc2471bec7 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -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 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); } diff --git a/lily/tie.cc b/lily/tie.cc index a181bedde3..fb929047e6 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -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) { diff --git a/mf/feta-autometric.mf b/mf/feta-autometric.mf index 3b1b798684..8d53d52150 100644 --- a/mf/feta-autometric.mf +++ b/mf/feta-autometric.mf @@ -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; -- 2.39.5