]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.63.uu1: Re: Lilypond?
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 23 Jun 2000 17:06:48 +0000 (19:06 +0200)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 23 Jun 2000 17:06:48 +0000 (19:06 +0200)
1.3.63.uu1
==========

* Lyrics centered on notehead.

* Removed Clef_item as score-element derived type.

22 files changed:
CHANGES
Documentation/header.html.in
VERSION
buildscripts/mutopia-index.py
input/bugs/text-kerning.ly [new file with mode: 0644]
input/twinkle-pop.ly
lily/clef-engraver.cc
lily/clef-item.cc
lily/extender-engraver.cc
lily/hyphen-engraver.cc
lily/hyphen-spanner.cc
lily/include/clef-item.hh
lily/include/extender-spanner.hh
lily/include/hyphen-spanner.hh
lily/include/lyric-extender.hh [new file with mode: 0644]
lily/include/spanner.hh
lily/key-engraver.cc
lily/lyric-engraver.cc
lily/lyric-extender.cc
lily/mark-engraver.cc
lily/spanner.cc
ly/engraver.ly

diff --git a/CHANGES b/CHANGES
index 328030c51327edcadc764b6f7e527af7f477b22b..9b9e6f3f2f13837f7b472685cf9c7934a2f38720 100644 (file)
--- 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
 ===========
 
index f64851dc80bade8cbd011169b70b64f6dbabd60d..31c6699b8f1905bd4889162cdf2b4b37e8cea7f4 100644 (file)
@@ -60,7 +60,7 @@ which substitutes some @AT_VARIABLES@ as well.
       </td></tr>
       <tr><td><font size=-1>
         <a href="ftp://ftp.gnu.org/pub/gnu/lilypond">Stable</a><br>
-        <a href="ftp://ftp.cs.uu.nl/pub/gnu/LilyPond/development">Development</a><br>
+        <a href="ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/development">Development</a><br>
        <br>
       </td></tr>
       <tr><td bgcolor="#e8e8ff">
diff --git a/VERSION b/VERSION
index 8bedfa858dee3c56e288b69f70d33757d75c72cf..5301762a5fa8b65c8458ebfe4b0347f6b97c0312 100644 (file)
--- 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.
index 9e05102b94005f7feb55b3af7850275761c3e865..f56ab3bca2b4d4a524d3b065b04359f8bf1274ed 100755 (executable)
@@ -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 <a href="http://www.gnu.org/philosophy/gif.html">patent problems</a>.
 <p>
-If you want an accurate impression of the output quality please <em>print
-out</em> 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 (file)
index 0000000..b40afe2
--- /dev/null
@@ -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; }
+}
index 2483ba60940ea2f1f878e86eb36375f082c596d9..c947712eb13d11c2a223f821041425c57616a619 100644 (file)
@@ -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
         
 }
 
index 246d275d8b9ed6d03502fdc2c3f12f6dfdffdf52..616e4c55f6d8353c9d2b14731437ef9f2400d3bb 100644 (file)
@@ -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);
index 781522d697009792392ab1029d5e34dbcaa6d97a..26bf3e2856bf02e598e02e29972190d3b183cf82 100644 (file)
 #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<Item*> (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;
 }
 
index faf311ed83b254e24f5831f70211c4d20ee6111d..8fc391ea0e8de693e8071454485366876c0d59fb 100644 (file)
@@ -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<Item*> (i.elem_l_))
+  if (dynamic_cast<Item*> (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<Item*> (i.elem_l_));
          }
     }
 }
index 9fbbb77f5b95bee47d76c4655230a4c36e600a3d..62341082df9547a3b3e70dbfc2d8a1d418748df1 100644 (file)
@@ -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<Item*> (i.elem_l_))
+  if (dynamic_cast<Item*> (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_);
          }
     }
 }
index 624f682be20234a3c1085a7c60e04e85ae908856..af618e87ca33851fb25d5a0637e61f0ee68fe0ab 100644 (file)
@@ -5,7 +5,7 @@
 
   (c) 1999 Glen Prideaux <glenprideaux@iname.com>
 
-  (adapted from extender-spanner)
+  (adapted from lyric-extender)
 */
 
 #include <math.h>
@@ -23,36 +23,52 @@ MAKE_SCHEME_SCORE_ELEMENT_CALLBACK(Hyphen_spanner,brew_molecule)
 SCM 
 Hyphen_spanner::brew_molecule (SCM smob)
 {
-  Spanner * sp  =dynamic_cast<Spanner*> (unsmob_element (smob));
-  Molecule  mol;
+  Spanner * sp = dynamic_cast<Spanner*> (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)
index e14276ba6783cab7ab058c920c15e743012a53b6..a3f7c5ed447022df2a06ad090582f933bac42b3d 100644 (file)
 #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
 
index 5d7e4c4af93115f68463e4d58fc4e3d6862a1b7e..65296f81060baccd891380179b283fc7515acef0 100644 (file)
@@ -1,40 +1,2 @@
-/*
-  extender-spanner.hh -- part of GNU LilyPond
-
-  (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
-*/
-
-#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
index c185c64e962f76d21fd1d8e5109486943b3d8846..e8947a42091f5b1b73b26a827efc0f75f0dbcef8 100644 (file)
@@ -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 (file)
index 0000000..8f0c746
--- /dev/null
@@ -0,0 +1,41 @@
+
+/*
+  extender-spanner.hh -- part of GNU LilyPond
+
+  (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#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
+
index 2eb457e514a7b452d455c228d1f999495125a50e..9fb7f0bed6e5054cacede858a7f752f31f3e91c6 100644 (file)
@@ -37,7 +37,7 @@ public:
 
   // TODO: make virtual and do this for Items as well.
   Interval_t<int> spanned_rank_iv ();
-  void set_bound (Direction d, Item*);
+  void set_bound (Direction d, Score_element*);
   Item *get_bound (Direction d) const;
   
   Spanner (SCM);
index 64f4e4f0a59e3778e7a1de17936ef585d485b515..524d32cffaa013748f05682c0f42d6cc3701b3c1 100644 (file)
@@ -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 <Clef_item *> (info.elem_l_)) 
+  if (to_boolean (info.elem_l_->get_elt_property ("clef-interface"))) 
     {
       SCM c =  get_property ("createKeyOnClefChange");
       if (to_boolean (c))
index 64a306b3ed427a2ad07e3c92c9e6c63a83a6f922..5856b9231860be6725fce25e1a8811540e0bd17b 100644 (file)
@@ -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_));
     }
 }
index 89f3eddf05ddf9891d88b4e4ee019a61a5c1fca9..9ae0629bd6ce96be01bec049d69eb8e2afdef35a 100644 (file)
@@ -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)
index 92945681de34fb18447488dc9d1975ba5faa271d..019e36736182f5aed63a32140826215c47a87983 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <ctype.h>
 #include "bar.hh"
-#include "clef-item.hh"
 #include "command-request.hh"
 #include "dimension-cache.hh"
 #include "engraver-group-engraver.hh"
index c620ab64a32b19a72d291d557e2e616342e86617..711eaddf41d3f19d3d02d2a71bec4ebfc0ce866f 100644 (file)
@@ -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<Item*> (s);
+  if (!i)
+    {
+      programming_error ("Must have Item for spanner bound.");
+      return;
+    }
+  
   spanned_drul_[d] =i;
 
   /**
index 965b16b80ac42f28dcaf222fca451435f2984fa0..8cc3a631cdae8825ce138c3a9e45a48b05a68673 100644 (file)
@@ -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)