From: fred Date: Sun, 24 Mar 2002 20:12:16 +0000 (+0000) Subject: lilypond-1.0.1 X-Git-Tag: release/1.5.59~3070 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=efbbd074a8f0cb9647303aab24b5b3d3b8697aa8;p=lilypond.git lilypond-1.0.1 --- diff --git a/flower/vector.cc b/flower/vector.cc index fafa47a97e..e4eb654d69 100644 --- a/flower/vector.cc +++ b/flower/vector.cc @@ -3,7 +3,7 @@ source file of the Flower Library - (c) 1996-98 Han-Wen Nienhuys + (c) 1996-98 Han-Wen Nienhuys */ diff --git a/lily/direction.cc b/lily/direction.cc index 802418fce5..1c2481953f 100644 --- a/lily/direction.cc +++ b/lily/direction.cc @@ -4,7 +4,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/include/afm-reader.hh b/lily/include/afm-reader.hh new file mode 100644 index 0000000000..64faa2afa1 --- /dev/null +++ b/lily/include/afm-reader.hh @@ -0,0 +1,22 @@ + +/* + afm-reader.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#ifndef AFM_READER_HH +#define AFM_READER_HH + +class Adobe_font_metric_file +{ + Adobe_font_metric_file + +}; + + +#endif /* AFM_READER_HH */ + diff --git a/lily/include/afm.hh b/lily/include/afm.hh new file mode 100644 index 0000000000..8a932d05fc --- /dev/null +++ b/lily/include/afm.hh @@ -0,0 +1,56 @@ +/* + afm.hh -- declare Adobe_font_metric + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#ifndef AFM_HH +#define AFM_HH + +#include "string.hh" +#include "box.hh" +#include "array.hh" + +struct Adobe_font_char_metric { + int C_; + Real WX_; + String N_; + Box B_; + Box &bbox(); + String &name(); + Real &width(); + int &code (); + + String str () const; + Adobe_font_char_metric (); +}; + +struct Adobe_font_metric { + String FontName_; + String FullName_; + String FamilyName_; + String Weight_; + Real ItalicAngle_; + bool IsFixedPitch_; + Box FontBBox_; + Real UnderlinePosition_; + Real UnderlineThickness_; + String Version_; + String Notice_; + String EncodingScheme_; + Array char_metrics_; + + Adobe_font_char_metric find_char (String name) const; + String str () const; + Adobe_font_metric (); +}; + +Adobe_font_metric read_afm (String fn); + + + +#endif /* AFM_HH */ + diff --git a/lily/include/file-results.hh b/lily/include/file-results.hh index 3d6df5e9d6..f4cf779c17 100644 --- a/lily/include/file-results.hh +++ b/lily/include/file-results.hh @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ @@ -12,7 +12,7 @@ #include "fproto.hh" void do_one_file (String init_str, String file_str); - +extern Header *header_global_p; extern Array target_str_global_array; extern Array inclusion_global_array; extern Link_array score_global_array; diff --git a/lily/include/linear-programming.hh b/lily/include/linear-programming.hh index 08eefad823..c0648e8b26 100644 --- a/lily/include/linear-programming.hh +++ b/lily/include/linear-programming.hh @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ diff --git a/lily/include/music-wrapper-iterator.hh b/lily/include/music-wrapper-iterator.hh index cd5ad0a986..4437d461ed 100644 --- a/lily/include/music-wrapper-iterator.hh +++ b/lily/include/music-wrapper-iterator.hh @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/include/music-wrapper.hh b/lily/include/music-wrapper.hh index 989fb5fd0c..cdecc0b5ba 100644 --- a/lily/include/music-wrapper.hh +++ b/lily/include/music-wrapper.hh @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/include/musical-pitch.hh b/lily/include/musical-pitch.hh index 643cf04678..ed3e8ed015 100644 --- a/lily/include/musical-pitch.hh +++ b/lily/include/musical-pitch.hh @@ -3,27 +3,32 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ #ifndef MUSICAL_PITCH_HH #define MUSICAL_PITCH_HH + #include "lily-proto.hh" +#include "input.hh" /** The pitch as it figures in diatonal western music (12 semitones in an octave). It is not Music because, it has to duration associated */ -struct Musical_pitch { +struct Musical_pitch : public Input +{ + Musical_pitch (); + /// 0 is c, 6 is b int notename_i_; /// 0 is central c int octave_i_; - - /// 0 natural, 1 sharp, etc + /// 0 natural, 1 sharp, etc int accidental_i_; + void init () ; Musical_pitch to_relative_octave (Musical_pitch); void transpose (Musical_pitch); @@ -32,7 +37,6 @@ struct Musical_pitch { int steps() const; /// return pitch from central c (in halfnotes) int semitone_pitch() const; - Musical_pitch (); void up_to (int); void down_to (int); String str () const; diff --git a/lily/include/relative-music-iterator.hh b/lily/include/relative-music-iterator.hh index 0971a62d2d..c792445996 100644 --- a/lily/include/relative-music-iterator.hh +++ b/lily/include/relative-music-iterator.hh @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/include/relative-music.hh b/lily/include/relative-music.hh index dd1639858a..6137260d68 100644 --- a/lily/include/relative-music.hh +++ b/lily/include/relative-music.hh @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/include/rod.hh b/lily/include/rod.hh index c71b6b3484..81ea0d97b3 100644 --- a/lily/include/rod.hh +++ b/lily/include/rod.hh @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/include/scope.hh b/lily/include/scope.hh index 799e480ac0..f9980f2db8 100644 --- a/lily/include/scope.hh +++ b/lily/include/scope.hh @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/linear-programming.cc b/lily/linear-programming.cc index eed55a9b37..6ccc0b31e4 100644 --- a/lily/linear-programming.cc +++ b/lily/linear-programming.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ diff --git a/lily/music-wrapper-iterator.cc b/lily/music-wrapper-iterator.cc index 1160611e70..13b2a90c31 100644 --- a/lily/music-wrapper-iterator.cc +++ b/lily/music-wrapper-iterator.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/music-wrapper.cc b/lily/music-wrapper.cc index 2e241d5800..72971abf50 100644 --- a/lily/music-wrapper.cc +++ b/lily/music-wrapper.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/musical-pitch.cc b/lily/musical-pitch.cc index 89da2e12d9..e7ffbd7014 100644 --- a/lily/musical-pitch.cc +++ b/lily/musical-pitch.cc @@ -3,11 +3,12 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ #include "musical-pitch.hh" #include "debug.hh" +#include "main.hh" Musical_pitch::Musical_pitch () { @@ -26,7 +27,7 @@ void Musical_pitch::print () const { #ifndef NPRINT - DOUT << str(); + DOUT << str (); #endif } @@ -84,24 +85,32 @@ Musical_pitch::transpose (Musical_pitch delta) } +#if 0 +// nice test for internationalisation strings char const *accname[] = {"double flat", "flat", "natural", "sharp" , "double sharp"}; +#else +char const *accname[] = {"eses", "es", "", "is" , "isis"}; +#endif String Musical_pitch::str () const { int n = (notename_i_ + 2) % 7; - String s (char(n + 'a')); + String s = to_str (char(n + 'a')); if (accidental_i_) - s += " " + String (accname[accidental_i_ + 2]); + s += String (accname[accidental_i_ + 2]); if (octave_i_) - s += String ((octave_i_> 0)? "^": "_") + String(octave_i_); - + s += String ((octave_i_> 0)? "^": "_") + to_str (octave_i_); return s; } +/* + change me to relative, counting from last pitch p + return copy of resulting pitch + */ Musical_pitch Musical_pitch::to_relative_octave (Musical_pitch p) { @@ -112,24 +121,37 @@ Musical_pitch::to_relative_octave (Musical_pitch p) up_pitch.accidental_i_ = accidental_i_; down_pitch.accidental_i_ = accidental_i_; + Musical_pitch n = *this; up_pitch.up_to (notename_i_); down_pitch.down_to (notename_i_); + int h = p.steps (); if (abs (up_pitch.steps () - h) < abs (down_pitch.steps () - h)) - { - *this = up_pitch; - /* this sux imnsho - if (oct_mod > 0) // ugh - oct_mod --;*/ - } + n = up_pitch; else + n = down_pitch; + + if (find_quarts_global_b) { - *this = down_pitch; - /* if (oct_mod < 0) - oct_mod ++;*/ + int d = this->semitone_pitch () - n.semitone_pitch (); + if (d) + { + int i = 1 + (abs (d) - 1) / 12; + String quote_str = d < 0 ? to_str (',', i) : to_str ('\'', i); + Musical_pitch w = *this; + w.octave_i_ = 0; + String name_str = w.str (); + name_str + quote_str; + w.warning (_f ("Interval greater than quart, relative: %s", + name_str + quote_str)); + // don't actually do any relative stuff + n = *this; + } } - - octave_i_ += oct_mod; + else + n.octave_i_ += oct_mod; + + *this = n; return *this; } @@ -153,86 +175,3 @@ Musical_pitch::down_to (int notename) notename_i_ = notename; } -#if 0 - -Musical_pitch -My_lily_parser::get_melodic_req (Musical_pitch p, int quotes) -{ - if (relative_octave_mode_b_) - { - set_nearest (melodic); - int d = melodic->pitch () - last_melodic_->pitch (); - int shift = 0; - if (quotes && (sign (d) == sign (quotes))) - shift -= sign (quotes); - if (!quotes && (abs (d) == 6)) - { - String str = _("Octave ambiguity; assuming "); - /* - [TODO] - figure this out. - - If the distance is exactly*) half an octave, there is - no nearest pitch. In that case, we'll try to guess what - composer/ typist meant. - Firstly, we'll do this by comparing the 'notename distance': - - f b' % name-distance: f g a b: 3 - - is surely a shorter notename distance than - - f 'b % name-distance: b c d e f: 4 - - (should we give a warning at all, or can we safely assume - this is a positive interval up?) - - *) It is conceivable that, musically speaking, the interval - with the greater pitch-distance is thought to be smaller? - - */ - - int name_delta = melodic->notename_i_ - last_melodic_->notename_i_; - int name_near = abs (name_delta) % 7; - int name_wrap = (7 - abs (name_delta)) % 7; - if (name_near != name_wrap) - shift = name_near < name_wrap ? sign (name_delta) : -sign (name_delta); - else if (sign (last_melodic_->accidental_i_) - != sign (melodic->accidental_i_)) - shift = last_melodic_->accidental_i_ - melodic->accidental_i_; - else - shift = -1; - String name_str = notename_str (melodic); - str += shift > 0 ? name_str + "'" : "'" + name_str; - if (sign (d) == sign (shift)) - shift = 0; - melodic->warning (str); - } - melodic->octave_i_ += quotes + shift; - } - else - { - Melodic_req nearest (*melodic); - set_nearest (&nearest); - melodic->octave_i_ += quotes; - - if (find_quarts_global_b) - { - int e = melodic->pitch () - nearest.pitch (); - if (e) - { - int d = melodic->pitch () - last_melodic_->pitch (); - String str = _("Interval greater than quart"); - int n = 1 + (abs (d) - 1) / 12; - String quote_str ('\'', n); - str += _(", relative: "); - String name_str = notename_str (melodic); - str += d < 0 ? quote_str + name_str : name_str + quote_str; - melodic->warning (str); - } - } - } - delete last_melodic_; - last_melodic_ = melodic->clone ()->musical ()->melodic (); - return melodic; -} -#endif diff --git a/lily/relative-octave-music.cc b/lily/relative-octave-music.cc index 0b80d49c12..db24b85fc0 100644 --- a/lily/relative-octave-music.cc +++ b/lily/relative-octave-music.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ diff --git a/lily/scope.cc b/lily/scope.cc index 52a185ee91..2e20a1b38d 100644 --- a/lily/scope.cc +++ b/lily/scope.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1998 Han-Wen Nienhuys + (c) 1998 Han-Wen Nienhuys */ @@ -20,7 +20,7 @@ Scope::print () const { if (ai.val()->init_b_ == init_b) { - DOUT << ai.key() << '='; + DOUT << ai.key() << "="; ai.val()->print (); } } @@ -30,8 +30,8 @@ Scope::~Scope () { for (Assoc_iter ai (*this); ai.ok(); ai++) { - DOUT << "deleting: " << ai.key()<<'\n'; - delete ai.val(); + DOUT << "deleting: " << ai.key() << '\n'; + delete ai.val (); } }