From c8e915a4f8c09d65db760d0637251e043320732a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 23 Jun 2000 19:06:48 +0200 Subject: [PATCH] patch::: 1.3.63.uu1: Re: Lilypond? 1.3.63.uu1 ========== * Lyrics centered on notehead. * Removed Clef_item as score-element derived type. --- CHANGES | 7 +++++ Documentation/header.html.in | 2 +- VERSION | 2 +- buildscripts/mutopia-index.py | 10 +------ input/bugs/text-kerning.ly | 12 ++++++++ input/twinkle-pop.ly | 12 ++++---- lily/clef-engraver.cc | 6 ++-- lily/clef-item.cc | 51 ++++++++++++++++++-------------- lily/extender-engraver.cc | 15 +++++----- lily/hyphen-engraver.cc | 12 ++++---- lily/hyphen-spanner.cc | 42 ++++++++++++++++++-------- lily/include/clef-item.hh | 21 ------------- lily/include/extender-spanner.hh | 40 +------------------------ lily/include/hyphen-spanner.hh | 2 +- lily/include/lyric-extender.hh | 41 +++++++++++++++++++++++++ lily/include/spanner.hh | 2 +- lily/key-engraver.cc | 4 +-- lily/lyric-engraver.cc | 8 +++++ lily/lyric-extender.cc | 8 ++--- lily/mark-engraver.cc | 1 - lily/spanner.cc | 9 +++++- ly/engraver.ly | 7 +++-- 22 files changed, 174 insertions(+), 140 deletions(-) create mode 100644 input/bugs/text-kerning.ly create mode 100644 lily/include/lyric-extender.hh diff --git a/CHANGES b/CHANGES index 328030c513..9b9e6f3f2f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +1.3.63.uu1 +========== + +* Lyrics centered on notehead. + +* Removed Clef_item as score-element derived type. + 1.3.61.jcn2 =========== diff --git a/Documentation/header.html.in b/Documentation/header.html.in index f64851dc80..31c6699b8f 100644 --- a/Documentation/header.html.in +++ b/Documentation/header.html.in @@ -60,7 +60,7 @@ which substitutes some @AT_VARIABLES@ as well. Stable
- Development
+ Development

diff --git a/VERSION b/VERSION index 8bedfa858d..5301762a5f 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=63 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=uu1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/buildscripts/mutopia-index.py b/buildscripts/mutopia-index.py index 9e05102b94..f56ab3bca2 100755 --- a/buildscripts/mutopia-index.py +++ b/buildscripts/mutopia-index.py @@ -30,16 +30,8 @@ LilyPond currently only outputs TeX and MIDI. The pictures and PostScript files were generated using TeX, Ghostscript and some graphics tools. The papersize used for these examples is A4. The images are in PNG format, and should be viewable with any current browser. -We don't use GIFS due to patent problems.

-If you want an accurate impression of the output quality please print -out the samples first. -""" - -headertext_nopics = r"""This is a subdirectory of the LilyPond example -set. We decided not to show any examples from this directory. If you -want to view them, then you have to download LilyPond and compile them -yourself.""" +These images are generated at approximately 180dpi. If you want a better impression of the appearance do print out one the postscript version of the samples.""" # diff --git a/input/bugs/text-kerning.ly b/input/bugs/text-kerning.ly new file mode 100644 index 0000000000..b40afe216e --- /dev/null +++ b/input/bugs/text-kerning.ly @@ -0,0 +1,12 @@ + + +\score { + \notes \relative c'' < \context Voice { +% c16 c16 c16 c16 c4 + c4 c4 c4 + } +\context Lyrics \lyrics { foobar4 -- VAVAVAVAV4 -- foobar4 } > + + + \paper { linewidth = -10.0\cm; } +} diff --git a/input/twinkle-pop.ly b/input/twinkle-pop.ly index 2483ba6094..c947712eb1 100644 --- a/input/twinkle-pop.ly +++ b/input/twinkle-pop.ly @@ -36,12 +36,12 @@ acc = \chords { text = \lyrics{ \property Lyrics . textStyle = "italic" - Ah!4 vous dir- ai- je ma man2 - Ce4 qui cau- se mon tour- ment2 - Pa-4 pa veut que je rai- so- nne - Comme4 un- e grand- e per- so- nne - Moi4 je dis que les bon- bons2 - Val-4 ent mieux que la rai- son2 + Ah!4 vous dir -- ai -- je ma man2 + Ce4 qui cau -- se mon tour -- ment2 + Pa4 -- pa veut que je rai -- so -- nne + Comme4 un -- e grand -- e per -- so -- nne + Moi4 je dis que les bon -- bons2 + Val4 -- ent mieux que la rai -- son2 } diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 246d275d8b..616e4c55f6 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -12,7 +12,7 @@ #include "staff-symbol-referencer.hh" #include "bar.hh" -#include "clef-item.hh" + #include "debug.hh" #include "command-request.hh" #include "timing-translator.hh" @@ -27,7 +27,7 @@ /// where is c-0 in the staff? class Clef_engraver : public Engraver { - Clef_item * clef_p_; + Item * clef_p_; Item * octavate_p_; Clef_change_req * clef_req_l_; @@ -177,7 +177,7 @@ Clef_engraver::create_clef() { if (!clef_p_) { - Clef_item *c= new Clef_item ( current_settings_); + Item *c= new Item ( current_settings_); announce_element (Score_element_info (c, clef_req_l_)); Staff_symbol_referencer_interface si(c); diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 781522d697..26bf3e2856 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -12,55 +12,62 @@ #include "molecule.hh" #include "item.hh" -Clef_item::Clef_item (SCM s) - : Item (s) -{} + +/** + Set a clef in a staff. + + properties: + + non-default -- not set because of existence of a bar? + + change -- is this a change clef (smaller size)? + + glyph -- a string determining what glyph is typeset + + */ +struct Clef +{ + static SCM before_line_breaking (SCM); +}; /* FIXME: should use symbol. -FIXME: this should be schemified. */ -GLUE_SCORE_ELEMENT(Clef_item,before_line_breaking); +MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Clef,before_line_breaking); SCM -Clef_item::member_before_line_breaking () +Clef::before_line_breaking (SCM smob) { - SCM style_sym =get_elt_property ("style"); + Item * s = dynamic_cast (unsmob_element (smob)); + + SCM style_sym =s->get_elt_property ("style"); String style; if (gh_string_p (style_sym)) style = ly_scm2string (style_sym); - SCM glyph = get_elt_property ("glyph"); + SCM glyph = s->get_elt_property ("glyph"); if (gh_string_p (glyph)) { - String s = ly_scm2string (glyph); + String str = ly_scm2string (glyph); /* FIXME: should use fontsize property to set clef changes. */ - if (get_elt_property ("non-default") && - break_status_dir() != RIGHT && style != "fullSizeChanges") + if (s->get_elt_property ("non-default") && + s->break_status_dir() != RIGHT && style != "fullSizeChanges") { - s += "_change"; - set_elt_property ("glyph", ly_str02scm (s.ch_C())); + str += "_change"; + s->set_elt_property ("glyph", ly_str02scm (str.ch_C())); } } else { - suicide (); + s->suicide (); return SCM_UNDEFINED; } - // ugh. - /* why not suicide? */ - if (style == "transparent") // UGH. JUNKME - { - set_elt_property ("molecule-callback", SCM_BOOL_T); - set_extent_callback (0, X_AXIS); - } - return SCM_UNDEFINED; } diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc index faf311ed83..8fc391ea0e 100644 --- a/lily/extender-engraver.cc +++ b/lily/extender-engraver.cc @@ -8,12 +8,12 @@ #include "proto.hh" #include "musical-request.hh" -#include "extender-spanner.hh" +#include "lyric-extender.hh" #include "paper-column.hh" #include "item.hh" #include "engraver.hh" #include "drul-array.hh" -#include "extender-spanner.hh" +#include "lyric-extender.hh" #include "pqueue.hh" @@ -28,8 +28,8 @@ then. */ class Extender_engraver : public Engraver { - Item * last_lyric_l_; - Item * current_lyric_l_; + Score_element *last_lyric_l_; + Score_element *current_lyric_l_; Extender_req* req_l_; Spanner* extender_p_; public: @@ -62,14 +62,15 @@ void Extender_engraver::acknowledge_element (Score_element_info i) { // -> text_item - if (Item* t = dynamic_cast (i.elem_l_)) + if (dynamic_cast (i.elem_l_) + && to_boolean (i.elem_l_->get_elt_property ("text-item-interface"))) { - current_lyric_l_ = t; + current_lyric_l_ = i.elem_l_; if (extender_p_ && !extender_p_->get_bound (RIGHT) ) { - Lyric_extender(extender_p_).set_textitem (RIGHT, t); + Lyric_extender(extender_p_).set_textitem (RIGHT, dynamic_cast (i.elem_l_)); } } } diff --git a/lily/hyphen-engraver.cc b/lily/hyphen-engraver.cc index 9fbbb77f5b..62341082df 100644 --- a/lily/hyphen-engraver.cc +++ b/lily/hyphen-engraver.cc @@ -22,8 +22,8 @@ then. */ class Hyphen_engraver : public Engraver { - Item *last_lyric_l_; - Item *current_lyric_l_; + Score_element *last_lyric_l_; + Score_element *current_lyric_l_; Hyphen_req* req_l_; Spanner* hyphen_p_; public: @@ -54,16 +54,16 @@ Hyphen_engraver::Hyphen_engraver () void Hyphen_engraver::acknowledge_element (Score_element_info i) { - // -> text-item - if (Item* t = dynamic_cast (i.elem_l_)) + if (dynamic_cast (i.elem_l_) + && to_boolean (i.elem_l_->get_elt_property ("text-item-interface"))) { - current_lyric_l_ = t; + current_lyric_l_ = i.elem_l_; if (hyphen_p_ && !hyphen_p_->get_bound (RIGHT) ) { - Hyphen_spanner (hyphen_p_).set_textitem (RIGHT, t); + Hyphen_spanner (hyphen_p_).set_textitem (RIGHT, i.elem_l_); } } } diff --git a/lily/hyphen-spanner.cc b/lily/hyphen-spanner.cc index 624f682be2..af618e87ca 100644 --- a/lily/hyphen-spanner.cc +++ b/lily/hyphen-spanner.cc @@ -5,7 +5,7 @@ (c) 1999 Glen Prideaux - (adapted from extender-spanner) + (adapted from lyric-extender) */ #include @@ -23,36 +23,52 @@ MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Hyphen_spanner,brew_molecule) SCM Hyphen_spanner::brew_molecule (SCM smob) { - Spanner * sp =dynamic_cast (unsmob_element (smob)); - Molecule mol; + Spanner * sp = dynamic_cast (unsmob_element (smob)); - Real leftext = sp->get_bound (LEFT)->extent (X_AXIS).length (); + Score_element * common = sp; + Direction d = LEFT; + do + { + common = common->common_refpoint( sp->get_bound (d), X_AXIS); + } + while (flip (&d) != LEFT); + Interval bounds; + + do + { + Real x = sp->get_bound (d)->relative_coordinate (common, X_AXIS); + Interval ext = sp->get_bound (d)->extent (X_AXIS); + bounds[d] = (x + ext[-d]); + } + while (flip (&d) != LEFT); + + Real ss = sp->paper_l ()->get_var ("staffspace"); Real lt = sp->paper_l ()->get_var ("stafflinethickness"); Real th = gh_scm2double (sp->get_elt_property ("thickness")) * lt ; Real h = gh_scm2double (sp->get_elt_property ("height")) * ss; Real l = gh_scm2double (sp->get_elt_property ("minimum-length")) * ss; - Real w = sp->spanner_length () - leftext - ss/2; - - + Real w = bounds.length (); /* First try: just make the hyphen take 1/3 of the available space for length, use a geometric mean of the available space and some minimum */ if(l < w) l = sqrt(l*w); - Box b (Interval ( (w-l)/2, (w+l)/2), Interval (h,h+th)); - mol.add_molecule (sp->lookup_l ()->filledbox (b)); - mol.translate_axis(leftext, X_AXIS); + Box b (Interval (-l/2,l/2), Interval (h,h+th)); + Molecule mol (sp->lookup_l ()->filledbox (b)); + mol.translate_axis (bounds.center () + -sp->relative_coordinate (common, X_AXIS), + X_AXIS); return mol.create_scheme (); } void -Hyphen_spanner::set_textitem (Direction d, Item* textitem_l) +Hyphen_spanner::set_textitem (Direction d, Score_element* b) { - elt_l_->set_bound (d, textitem_l); - elt_l_->add_dependency (textitem_l); + elt_l_->set_bound (d, b); + elt_l_->add_dependency (b); } Hyphen_spanner::Hyphen_spanner (Spanner*s) diff --git a/lily/include/clef-item.hh b/lily/include/clef-item.hh index e14276ba67..a3f7c5ed44 100644 --- a/lily/include/clef-item.hh +++ b/lily/include/clef-item.hh @@ -11,27 +11,6 @@ #include "direction.hh" -/** - Set a clef in a staff. - - properties: - - non-default -- not set because of existence of a bar? - - change -- is this a change clef (smaller size)? - - glyph -- a string determining what glyph is typeset - - */ -class Clef_item : public Item -{ -public: - SCM member_before_line_breaking (); - static SCM before_line_breaking (SCM); - - VIRTUAL_COPY_CONS(Score_element); - Clef_item (SCM); -}; #endif // CLEFITEM_HH diff --git a/lily/include/extender-spanner.hh b/lily/include/extender-spanner.hh index 5d7e4c4af9..65296f8106 100644 --- a/lily/include/extender-spanner.hh +++ b/lily/include/extender-spanner.hh @@ -1,40 +1,2 @@ -/* - extender-spanner.hh -- part of GNU LilyPond - - (c) 1998--2000 Jan Nieuwenhuizen -*/ - -#ifndef EXTENDER_SPANNER_HH -#define EXTENDER_SPANNER_HH - -#include "spanner.hh" - -/** - simple extender line - - The extender is a simple line at the baseline of the lyric - that helps show the length of a melissima (tied/slurred note). - - Extenders must be entered manually for now. - - Although it would be possible for Lily to determine where to - put extender lines, it's quite a tricky thing to do. Also, - this would demand quite strict lyrics entries. - - Note: the extender is only used for one-syllable words, or - for on a word's last syllable. The extender should be aligned - with the left side of the last note of the melissima, and not - extend beond, lasting the whole duration of the melissima - (as in MUP, urg). - */ -class Lyric_extender // interface -{ -public: - Spanner*elt_l_; - Lyric_extender (Spanner*); - void set_textitem (Direction, Item*); - static SCM brew_molecule (SCM); -}; - -#endif // EXTENDER_SPANNER_HH +#error diff --git a/lily/include/hyphen-spanner.hh b/lily/include/hyphen-spanner.hh index c185c64e96..e8947a4209 100644 --- a/lily/include/hyphen-spanner.hh +++ b/lily/include/hyphen-spanner.hh @@ -23,7 +23,7 @@ struct Hyphen_spanner // interface public: Spanner* elt_l_; Hyphen_spanner (Spanner*); - void set_textitem (Direction, Item*); + void set_textitem (Direction, Score_element*); static SCM brew_molecule (SCM); }; diff --git a/lily/include/lyric-extender.hh b/lily/include/lyric-extender.hh new file mode 100644 index 0000000000..8f0c746b86 --- /dev/null +++ b/lily/include/lyric-extender.hh @@ -0,0 +1,41 @@ + +/* + extender-spanner.hh -- part of GNU LilyPond + + (c) 1998--2000 Jan Nieuwenhuizen +*/ + +#ifndef EXTENDER_SPANNER_HH +#define EXTENDER_SPANNER_HH + +#include "spanner.hh" + +/** + simple extender line + + The extender is a simple line at the baseline of the lyric + that helps show the length of a melissima (tied/slurred note). + + Extenders must be entered manually for now. + + Although it would be possible for Lily to determine where to + put extender lines, it's quite a tricky thing to do. Also, + this would demand quite strict lyrics entries. + + Note: the extender is only used for one-syllable words, or + for on a word's last syllable. The extender should be aligned + with the left side of the last note of the melissima, and not + extend beond, lasting the whole duration of the melissima + (as in MUP, urg). + */ +class Lyric_extender // interface +{ +public: + Spanner*elt_l_; + Lyric_extender (Spanner*); + void set_textitem (Direction, Score_element*); + static SCM brew_molecule (SCM); +}; + +#endif // EXTENDER_SPANNER_HH + diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 2eb457e514..9fb7f0bed6 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -37,7 +37,7 @@ public: // TODO: make virtual and do this for Items as well. Interval_t spanned_rank_iv (); - void set_bound (Direction d, Item*); + void set_bound (Direction d, Score_element*); Item *get_bound (Direction d) const; Spanner (SCM); diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 64f4e4f0a5..524d32cffa 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -17,7 +17,7 @@ #include "engraver.hh" #include "musical-pitch.hh" #include "protected-scm.hh" -#include "clef-item.hh" + /** Make the key signature. @@ -100,7 +100,7 @@ Key_engraver::do_try_music (Music * req_l) void Key_engraver::acknowledge_element (Score_element_info info) { - if (dynamic_cast (info.elem_l_)) + if (to_boolean (info.elem_l_->get_elt_property ("clef-interface"))) { SCM c = get_property ("createKeyOnClefChange"); if (to_boolean (c)) diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index 64a306b3ed..5856b92318 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -12,6 +12,7 @@ #include "item.hh" #include "paper-def.hh" #include "lookup.hh" +#include "side-position-interface.hh" ADD_THIS_TRANSLATOR (Lyric_engraver); @@ -45,6 +46,13 @@ Lyric_engraver::do_process_music() text_p_->set_elt_property ("text", ly_str02scm ((req_l_->text_str_ + " ").ch_C ())); + text_p_->add_offset_callback (&Side_position_interface::aligned_on_self,X_AXIS); + /* + We can't reach the notehead where we're centered from here. So + we kludge. + */ + text_p_->translate_axis (paper_l()->get_var ("quartwidth")/2, X_AXIS); + announce_element (Score_element_info (text_p_, req_l_)); } } diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc index 89f3eddf05..9ae0629bd6 100644 --- a/lily/lyric-extender.cc +++ b/lily/lyric-extender.cc @@ -13,7 +13,7 @@ #include "molecule.hh" #include "paper-column.hh" #include "paper-def.hh" -#include "extender-spanner.hh" +#include "lyric-extender.hh" MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Lyric_extender,brew_molecule) @@ -33,10 +33,10 @@ Lyric_extender::brew_molecule (SCM smob) } void -Lyric_extender::set_textitem (Direction d, Item* textitem_l) +Lyric_extender::set_textitem (Direction d, Score_element*s) { - elt_l_->set_bound (d, textitem_l); - elt_l_->add_dependency (textitem_l); + elt_l_->set_bound (d, s); + elt_l_->add_dependency (s); } Lyric_extender::Lyric_extender (Spanner*s) diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 92945681de..019e367361 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -8,7 +8,6 @@ #include #include "bar.hh" -#include "clef-item.hh" #include "command-request.hh" #include "dimension-cache.hh" #include "engraver-group-engraver.hh" diff --git a/lily/spanner.cc b/lily/spanner.cc index c620ab64a3..711eaddf41 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -157,8 +157,15 @@ Spanner::get_bound (Direction d) const } void -Spanner::set_bound(Direction d, Item*i) +Spanner::set_bound(Direction d, Score_element*s) { + Item * i = dynamic_cast (s); + if (!i) + { + programming_error ("Must have Item for spanner bound."); + return; + } + spanned_drul_[d] =i; /** diff --git a/ly/engraver.ly b/ly/engraver.ly index 965b16b80a..8cc3a631cd 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -445,10 +445,11 @@ ScoreContext = \translator { ) basicClefItemProperties = #`( (molecule-callback . ,Score_element::brew_molecule) - (before-line-breaking-callback . ,Clef_item::before_line_breaking) + (before-line-breaking-callback . ,Clef::before_line_breaking) (breakable . #t) (break-align-symbol . Clef_item) - (visibility-lambda . ,begin-of-line-visible) + (visibility-lambda . ,begin-of-line-visible) + (clef-interface . #t) ) basicSlurProperties = #`( (molecule-callback . ,Slur::brew_molecule) @@ -511,7 +512,9 @@ ScoreContext = \translator { ) basicLyricTextProperties = #`( (molecule-callback . ,Text_item::brew_molecule) + (self-alignment-X . 0) (non-rhythmic . #t) + (text-item-interface . #t) ) basicMarkProperties = #`( (molecule-callback . ,Text_item::brew_molecule) -- 2.39.2