From bce3efbedc184a1c33d3478ae9ca467d3288b3df Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:10:33 +0000 Subject: [PATCH] lilypond-0.1.58 --- VERSION | 2 +- bin/conflily.sh | 8 +- configure.in | 3 +- flower/Makefile | 27 +---- flower/include/interval.hh | 9 +- flower/include/real.hh | 1 - flower/offset.cc | 5 +- input/clefs.ly | 17 +++ input/sleur.ly | 193 +++++++++++++++++++++++---------- lily/VERSION | 2 +- lily/beam.cc | 7 +- lily/bow.cc | 80 +++++++++----- lily/clef-grav.cc | 17 ++- lily/clef-item.cc | 53 ++++++++-- lily/direction.cc | 8 +- lily/include/bezier.hh | 7 +- lily/include/bow.hh | 25 +++-- lily/include/lookup.hh | 10 +- lily/include/slur.hh | 21 ++-- lily/include/tie.hh | 23 ++-- lily/lookup.cc | 41 ++++++- lily/plet-spanner.cc | 2 +- lily/slur.cc | 207 +++++++++++++----------------------- lily/staff-side.cc | 11 +- lily/tie.cc | 6 +- make/Template.make | 15 ++- mf/feta-sleur.mf | 29 ++--- test/Makefile | 50 +++++++++ test/bow.cc | 212 +++++++++++++++++++++++++++++++++++++ tex/fetdefs.tex | 2 +- tex/lily-ps-defs.tex | 61 ++--------- 31 files changed, 756 insertions(+), 398 deletions(-) create mode 100644 input/clefs.ly create mode 100644 test/Makefile create mode 100644 test/bow.cc diff --git a/VERSION b/VERSION index e27a742c2c..6b52b51a7f 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION=0 MINOR_VERSION=1 -PATCH_LEVEL=57 +PATCH_LEVEL=58 MY_PATCH_LEVEL= # use the above to send patches, always empty for released version: diff --git a/bin/conflily.sh b/bin/conflily.sh index 2eab5a059e..dff069ab34 100644 --- a/bin/conflily.sh +++ b/bin/conflily.sh @@ -29,9 +29,7 @@ if [ "x$LILYINCLUDE" = "x" ]; then echo "export MFINPUTS=$MFINPUTS:$lelie/current/mf" fi -mkdir -p ../build -(cd ../build; -ln -sf $lelie/build/lily/lilypond bin/lilypond -ln -sf $lelie/build/mi2mu/mi2mu bin/mi2mu -../current/configure --prefix=/usr --enable-debugging --enable-printing --enable-checking) +ln -sf $lelie/current/lily/out/lilypond bin/lilypond +ln -sf $lelie/current/mi2mu/out/mi2mu bin/mi2mu +configure --prefix=/usr --enable-debugging --enable-printing --enable-checking diff --git a/configure.in b/configure.in index 8a85e74b77..13bf8fd95f 100644 --- a/configure.in +++ b/configure.in @@ -266,4 +266,5 @@ AC_OUTPUT(config.make) rm -f Makefile cp make/Toplevel.make.in ./Makefile -chmod 555 Makefile +chmod 444 Makefile + diff --git a/flower/Makefile b/flower/Makefile index 914663ff37..c970266bd6 100644 --- a/flower/Makefile +++ b/flower/Makefile @@ -17,22 +17,6 @@ depth = .. # NAME = flower MODULE_NAME = flower -# -# edit VERSION only -include ./$(depth)/VERSION -include ./$(depth)/flower/VERSION - -# generic variables: -# -include ./$(depth)/make/Variables.make -include ./$(depth)/make/Files.make - -#include $(flowerout)/Flower-flags.make - - -# -# descent order into subdirectories: -# SUBDIRS = include # @@ -41,17 +25,14 @@ SUBDIRS = include SCRIPTS = README_FILES = ONEWS NEWS README TODO EXTRA_DISTFILES= VERSION $(README_FILES) $(SCRIPTS) -#Flower-flags.make.in -# aclocal.m4 configure config.hh.in configure.in - - +include ./$(depth)/VERSION +include ./$(depth)/flower/VERSION -# generic targets and rules: -# +include ./$(depth)/make/Variables.make +include ./$(depth)/make/Files.make include ./$(depth)/make/Targets.make include ./$(depth)/make/Rules.make -# default: the-lib diff --git a/flower/include/interval.hh b/flower/include/interval.hh index 7a868a31ab..2d7488aeef 100644 --- a/flower/include/interval.hh +++ b/flower/include/interval.hh @@ -26,7 +26,14 @@ struct Interval_t { static T infinity() ; static String T_to_str (T arg); - T center() { return (left + right) / T(2);} + // ugh, egcs 1.02 ices on this +// T center() { return (left + right) / T(2);} + // and can't handle this either + // anyone want to make a bug report? + T center() { + T two (2); + return (left + right) / two; + } void translate (T t) { left += t; right += t; diff --git a/flower/include/real.hh b/flower/include/real.hh index 5b5bc26f7a..3b030c4cba 100644 --- a/flower/include/real.hh +++ b/flower/include/real.hh @@ -17,7 +17,6 @@ typedef double Real; const Real infinity_f = HUGE_VAL; - template inline T abs (T x) { return x > 0 ? x : -x; diff --git a/flower/offset.cc b/flower/offset.cc index ba1fee0075..232967e675 100644 --- a/flower/offset.cc +++ b/flower/offset.cc @@ -11,6 +11,7 @@ #include "offset.hh" +#ifndef STANDALONE String Offset::str () const { @@ -18,14 +19,14 @@ Offset::str () const s = String("(") + coordinate_a_[X_AXIS] + ", " + coordinate_a_[Y_AXIS] + ")"; return s; } - +#endif Offset complex_multiply (Offset z1, Offset z2) { Offset z; z[X_AXIS] = z1[X_AXIS] * z2[X_AXIS] - z1[Y_AXIS]*z2[Y_AXIS]; - z[Y_AXIS] = z1[X_AXIS] * z2[Y_AXIS] - z1[Y_AXIS] * z2[X_AXIS]; + z[Y_AXIS] = z1[X_AXIS] * z2[Y_AXIS] + z1[Y_AXIS] * z2[X_AXIS]; return z; } diff --git a/input/clefs.ly b/input/clefs.ly new file mode 100644 index 0000000000..7722d99d1b --- /dev/null +++ b/input/clefs.ly @@ -0,0 +1,17 @@ +\score { + \melodic{ \octave c'; + \clef "violin"; c1^"{violin}" \bar "||"; + \clef "french";c1^"{french}" \bar "||"; + \clef "soprano";c1^"{soprano}" \bar "||"; + \clef "mezzosoprano";c1^"{mezzosoprano}" \bar "||"; + \clef "alto";c1^"{alto}" \bar "||"; + \clef "tenor";c1^"{tenor}" \bar "||"; + \clef "baritone";c1^"{baritone}" \bar "||"; + \clef "varbaritone";c1^"{varbaritone}" \bar "||"; + \clef "bass";c1^"{bass}" \bar "||"; + \clef "subbass";c1^"{subbass}" \bar "|."; + } + \paper{ + } +} + diff --git a/input/sleur.ly b/input/sleur.ly index 4ef5e88d91..4dc4e08f6d 100644 --- a/input/sleur.ly +++ b/input/sleur.ly @@ -21,80 +21,167 @@ dirs = \melodic { complex = \melodic{ \octave c'; - 'c16( 'e( 'g( 'b( d( f( a( c'~ )))))))c4 c4 | + 'c16( 'e( 'g( 'b( d( f( a( c'())))))))c4 c4 | \octave c'''; - 'c16( a( f( d( 'b( 'g( 'e( 'c~ )))))))c4 c4 | + 'c16( a( f( d( 'b( 'g( 'e( 'c())))))))c4 c4 | } -beum = \melodic{ +over = \melodic{ \octave c'; - [c8 c] c4 c4 c4 | -} -extend = \melodic{ - \octave c; - c8(( c c )c c c c )c | - \[4/5c8( c c' c )c\]1/1 c c c c | - \[4/5c8( c c c c'\]1/1 c c c )c | - \[4/5c8( c c c c''\]1/1 c c c )c' | - \[4/5c8( c c c c'\]1/1 c c c )'c | - \[4/5c8( c c' c c\]1/1 c c c )c | - \[4/5c8( c c c ''c\]1/1 c c c )c | - \[4/5c8( c ''c c c\]1/1 c c c )c | + e( g' g' )e + e( a' a' )e + e( b' b' )e + e( c'' c'' )e + \stemup + e( c' c' )e + e( d' d' )e + e( e' e' )e + e( c'' c'' )e + \stemboth + e( f' b' )e + e( b' f' )e + e( e'' g' )e + e( g' e'' )e + \stemup + e( d' b )e + e( b d' )e + e( f' c'' )e + e( c'' f )e } -extendbug = \melodic{ +under = \melodic{ \octave c'; - c4( c' c' )c - \stemup c'4( \stemdown e e \stemboth )c' - [c'8( b g a] [c' d' e' c'] [c' d' e' )c'] - c( c' c' )c - e( g' g' )e + \stemdown + f'( \stemboth d d \stemdown )f' + f'( \stemboth c c \stemdown )f' + f'( \stemboth 'b 'b \stemdown )f' + f'( \stemboth 'a 'a \stemdown )f' + \stemdown + f'( a a )f' + f'( g g )f' + f'( f f )f' + f'( 'a 'a )f' + \stemdown + f'( \stemboth d 'b \stemdown )f' + f'( \stemboth 'b d \stemdown )f' + f'( \stemboth 'd 'b \stemdown )f' + f'( \stemboth 'b 'd \stemdown )f' + \stemdown + f'( f a )f' + f'( a f )f' + f'( f 'e )f' + f'( 'e f )f' +} + +eccentric = \melodic{ + \octave c'; + \stemup + \[4/7 f( a' f f f f )f \] | + \[4/7 f( f f f f a' )f \] | + \stemdown + \[4/7 e'( c e' e' e' e' )e' \] | + \[4/7 e'( e' e' e' e' c )e' \] | } -blend = \melodic{ - \octave c; - \stemdown; -%% \[4/5c8( c ''c c c\]1/1 c c c )c | - \[4/5c8( c ''f c c\]1/1 c c c )c | - - \[4/5c8( c \stemup ''f \stemdown c c\]1/1 c c c )c | - \stemup; - \octave c''; - \[4/5c8( c f'' c c\]1/1 c c c )c | - \[4/5c8( c \stemdown f'' \stemup c c\]1/1 c c c )c | - \stemboth; - c4( 'c16 'e 'g 'b d f a )'c16 c4 | - c4( 'c16 'e 'g 'b d f f )'c16 c4 | +tiltup = \melodic{ \octave c'; - \stemdown; - c( c'' c'' )c - \stemboth; - e( g' g' )e - e( g' g' )e - e( g' g' )e - e( g' g' )e + e( c'' c'' )e' + \stemup + e( c'' c'' )e' + \stemboth + e( g' e'' )e' + \stemup + e( c'' f )e' + \stemdown + f'( \stemboth 'a 'a \stemdown )f'' + \stemdown + f'( 'a 'a )f'' +} + +tiltdown = \melodic{ + \octave c'; + e'( c'' c'' )e + \stemup + e'( c'' c'' )e + \stemboth + e'( g' e'' )e + \stemup + e'( c'' f )e + \stemdown + f''( \stemboth 'a 'a \stemdown )f' + \stemdown + f''( 'a 'a )f' +} + +broken = \melodic{ + \octave c''; + c c c c() + c c c c( + c )c c c( + c c )c c( + )a' a' a' a'() + a' a' a' a'() + c( c c )c + c( c c )'f + 'f( c c )c + 'f( c c )'f +} + +blend = \melodic{ + \octave c'; + e( c'' c'' )e + \stemup + e( c'' c'' )e + \stemdown + f'( \stemboth 'a 'a \stemdown )f' + f'( 'a 'a )f' + + \stemboth + e( c'' c'' )e' + e'( c'' c'' )e + d( d d )d + + \stemdown + e( c'' c'' )e' + e'( c'' c'' )e + d( d d )d +} + + +bug = \melodic{ + \octave c'; + a()g( f )e + b'()a'( g' )f' + g( f' e' )d' + f f( g )a + c' () b () c' c' } \score{ \melodic{ - \blend + % use blend for fast check + %\blend +% { \shortlong \dirs \complex - \beum - \octave c'; - \stemup; - \extend - \octave c''; - \stemdown; - \extend - \stemboth; - \extendbug + \over + \under + \eccentric + \tiltup + \tiltdown + \bug +% } + % use broken with small linewidth + %\broken } \paper{ -% castingalgorithm = \Wordwrap; + indent = 0.0\pt; + %for broken! + %linewidth= 40.\mm; + %castingalgorithm = \Wordwrap; } } diff --git a/lily/VERSION b/lily/VERSION index 0523ff52f5..bd76086098 100644 --- a/lily/VERSION +++ b/lily/VERSION @@ -1,4 +1,4 @@ MAJOR_VERSION = 0 MINOR_VERSION = 1 -PATCH_LEVEL = 57 +PATCH_LEVEL = 58 MY_PATCH_LEVEL = diff --git a/lily/beam.cc b/lily/beam.cc index 6ad3fe78c0..c3991ea3ca 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -29,7 +29,7 @@ #include "lookup.hh" #include "grouping.hh" #include "stem-info.hh" -#include "main.hh" // experimental features +//#include "main.hh" // experimental features IMPLEMENT_IS_TYPE_B1 (Beam, Spanner); @@ -450,7 +450,8 @@ Beam::set_stemlens () s->set_stemend (left_y_ + slope_f_ * x); Real y = s->stem_length_f (); // duh: - int mult_i = stems_[i]->beams_left_i_ >? stems_[i]->beams_right_i_; +// int mult_i = stems_[i]->beams_left_i_ >? stems_[i]->beams_right_i_; + int mult_i = multiple_i_; if (mult_i > 1) // dim(y) = internote y -= (Real)(mult_i - 1) * interbeam_f / internote_f; @@ -588,7 +589,5 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const Does beam quanting think of the asymetry of beams? Refpoint is on bottom of symbol. (FIXTHAT) --hwn. */ - if (experimental_features_global_b && dir_ < 0) - leftbeams.translate_axis (-beamheight_f, Y_AXIS); return leftbeams; } diff --git a/lily/bow.cc b/lily/bow.cc index 9433f69a18..8be81c4f61 100644 --- a/lily/bow.cc +++ b/lily/bow.cc @@ -4,58 +4,84 @@ source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys + Jan Nieuwenhuizen */ #include "bow.hh" #include "paper-def.hh" #include "molecule.hh" #include "lookup.hh" +#include "bezier.hh" IMPLEMENT_IS_TYPE_B1(Bow,Directional_spanner); Bow::Bow () { - dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0; + dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0.0; dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0; } +Molecule* +Bow::brew_molecule_p () const +{ + Molecule* mol_p = new Molecule; + + Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]; + + Real dx_f = width ().length (); + dx_f += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]); + + Atom a = paper ()->lookup_l ()->slur (get_controls ()); + + a.translate (Offset (dx_f + dx_f_drul_[LEFT], dy_f + dy_f_drul_[LEFT])); + mol_p->add (a); + return mol_p; +} Offset Bow::center () const { - Real dy = dy_f_drul_[RIGHT]-dy_f_drul_[LEFT]; + Real dy = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]; - Real w = width ().length (); + Real dx = width ().length (); - return Offset (w/2,dy ); + return Offset (dx / 2, dy); } -Molecule* -Bow::brew_molecule_p () const +Interval +Bow::do_width () const { - Molecule*output = new Molecule; - Real w = width ().length (); - - Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]; - - Real nw_f = paper ()->note_width (); - - w+= (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]); - Real round_w = w; // slur lookup rounds the slurwidth . - - Atom a = paper ()->lookup_l ()->slur (dy_f, round_w, height_f (), dir_); - - Real error = w-round_w; - a.translate (Offset ( (dx_f_drul_[LEFT] + 0.5*nw_f) - + error/2, - dy_f_drul_[LEFT])); - output->add (a); - return output; + Interval i = Spanner::do_width (); + Real dx = i.length(); + return Interval (0, dx); } -Real -Bow::height_f () const +Array +Bow::get_controls () const { - return 0; + Bezier_bow b (paper ()); + b.set (get_encompass_offset_arr (), dir_); + b.calc (); + Array controls; + controls.set_size (8); + for (int i = 0; i < 4; i++) + controls[i] = b.control_[i]; + for (int i = 0; i < 4; i++) + controls[i + 4] = b.return_[i]; + return controls; +} + +Array +Bow::get_encompass_offset_arr () const +{ + Real dx = width (). length (); + dx += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]); + Real dy = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]; + + Array notes; + notes.push (Offset (0,0)); + notes.push (Offset (dx, dy)); + + return notes; } diff --git a/lily/clef-grav.cc b/lily/clef-grav.cc index 5f9a9376e7..5812e7fc5d 100644 --- a/lily/clef-grav.cc +++ b/lily/clef-grav.cc @@ -29,7 +29,7 @@ bool Clef_engraver::set_type (String s) { clef_type_str_ = s; - if (clef_type_str_ == "violin") + if (clef_type_str_ == "violin" || clef_type_str_ == "G" || clef_type_str_ == "G2") c0_position_i_= -6; else if (clef_type_str_ == "french") c0_position_i_= -8; @@ -45,12 +45,25 @@ Clef_engraver::set_type (String s) c0_position_i_ = 4; else if (clef_type_str_ == "varbaritone") c0_position_i_ = 4; - else if (clef_type_str_ == "bass") + else if (clef_type_str_ == "bass" || clef_type_str_ == "F") c0_position_i_= 6; else if (clef_type_str_ == "subbass") c0_position_i_ = 8; else + switch(clef_type_str_[0]) + { + case 'F': case 'f': + c0_position_i_ = 2 * (clef_type_str_[1] - '0') - 2; + break; + case 'G': case 'g': + c0_position_i_ = 2 * (clef_type_str_[1] - '0') - 10; + break; + case 'C': case 'c': + c0_position_i_ = 2 * (clef_type_str_[1] - '0') - 6; + break; + default: return false; + } return true; } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index b3b468047f..0c5c56eb22 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -34,6 +34,12 @@ Clef_item::Clef_item() read ("violin"); } +/* + * Convert input clef string to + * a clef symbol and a line position. + * This would be better done in the lexer (more efficient) + * or as a table-lookup. + */ void Clef_item::read (String t) { @@ -42,42 +48,58 @@ Clef_item::read (String t) { y_position_i_ = -2; } - else if (t == "french") + else if (t == "bass") + { + y_position_i_ = 2; + } + else if (t == "G" || t == "G2" || t == "treble") + { + symbol_ = "violin"; + y_position_i_ == -2; + } + else if (t == "french" || t == "G1") { symbol_="violin"; y_position_i_ = -4; } - else if (t == "soprano") + else if (t == "soprano" || t == "C1") { symbol_="alto"; y_position_i_ = -4; } - else if (t == "mezzosoprano") + else if (t == "mezzosoprano" || t == "C2") { symbol_ = "alto"; y_position_i_ = -2; } else if (t == "alto") { + symbol_ = "alto"; y_position_i_ = 0; } - else if (t == "tenor") + else if (t == "C3") { - symbol_="alto"; + symbol_ = "alto"; + y_position_i_ = 0; + } + else if (t == "tenor" || t == "C4") + { + symbol_ = "alto"; y_position_i_ = 2; } - else if (t == "baritone") + else if (t == "baritone" || t == "C5") { symbol_ = "alto"; y_position_i_ = 4; } - else if (t == "varbaritone") + else if (t == "varbaritone" || t == "F3") { symbol_ = "bass"; y_position_i_ = 0; } - else if (t == "bass") + else if (t == "F" || t == "F4") { + symbol_ = "bass"; y_position_i_ = 2; } else if (t == "subbass") @@ -85,6 +107,21 @@ Clef_item::read (String t) symbol_ = "bass"; y_position_i_ = 4; } + else if (isdigit(t[1])) + switch (t[0]) + { // we've already dealt with plain F, G or C clef + // position 0 is line 3. + case 'G': + case 'g': + symbol_ = "violin"; + y_position_i_ = 2 * (t[1] - '0') - 6; + break; + case 'F': + case 'f': + symbol_ = "bass"; + y_position_i_ = 2 * (t[1] - '0') - 6; + break; + } } void diff --git a/lily/direction.cc b/lily/direction.cc index a0e0e14a50..802418fce5 100644 --- a/lily/direction.cc +++ b/lily/direction.cc @@ -12,14 +12,14 @@ String direction_str (Direction d, Axis a) { - if (!d) - return "center"; + String s("center"); if (a == Y_AXIS) { - return d == UP ? "up" : "down"; + s =( d == UP ? "up" : "down"); } else if (a == X_AXIS) { - return d == LEFT ? "left" : "right" ; + s = (d == LEFT ? "left" : "right" ); } + return s; } diff --git a/lily/include/bezier.hh b/lily/include/bezier.hh index f5c871ed05..d69fc98196 100644 --- a/lily/include/bezier.hh +++ b/lily/include/bezier.hh @@ -20,12 +20,12 @@ class Bezier { public: - Bezier (int steps_i); + Bezier (); /** Calculate bezier curve into Offset (x,y) array. */ - void calc (); + void calc (int steps); void set (Array points); @@ -50,8 +50,9 @@ public: Calculate bezier curve for bow from bow parameters. */ void blow_fit (); - Real calc_f (Real height); void calc (); + Real calc_f (Real height); + void calc_bezier (); void calc_controls (); void calc_default (Real h); void calc_return (Real begin_alpha, Real end_alpha); diff --git a/lily/include/bow.hh b/lily/include/bow.hh index 88f96bc429..ffa9db31a4 100644 --- a/lily/include/bow.hh +++ b/lily/include/bow.hh @@ -9,23 +9,30 @@ #ifndef BOW_HH #define BOW_HH + #include "directional-spanner.hh" +#include "curve.hh" /** Base class for anything that looks like a slur. Anybody with a better name? */ -class Bow : public Directional_spanner { -protected: - Drul_array dy_f_drul_; - Drul_array dx_f_drul_; +class Bow : public Directional_spanner +{ +public: + Bow (); + Offset center () const; + + DECLARE_MY_RUNTIME_TYPEINFO; +protected: virtual Molecule* brew_molecule_p () const; - virtual Real height_f () const; + virtual Interval do_width () const; + Array get_controls () const; + virtual Array get_encompass_offset_arr () const; -public: - Bow(); - DECLARE_MY_RUNTIME_TYPEINFO; - Offset center() const; + Drul_array dy_f_drul_; + Drul_array dx_f_drul_; }; + #endif // BOW_HH diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 523a00b865..fa4463146e 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -52,18 +52,12 @@ struct Lookup { Atom bar (String, Real height) const; Atom dots () const; - Atom slur (Real &dy, Real &dx, Real ht, Direction dir) const; - Atom control_slur (Array controls, Real dx, Real dy) const; + Atom slur (Array controls) const; Atom plet (Real &dy, Real &dx, Direction dir) const; - Atom tex_slur (int dy, Real &dx, Direction dir) const; - Atom ps_slur (Real dy, Real dx, Real ht, Real dir) const; - Atom half_slur (int dy, Real &dx, Direction dir, int xpart) const; - Atom half_slur_middlepart (Real &dx, Direction dir) const; - Atom big_slur (int dy, Real &dx, Direction dir) const; Atom text (String style, String text, int align = 1) const; Atom script (String idx) const; Atom hairpin (Real & width, bool decresc, bool continued) const; Atom dynamic (String) const; }; -#endif +#endif // LOOKUPSYMS_HH diff --git a/lily/include/slur.hh b/lily/include/slur.hh index e3df46d0ae..07ceb99374 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -11,30 +11,29 @@ #include "lily-proto.hh" #include "parray.hh" #include "bow.hh" -#include "curve.hh" /** A #Bow# which tries to drape itself around the stems too. */ -class Slur : public Bow { +class Slur : public Bow +{ public: Link_array encompass_arr_; void add (Note_column*); + Slur (); + + SCORE_ELEM_CLONE(Slur); + DECLARE_MY_RUNTIME_TYPEINFO; + protected: - virtual Molecule* brew_molecule_p () const; - Array get_notes () const; - Array get_controls () const; + virtual Array get_encompass_offset_arr () const; - virtual void set_default_dir(); - virtual void do_post_processing(); + virtual void set_default_dir (); + virtual void do_post_processing (); virtual void do_add_processing (); virtual void do_pre_processing (); virtual void do_substitute_dependency (Score_elem*, Score_elem*); - virtual Real height_f () const; - - SCORE_ELEM_CLONE(Slur); - DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // SLUR_HH diff --git a/lily/include/tie.hh b/lily/include/tie.hh index 30673fc9ee..a1100653ae 100644 --- a/lily/include/tie.hh +++ b/lily/include/tie.hh @@ -15,20 +15,23 @@ /** Connect two noteheads. */ -class Tie : public Bow { - virtual void do_add_processing(); - virtual void do_post_processing(); - virtual void set_default_dir(); - virtual void do_substitute_dependency (Score_elem*,Score_elem*); - +class Tie : public Bow +{ public: - bool same_pitch_b_; - Drul_array head_l_drul_; - + Tie (); void set_head (Direction, Note_head*head_l); - Tie(); DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Tie); + + bool same_pitch_b_; + Drul_array head_l_drul_; + +protected: + virtual void do_add_processing (); + virtual void do_post_processing (); + virtual void set_default_dir(); + virtual void do_substitute_dependency (Score_elem*,Score_elem*); + Array get_controls () const; }; #endif // TIE_HH diff --git a/lily/lookup.cc b/lily/lookup.cc index 1ee100caa9..5b0054084d 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -19,6 +19,7 @@ #include "tex.hh" #include "scalar.hh" #include "paper-def.hh" +#include "string-convert.hh" #include "main.hh" Lookup::Lookup() @@ -145,6 +146,45 @@ Lookup::flag (int j, Direction d) const return (*symtables_p_)("flags")->lookup (c + String (j)); } +Atom +Lookup::slur (Array controls) const +{ + assert (postscript_global_b); + assert (controls.size () == 8); + + String ps = "\\embeddedps{\n"; + +#if 1 + for (int i = 1; i < 4; i++) + ps += String_convert::double_str (controls[i].x ()) + " " + + String_convert::double_str (controls[i].y ()) + " "; + + Real dx = controls[3].x (); + Real dy = controls[3].y (); + for (int i = 5; i < 8; i++) + ps += String_convert::double_str (controls[i].x () - dx) + " " + + String_convert::double_str (controls[i].y () - dy) + " "; +#else + // this would be nice + for (int i = 1; i < 4; i++) + ps += String_convert::double_str (controls[i].x ()) + " " + + String_convert::double_str (controls[i].y ()) + " "; + + for (int i = 5; i < 8; i++) + ps += String_convert::double_str (controls[i].x ()) + " " + + String_convert::double_str (controls[i].y ()) + " "; +#endif + + ps += " draw_slur}"; + + Atom s; + s.tex_ = ps; + + s.dim_[X_AXIS] = Interval (0, dx); + s.dim_[Y_AXIS] = Interval (0 ? dy); + return s; +} + Atom Lookup::streepje (int type) const { @@ -298,4 +338,3 @@ Lookup::vbracket (Real &y) const return bracket; } - diff --git a/lily/plet-spanner.cc b/lily/plet-spanner.cc index 6787088b0e..bb9980c263 100644 --- a/lily/plet-spanner.cc +++ b/lily/plet-spanner.cc @@ -65,7 +65,7 @@ Plet_spanner::brew_molecule_p () const Real interline_f = paper ()->interline_f (); Real numy_f = (dir_ > 0 ? 0 : -interline_f) + dir_ * interline_f / 2; Atom num (tdef_p_->get_atom (paper (), CENTER)); - num.translate (Offset (width ().length ()/ 2 + dx_f_drul_[LEFT], + num.translate (Offset (width ().length () / 1.8 + dx_f_drul_[LEFT], dy_f_drul_[LEFT] + dy_f / 2 + numy_f)); if (visibility_i_ >= 1) diff --git a/lily/slur.cc b/lily/slur.cc index fcc57eab1d..3e8cbdfe26 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -4,14 +4,16 @@ source file of the GNU LilyPond music typesetter (c) 1996, 1997 Han-Wen Nienhuys + Jan Nieuwenhuizen */ /* - TODO: - - think about crossing stems. - Begin and end should be treated as a Script. + [TODO] + * begin and end should be treated as a Script. + * damping + * slur from notehead to stemend: c''()b'' */ + #include "slur.hh" #include "scalar.hh" #include "lookup.hh" @@ -23,9 +25,13 @@ #include "debug.hh" #include "boxes.hh" #include "bezier.hh" -#include "main.hh" -IMPLEMENT_IS_TYPE_B1(Slur,Spanner); +//IMPLEMENT_IS_TYPE_B1(Slur,Spanner); +IMPLEMENT_IS_TYPE_B1(Slur,Bow); + +Slur::Slur () +{ +} void Slur::add (Note_column*n) @@ -118,97 +124,38 @@ Slur::do_post_processing () { dx_f_drul_[d] = -d *(spanned_drul_[d]->width ().length () -0.5*nw_f); + Direction u = d; + flip(&u); + if ((extrema[u] == spanned_drul_[u]) && extrema[u]->stem_l_) + { + dy_f_drul_[d] = extrema[u]->stem_l_->height ()[dir_]; + dy_f_drul_[u] = extrema[u]->stem_l_->height ()[dir_]; + } } else if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_) { dy_f_drul_[d] = (int)rint (extrema[d]->stem_l_->height ()[dir_]); - /* normal slur from notehead centre to notehead centre, minus gap */ - // ugh: diff between old and new slurs - if (!experimental_features_global_b) - dx_f_drul_[d] += -d * gap_f; - else - dx_f_drul_[d] += 0.5 * nw_f - d * gap_f; + dx_f_drul_[d] += 0.5 * nw_f - d * gap_f; + if (dir_ == extrema[d]->stem_l_->dir_) + { + if (dir_ == d) + dx_f_drul_[d] += 0.5 * (dir_ * d) * d * nw_f; + else + dx_f_drul_[d] += 0.25 * (dir_ * d) * d * nw_f; + } } else { - dy_f_drul_[d] = (int)rint (extrema[d]->head_positions_interval ()[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 (flip(&d) != LEFT); } -Real -Slur::height_f () const -{ - Bezier_bow bow (paper ()); - Array notes = get_notes (); - bow.set (notes, dir_); - - Real height = 0; - Real dy1 = bow.calc_f (height); - if (!dy1) - return height; - - height = dy1; - bow.set (notes, dir_); - Real dy2 = bow.calc_f (height); - if (!dy2) - return height; - - if (abs (dy2 - dy1) < paper ()->rule_thickness ()) - return height; - - /* - Assume - dy = B (h) - with - B (h) = a * h + b; - - Then we get for height = h{dy=0} - */ - Real a = (dy2 - dy1) / dy1; - Real b = dy1; - height = -b / a; - - if (check_debug && !monitor->silent_b ("Slur")) - { - cout << "************" << endl; - cout << "dy1: " << dy1 << endl; - cout << "dy2: " << dy2 << endl; - cout << "a: " << a << endl; - cout << "b: " << b << endl; - cout << "h: " << height << endl; - } - - return height; -} - -Molecule* -Slur::brew_molecule_p () const -{ - if (!experimental_features_global_b) - return Bow::brew_molecule_p (); - - Molecule* mol_p = new Molecule; - - Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]; - - Real dx_f = width ().length (); - dx_f += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]); - - Atom a = paper ()->lookup_l ()->control_slur (get_controls (), dx_f, dy_f); - - Real interline_f = paper ()->interline_f (); - Real gap_f = interline_f / 2; // 5; - Real nw_f = paper ()->note_width (); - a.translate (Offset (dx_f + 0.5 * nw_f + gap_f, dy_f + dy_f_drul_[LEFT])); - mol_p->add (a); - return mol_p; -} - Array -Slur::get_notes () const +Slur::get_encompass_offset_arr () const { Real interline = paper ()->interline_f (); Real notewidth = paper ()->note_width (); @@ -216,86 +163,76 @@ Slur::get_notes () const Stem* left_stem = encompass_arr_[0]->stem_l_; Real left_x = left_stem->hpos_f (); - // ugh, do bow corrections (see brew_mol) - left_x += dx_f_drul_[LEFT] + 0.5 * notewidth; + left_x += dx_f_drul_[LEFT]; - // ugh, do bow corrections (see brew_mol) Real left_y = dy_f_drul_[LEFT]; - // ugh, where does this asymmetry come from? - if (dir_ == DOWN) - left_y -= dir_ * internote; - - /* - urg, corrections for broken slurs: extra begin or end position - */ - int first = 0; - int n = encompass_arr_.size (); - if (encompass_arr_[0] != spanned_drul_[LEFT]) - { - n += 1; - first = 1; - left_x = spanned_drul_[LEFT]->width ().length (); - left_y = 0; - } - if (encompass_arr_.top () != spanned_drul_[RIGHT]) - n += 1; - - Array notes; - notes.set_size (n); Real dx = width ().length (); dx += (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT]); dx = dx ? 2 * interline; - + Real dy = (dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]); if (abs (dy) > 1000) dy = sign (dy) * 1000; - notes[0].x () = 0; - notes[0].y () = 0; - notes[n - 1].x () = dx; - notes[n - 1].y () = dy; - for (int i = 1; i < n - 1; i++) + int first = 1; + int last = encompass_arr_.size () - 1; + if (encompass_arr_[0] != spanned_drul_[LEFT]) { - Stem* stem = encompass_arr_[i - first]->stem_l_; + first = 0; + left_x = spanned_drul_[LEFT]->width ().length (); + left_x -= 2 * notewidth; +// left_y = 0; + Stem* stem = encompass_arr_[last]->stem_l_; + left_y = stem->dir_ == dir_ ? stem->stem_end_f () + : stem->stem_begin_f () + 0.5 * dir_; + dy = 0; + } + if (encompass_arr_.top () != spanned_drul_[RIGHT]) + { + last += 1; + dy = 0; + } + + Array notes; + notes.push (Offset (0,0)); + for (int i = first; i < last; i++) + { + Stem* stem = encompass_arr_[i]->stem_l_; /* set x to middle of notehead or on exact x position of stem, according to slur direction */ - Real x = stem->hpos_f () - left_x + notewidth / 2; + Real x = stem->hpos_f (); + if (stem->dir_ != dir_) - x += notewidth / 2; + x += 0.5 * notewidth; else if (stem->dir_ == UP) - x += notewidth; + x += 1.0 * notewidth; + + x -= left_x; + Real y = stem->dir_ == dir_ ? stem->stem_end_f () - : stem->stem_begin_f () + 2.5 * dir_; + : stem->stem_begin_f () + 0.5 * dir_; /* leave a gap: slur mustn't touch head/stem */ y += 2.5 * dir_; + + // ugh: huh? + if (dir_ == DOWN) + y += 1.5 * dir_; + y *= internote; y -= left_y; - notes[i].x () = x; - notes[i].y () = y; + notes.push (Offset (x, y)); } - return notes; -} -Array -Slur::get_controls () const -{ - Bezier_bow b (paper ()); - b.set (get_notes (), dir_); - b.calc (); - Array controls; - controls.set_size (8); - for (int i = 0; i < 4; i++) - controls[i] = b.control_[i]; - for (int i = 0; i < 4; i++) - controls[i + 4] = b.return_[i]; - return controls; + notes.push (Offset (dx, dy)); + + return notes; } diff --git a/lily/staff-side.cc b/lily/staff-side.cc index 99476a6206..404283066c 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -69,12 +69,17 @@ Staff_side::get_position_f () const Interval v = support_height(); // ugh, dim[y] = PT over here - y = v[dir_] + 2 * dir_ * inter_f; + y = v[dir_] + 1 * dir_ * inter_f; int y_i = (int)rint (y / inter_f); // ugh: 5 -> staff_lines - if ((abs (y_i) < 5) && !(abs (y_i) % 2)) - y += (Real)dir_ * inter_f; + if (abs (y_i) < 5) + { + if (!(abs (y_i) % 2)) + y += (Real)dir_ * inter_f; + } +// else +// y = v[dir_] + 1 * dir_ * inter_f; return y; } diff --git a/lily/tie.cc b/lily/tie.cc index de7b328b11..799bebaaab 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -12,6 +12,7 @@ #include "p-col.hh" #include "debug.hh" +IMPLEMENT_IS_TYPE_B1(Tie,Bow); void Tie::set_head (Direction d, Note_head * head_l) @@ -93,7 +94,9 @@ Tie::do_post_processing() if (head_l_drul_[d] && head_l_drul_[d]->extremal_i_) { /* normal tie between noteheads, with gap of space */ - dx_f_drul_[d] += -d * (0.5 * nw_f + gap_f); + if (d == LEFT) + dx_f_drul_[d] += nw_f; + dx_f_drul_[d] += -d * gap_f; /* attach to outer 3/4 end of head */ dy_f_drul_[d] += dir_ * 0.25 * interline_f; } @@ -121,4 +124,3 @@ Tie::do_substitute_dependency (Score_elem*o, Score_elem*n) head_l_drul_[RIGHT] = new_l; } -IMPLEMENT_IS_TYPE_B1(Tie,Bow); diff --git a/make/Template.make b/make/Template.make index 501aeab9df..9da75f9071 100644 --- a/make/Template.make +++ b/make/Template.make @@ -51,17 +51,16 @@ LOADLIBES += # main target of this module: # -# MAINTARGET = $(EXECUTABLE) -# MAINTARGET = $(LIBRARY) -MAINTARGET = - -default: $(MAINTARGET) +default: $(EXECUTABLE) +# default: $(LIBRARY) +include ./$(depth)/make/Files.make +include ./$(depth)/make/Targets.make +include ./$(depth)/make/Rules.make # -# generic targets and rules: -# include ./$(depth)/make/Targets.make include ./$(depth)/make/Rules.make -# +EXECUTABLES= +# include $(depth)/make/Executable.make diff --git a/mf/feta-sleur.mf b/mf/feta-sleur.mf index a1385857af..24637e273d 100644 --- a/mf/feta-sleur.mf +++ b/mf/feta-sleur.mf @@ -6,6 +6,7 @@ % (c) 1997 Jan Nieuwenhuizen % & Han-Wen Nienhuys % +% see Documentation/fonts.tex % mode_setup; @@ -19,34 +20,17 @@ def atan(expr x) = (angle(1,x)*pi/180) enddef; -%breapth, width, depth, height - -% urgh -% having mf would be nice if only from a "use the source" point of view. -% -% getslurcontrol: -% slurhtlimit 90 div /slur_alpha exch def -% slurratio 60 div slur_alpha div /slur_beta exch def -% slur_beta mul 1 atan slur_alpha mul -% -% draw_slur: -% slur_b getslurcontrol -% slur_dir mul /slur_ht exch def -% slur_b getslurcontrol /slur_indent exch def -% sleur_pen#:=stafflinethickness#; slurheightlimit#:=staffsize#/2; -% staffrulethickness 1.5 mul /slur_thick exch def -slurthick#:=3/2stafflinethickness#; +slurthick#:=1.8stafflinethickness#; define_pixels(staffsize,interline,stafflinethickness); define_pixels(sleur_pen,slurheightlimit,slurthick); -sluralpha:=slurheightlimit#*pi/2; -% slurratio:=1/3; -slurratio:=0.3333; -slurbeta:=3/4*pi*slurratio/sluralpha; +sluralpha:=2slurheightlimit#/pi; +slurratio:=1/3; +slurbeta:=pi*slurratio/2slurheightlimit#; def draw_slur(expr dxs,dys,hs,d) = save x, y; @@ -56,8 +40,7 @@ def draw_slur(expr dxs,dys,hs,d) = h#:=hs*1pt#; define_pixels(dx,dy); b#:=length(dx#,dy#); - % ugh: huh? 2/5 - indent#:=2/5*sluralpha*atan(slurbeta*b#); + indent#:=sluralpha*atan(slurbeta*b#); define_pixels(b,h,indent); height:=(indent+h)*d; z1=(0,0); diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000000..4f89904b66 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,50 @@ +# project LilyPond -- the musical typesetter +# title makefile for test +# file test/Makefile +# +# Copyright (c) 1997 by +# Jan Nieuwenhuizen +# Han-Wen Nienhuys +# + +# subdir level: +# +depth = .. +# + +# generic variables: +# +include ./$(depth)/make/Variables.make +# + +# identify module: +# +NAME = test +MODULE_NAME = test + +# descent order into subdirectories: +# +SUBDIRS = +# + +include ./$(depth)/make/Files.make + +# list of custom libraries: +# +CUSTOMLIBES = \ + +LOADLIBES += +# + +# main target of this module: +# +default: $(EXECUTABLE) +include ./$(depth)/make/Files.make +include ./$(depth)/make/Targets.make +include ./$(depth)/make/Rules.make +# + +EXECUTABLES=bow +include $(depth)/make/Executable.make + + diff --git a/test/bow.cc b/test/bow.cc new file mode 100644 index 0000000000..bb85ea3e6d --- /dev/null +++ b/test/bow.cc @@ -0,0 +1,212 @@ +// vim:sw=2 makeprg=g++\ -g\ bow.cc\ -o\ bow +#include +#define PT +// #define STAFFHEIGHT 16.0 +#define STAFFHEIGHT 20.0 + +#define UP 1 +#define DOWN (-1) + +// mmm +#define STANDALONE + +#include + +typedef void *Paper_def; + +#include "bezier.hh" +#include "bezier.cc" +#include "offset.cc" + +struct Point +{ + Real x, y; +}; + +void +out (Bezier_bow& b) +{ + cout << "save dx,dy,x,y;\n"; + for (int i = 0; i < 4; i++) + cout << "z" << i + 1 << " = (" << b.control_[i].x () + << ", " << b.control_[i].y () << ");\n"; + for (int i = 1; i < 3; i++) + cout << "z" << i + 4 << " = (" << b.return_[i].x () + << ", " << b.return_[i].y () << ");\n"; +#if 0 + cout << "pickup pencircle scaled 0.5pt#;\n"; + cout << "draw z2--z3; draw (50,0)-- 0.5[z2,z3];\n"; +#endif + cout << "pickup pencircle scaled 4pt#;\n"; + for (int i = 0; i < 4; i++) + cout << "drawdot z" << i + 1 << ";\n"; + cout << "path boogje;\n"; +#if 0 + cout << "pickup pencircle scaled 0.4pt#;\n"; + cout << "boogje=z1..controls z2 and z3..z4..controls z5 and z6..cycle;\n"; + cout << "filldraw boogje;\n"; +#else + cout << "pickup pencircle scaled 1.6pt#;\n"; + cout << "boogje=z1..controls z2 and z3..z4;\n"; + cout << "draw boogje;\n"; + cout << "pickup pencircle scaled 0.4pt#;\n"; + cout << "boogje:=z4..controls z5 and z6..z1;\n"; + cout << "draw boogje;\n"; +#endif + cout << "showit; shipit;clearit;\n"; +} + +void +bow (Point* points, int n, int d) +{ + Array notes; + for (int i = 0; i < n; i++) + notes.push (Offset (points[i].x, points[i].y)); +// cout << "pickup pencircle scaled 8pt#;\n"; + cout << "pickup pencircle scaled 2pt#;\n"; + for (int i = 0; i < n; i++) + cout << "drawdot (" << notes[i].x () << ", " << notes[i].y () << ");\n"; + Bezier_bow b (0); + b.set (notes, d); + b.calc (); + out (b); + return; +} + +int +main () +{ + //cout.unsetf(ios::scientific); + cout.setf(ios::fixed); +#if 0 + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,0, 100,1 }, 6, 1); + bow ((Point[6]){ 0,0, 20,0, 40,30, 60,30, 80,0, 100,1 }, 6, 1); + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,10, 100,1 }, 6, 1); + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,40, 100,1 }, 6, 1); + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,40, 80,0, 100,1 }, 6, 1); + bow ((Point[6]){ 0,10, 20,20, 40,0, 60,40, 80,20, 100,50 }, 6, 1); + bow ((Point[6]){ 0,10, 20,20, 40,0, 60,40, 80,20, 100,50 }, 6, -1); + bow ((Point[6]){ 0,10, 20,20, 40,0, 60,40, 80,20, 100,100 }, 6, -1); + bow ((Point[9]){ 0,0, 20,0, 40,-80, 60,0, 80,0, 100,0, 120,0, 140,0, 160,-1 }, 9, -1); + bow ((Point[9]){ 0,0, 40,0, 80,180, 120,0, 160,0, 200,0, 240,0, 280,0, 320,1 }, 9, 1); + bow ((Point[9]){ + {0, 0}, + {19.10645980317711, 1}, + {29.402919606354207, 28}, + {55.389379409531308, 1}, + {73.530839212708514, 1}, + {91.672299015885727, 1}, + {111.35901367452229, 1}, + {131.04572833315891, 1}, + {145.76744299179552, 0} + }, + 9, 1); + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,0, 100,40 }, 6, 1); + bow ((Point[2]){ 0,0, 20,0 }, 2, 1); + bow ((Point[2]){ 0,0, 20,-10 }, 2, 1); +#endif + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,0, 100,100 }, 6, 1); + cout << "\\end\n"; + return 0; +} + +// vim:sw=2 makeprg=g++\ -g\ bow.cc\ -o\ bow +#include +#define PT + +// mmm +#define STANDALONE + +#include + +typedef void *Paper_def; + +#include "bezier.hh" +#include "bezier.cc" +#include "mat.hh" + +struct Point +{ + Real x, y; +}; + +void +out (Bezier_bow& b) +{ + cout << "save dx,dy,x,y;\n"; + for (int i = 0; i < 4; i++) + cout << "z" << i + 1 << " = (" << b.control_[i].x () + << ", " << b.control_[i].y () << ");\n"; + for (int i = 1; i < 3; i++) + cout << "z" << i + 4 << " = (" << b.return_[i].x () + << ", " << b.return_[i].y () << ");\n"; +// cout << "pickup pencircle scaled 0.5pt#;\n"; +// cout << "draw z2--z3; draw (50,0)-- 0.5[z2,z3];\n"; + cout << "pickup pencircle scaled 4pt#;\n"; + for (int i = 0; i < 4; i++) + cout << "drawdot z" << i + 1 << ";\n"; +// cout << "pickup pencircle scaled 0.4pt#;\n"; + cout << "pickup pencircle scaled 1.6pt#;\n"; + cout << "path boogje;\n"; +// cout << "boogje=z1..controls z2 and z3..z4..controls z5 and z6..cycle;\n"; + cout << "boogje=z1..controls z2 and z3..z4;\n"; + cout << "dx=x4-x1;\n"; + cout << "dy=y4-y1;\n"; + cout << "draw boogje;\n"; + cout << "pickup pencircle scaled 0.4pt#;\n"; + cout << "boogje:=z4..controls z5 and z6..z1;\n"; + cout << "draw boogje;\n"; +// cout << "filldraw boogje;\n"; + cout << "showit; shipit;clearit;\n"; +} + +void +bow (Point* points, int n, int d) +{ + Array notes; + for (int i = 0; i < n; i++) + notes.push (Offset (points[i].x, points[i].y)); + cout << "pickup pencircle scaled 8pt#;\n"; + for (int i = 0; i < n; i++) + cout << "drawdot (" << notes[i].x () << ", " << notes[i].y () << ");\n"; + Bezier_bow b (0); + b.set (notes, d); + b.calc (); + out (b); + return; +} + +int +main () +{ + //cout.unsetf(ios::scientific); + cout.setf(ios::fixed); +#if 1 + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,0, 100,1 }, 6, 1); + bow ((Point[6]){ 0,0, 20,0, 40,30, 60,30, 80,0, 100,1 }, 6, 1); + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,10, 100,1 }, 6, 1); + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,40, 100,1 }, 6, 1); + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,40, 80,0, 100,1 }, 6, 1); + bow ((Point[6]){ 0,10, 20,20, 40,0, 60,40, 80,20, 100,50 }, 6, 1); + bow ((Point[6]){ 0,10, 20,20, 40,0, 60,40, 80,20, 100,50 }, 6, -1); + bow ((Point[6]){ 0,10, 20,20, 40,0, 60,40, 80,20, 100,100 }, 6, -1); + bow ((Point[9]){ 0,0, 20,0, 40,-80, 60,0, 80,0, 100,0, 120,0, 140,0, 160,-1 }, 9, -1); + bow ((Point[9]){ 0,0, 40,0, 80,180, 120,0, 160,0, 200,0, 240,0, 280,0, 320,1 }, 9, 1); + bow ((Point[9]){ + {0, 0}, + {19.10645980317711, 1}, + {29.402919606354207, 28}, + {55.389379409531308, 1}, + {73.530839212708514, 1}, + {91.672299015885727, 1}, + {111.35901367452229, 1}, + {131.04572833315891, 1}, + {145.76744299179552, 0} + }, + 9, 1); +#endif + bow ((Point[6]){ 0,0, 20,0, 40,0, 60,0, 80,0, 100,40 }, 6, 1); + cout << "\\end\n"; + return 0; +} + diff --git a/tex/fetdefs.tex b/tex/fetdefs.tex index 1616ccc9f3..b7ba27d281 100644 --- a/tex/fetdefs.tex +++ b/tex/fetdefs.tex @@ -100,7 +100,7 @@ \fi} \def\pianobrace#1{{\bracefont\char #1}} -\def\staffbracket#1{{\bracketfont\char #1}} +\def\staffbracket#1{{\centeralign{\bracketfont\char #1}}} \def\embeddedtex#1{} \def\embeddedps#1{} diff --git a/tex/lily-ps-defs.tex b/tex/lily-ps-defs.tex index 2610706399..9ff22292d5 100644 --- a/tex/lily-ps-defs.tex +++ b/tex/lily-ps-defs.tex @@ -118,60 +118,21 @@ def } bind def staffheight 2 div /slurhtlimit exch def - /slurratio 0.3333 def - % - % (b*ratio)/(1 + b / htlimit) - /getslurcontrol - { - slurhtlimit 90 div /slur_alpha exch def - slurratio 60 div slur_alpha div /slur_beta exch def - slur_beta mul 1 atan slur_alpha mul - } bind def - staffrulethickness 1.5 mul /slur_thick exch def - /draw_slur - { - staffrulethickness setlinewidth - 0 0 moveto - /slur_dir exch def - /slur_height exch def - /slur_dy exch def - /slur_dx exch def - slur_dy slur_dx lily_distance /slur_b exch def - slur_b getslurcontrol slur_height add - slur_dir mul /slur_ht exch def - slur_b getslurcontrol /slur_indent exch def -% - slur_dy slur_dx atan rotate - slur_indent slur_ht - slur_b slur_indent sub slur_ht - slur_b 0 - rcurveto - % - slur_indent neg slur_ht slur_dir slur_thick mul sub - slur_indent slur_b sub slur_ht slur_dir slur_thick mul sub - slur_b neg 0 - rcurveto - % - gsave - fill - grestore - stroke - } bind def - /draw_control_slur - { - staffrulethickness setlinewidth - 0 0 moveto - rcurveto - rcurveto - gsave +/draw_slur +{ + staffrulethickness setlinewidth + 0 0 moveto + rcurveto + rcurveto + gsave fill - grestore - stroke - } bind def + grestore + stroke + } bind def }} - \def\turnOnExperimentalFeatures{% % draw a slur in embedded postscript \special{ps: }} + -- 2.39.5