+2003-05-13 Juergen Reuter <reuter@ipd.uka.de>
+
+ * lily/coherent-ligature-engraver.cc: fixed typo
+
+ * lily/coherent-ligature-engraver.cc,
+ lily/gregorian-ligature-engraver.cc,
+ lily/ligature-bracket-engraver.cc, lily/ligature-engraver.cc,
+ lily/mensural-ligature-engraver.cc, lily/note-heads-engraver.cc,
+ lily/vaticana-ligature-engraver.cc,
+ lily/include/ligature-engraver.hh, ly/gregorian-init.ly,
+ scm/grob-description.scm: cleanup: junked LigatureHead grob and
+ removed all ligature specific stuff from NoteHead code
+
+ * lily/ligature-head.cc, lily/include/ligature-head.hh: removed;
+ ligatures now use regular noteheads
+
+ * lily/vaticana-ligature.cc: tiny code cleanups
+
+ * lily/vaticana-ligature-engraver.cc: bugfix: insert additional
+ space between two adjacent noteheads of the same pitch
+
+ * scm/grob-description.scm: bugfix: VaticanaLigature: interface
+ description; cleanup: removed obsolete font-family settings
+
2003-05-11 Juergen Reuter <reuter@ipd.uka.de>
* lily/coherent-ligature-engraver.cc,
* any further accidental for that pitch within that ligature
* (actually, in such a case, the user should split the ligature into
* two separate ligatures). Similarly, any object that, in ordinary
- * notation, may be put to the left or to the right of a
- * note-head/ligature-head, should be collected and put before or
- * after the ligature.
+ * notation, may be put to the left or to the right of a note-head,
+ * should be collected and put before or after the ligature.
*
* TODO: make spacing more robust: do not screw up spacing if user
* erroneously puts rest in ligature.
void
Coherent_ligature_engraver::build_ligature (Spanner *, Array<Grob_info>)
{
- programming_error ("Cohrent_ligature_engraver::build_ligature (): "
+ programming_error ("Coherent_ligature_engraver::build_ligature (): "
"this is an abstract method that should not be called, "
"but overridden by a subclass");
}
/* descr */ "This is an abstract class. Subclasses such as Gregorian_ligature_engraver handle ligatures by glueing special ligature heads together.",
/* creats*/ "",
/* accepts */ "ligature-event abort-event",
-/* acks */ "ligature-head-interface note-head-interface rest-interface",
+/* acks */ "note-head-interface rest-interface",
/* reads */ "",
/* write */ "");
/* descr */ "This is an abstract class. Subclasses such as Vaticana_ligature_engraver handle ligatures by glueing special ligature heads together.",
/* creats*/ "",
/* accepts */ "ligature-event abort-event",
-/* acks */ "ligature-head-interface note-head-interface rest-interface",
+/* acks */ "note-head-interface rest-interface",
/* reads */ "",
/* write */ "");
Grob *last_bound_;
+ void override_molecule_callback ();
+ void revert_molecule_callback ();
};
#endif // LIGATURE_ENGRAVER_HH
+++ /dev/null
-/*
- ligature-head.hh -- part of GNU LilyPond
-
- (c) 2002--2003 Juergen Reuter <reuter@ipd.uka.de>
-*/
-
-#ifndef LIGATURE_HEAD_HH
-#define LIGATURE_HEAD_HH
-
-#include "lily-guile.hh"
-#include "molecule.hh"
-
-/** ball within a ligature. Also takes care of ledger lines.
-
- LigatureHead is a kind of RhythmicHead, see there.
-
- Read-only:
-*/
-
-class Ligature_head
-{
-public:
- DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
- static bool has_interface (Grob*);
-
-};
-#endif // LIGATURE_HEAD_HH
-
/* descr */ "Handles Ligature_events by engraving Ligature brackets.",
/* creats*/ "TupletBracket",
/* accepts */ "ligature-event abort-event",
-/* acks */ "ligature-head-interface rest-interface note-column-interface",
+/* acks */ "rest-interface note-column-interface",
/* reads */ "",
/* write */ "");
*/
#include "ligature-engraver.hh"
-#include "ligature-head.hh"
#include "spanner.hh"
#include "score-engraver.hh"
#include "note-head.hh"
#include "rest.hh"
#include "warn.hh"
+#include "translator-group.hh"
/*
* This abstract class provides the general framework for ligatures of
return 0;
}
+/*
+ * This method should do something that comes close to the following
+ * .ly snippet:
+ *
+ * \property Voice.NoteHead \override #'molecule-callback =
+ * < value of #'ligature-primitive-callback of Voice.NoteHead >
+ *
+ * TODO: What we are doing here on the c++ level, should actually be
+ * performed on the SCM level. However, I do not know how to teach
+ * lilypond to apply an \override and \revert on #'molecule-callback,
+ * whenever lily encounters a \[ and \] in an .ly file, respectively.
+ * Also encounter, that lily should not crash if a user erronously
+ * nests \[ and \].
+ */
+void
+Ligature_engraver::override_molecule_callback ()
+{
+ SCM symbol = ly_symbol2scm ("NoteHead");
+ SCM target_callback = ly_symbol2scm ("molecule-callback");
+ SCM source_callback = ly_symbol2scm ("ligature-primitive-callback");
+ SCM noteHeadProperties = daddy_trans_->get_property ("NoteHead");
+ SCM value = ly_cdr (scm_sloppy_assq (source_callback, noteHeadProperties));
+ daddy_trans_->execute_single_pushpop_property (symbol, target_callback, value);
+}
+
+/*
+ * This method should do something that comes close to the following
+ * .ly snippet:
+ *
+ * \property Voice.NoteHead \revert #'molecule-callback
+ *
+ * TODO: What we are doing here on the c++ level, should actually be
+ * performed on the SCM level. However, I do not know how to teach
+ * lilypond to apply an \override and \revert on #'molecule-callback,
+ * whenever lily encounters a \[ and \] in an .ly file, respectively.
+ * Also encounter, that lily should not crash if a user erronously
+ * nests \[ and \].
+ */
+void
+Ligature_engraver::revert_molecule_callback ()
+{
+ SCM symbol = ly_symbol2scm ("NoteHead");
+ SCM key = ly_symbol2scm ("molecule-callback");
+ daddy_trans_->execute_single_pushpop_property (symbol, key, SCM_UNDEFINED);
+}
+
void
Ligature_engraver::process_music ()
{
if (reqs_drul_[STOP])
{
if (!ligature_)
- reqs_drul_[STOP]->origin ()->warning (_ ("can't find start of ligature"));
+ {
+ reqs_drul_[STOP]->origin ()->warning (_ ("can't find start of ligature"));
+ return;
+ }
+
+ if (!last_bound_)
+ {
+ reqs_drul_[STOP]->origin ()->warning (_ ("no right bound"));
+ }
else
{
- if (!last_bound_)
- {
- reqs_drul_[STOP]->origin ()->warning (_ ("no right bound"));
- }
- else
- {
- ligature_->set_bound (RIGHT, last_bound_);
- }
+ ligature_->set_bound (RIGHT, last_bound_);
}
+
prev_start_req_ = 0;
finished_primitives_ = primitives_;
finished_ligature_ = ligature_;
primitives_.clear ();
ligature_ = 0;
+ revert_molecule_callback ();
}
last_bound_ = unsmob_grob (get_property ("currentMusicalColumn"));
// TODO: maybe forbid breaks only if not transcribing
top_engraver ()->forbid_breaks ();
}
+
if (reqs_drul_[START])
{
if (ligature_)
ligature_start_mom_ = now_mom ();
announce_grob(ligature_, reqs_drul_[START]->self_scm());
+ override_molecule_callback ();
}
}
if (Note_head::has_interface (info.grob_))
{
primitives_.push (info);
- }
- if (Ligature_head::has_interface (info.grob_))
- {
- info.grob_->set_grob_property ("ligature-primitive-callback",
+ info.grob_->set_grob_property ("molecule-callback",
brew_ligature_primitive_proc);
}
- else if (Rest::has_interface (info.grob_))
+ if (Rest::has_interface (info.grob_))
{
info.music_cause ()->origin ()->warning (_ ("ligature may not contain rest; ignoring rest"));
prev_start_req_->origin ()->warning (_ ("ligature was started here"));
/* descr */ "Abstract class; a concrete subclass handles Ligature_events by engraving Ligatures in a concrete style.",
/* creats */ "",
/* accepts */ "ligature-event abort-event",
-/* acks */ "ligature-head-interface rest-interface",
+/* acks */ "note-head-interface rest-interface",
/* reads */ "",
/* write */ "");
+++ /dev/null
-/*
- ligature-head.cc -- implement Ligature_head
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2002--2003 Juergen Reuter <reuter@ipd.uka.de>
-*/
-
-#include "ligature-head.hh"
-#include "item.hh"
-#include "note-head.hh"
-#include "warn.hh"
-
-/*
- * TODO: in scm/grob-description.scm, LigatureHead must contain value
- * "rhythmic-head-interface" in the interfaces list. Otherwise, text
- * scripts (such as fermata) are horizontally aligned with the end of
- * the ligature rather than with the associated head. Why?
- */
-MAKE_SCHEME_CALLBACK (Ligature_head,brew_molecule,1);
-SCM
-Ligature_head::brew_molecule (SCM smob)
-{
- Grob *me = unsmob_grob (smob);
- SCM brew_ligature_primitive_proc =
- me->get_grob_property ("ligature-primitive-callback");
- if (brew_ligature_primitive_proc != SCM_EOL)
- {
- return gh_call1 (brew_ligature_primitive_proc, smob);
- }
- else
- {
- warning ("Ligature_head: ligature-primitive-callback undefined -> resorting to Note_head::brew_molecule");
- return Note_head::brew_molecule (smob);
- }
-}
-
-/*
- UGH primitive is only used within the engraver.
-*/
-ADD_INTERFACE (Ligature_head,"ligature-head-interface","Ligature head",
- "primitive ligature-primitive-callback thickness flexa-width head-width delta-pitch join-left");
}
/*
- * A MensuralLigature grob consists of a bunch of LigatureHead grobs
- * that are glued together. It (a) does not make sense to change
+ * A MensuralLigature grob consists of a bunch of NoteHead grobs that
+ * are glued together. It (a) does not make sense to change
* properties like thickness or flexa-width from one head to the next
* within a ligature (this would totally screw up alignment), and (b)
* some of these properties (like flexa-width) are specific to
* e.g. the MensuralLigature (as in contrast to e.g. LigatureBracket),
- * and therefore should not be handled in the generic LigatureHead
- * (which is also used by LigatureBracket). Therefore, we let the
- * user control these properties via the concrete Ligature grob (like
+ * and therefore should not be handled in the NoteHead code (which is
+ * also used by LigatureBracket). Therefore, we let the user control
+ * these properties via the concrete Ligature grob (like
* MensuralLigature) and then copy these properties as necessary to
- * each of the LigatureHead grobs. This is what
+ * each of the NoteHead grobs. This is what
* propagate_properties() does.
*/
void
/* descr */ "Handles Mensural_ligature_events by glueing special ligature heads together.",
/* creats*/ "MensuralLigature",
/* accepts */ "ligature-event abort-event",
-/* acks */ "ligature-head-interface note-head-interface rest-interface",
+/* acks */ "note-head-interface rest-interface",
/* reads */ "",
/* write */ "");
make balls and rests
*/
-/*
- * TODO: junk bool in_ligature (and all the messy code around it).
- * This can be done by also junking LigatureHead in
- * scm/grob-description.scm. Instead, NoteHead should be used
- * throughout typesetting of ligatures; ligature-(start/stop)-events
- * should simply modify NoteHead properties values of
- * molecule-callback ligature-primitive-callback. --jr
- */
class Note_heads_engraver : public Engraver
{
Link_array<Item> notes_;
virtual void process_music ();
virtual void stop_translation_timestep ();
-
-private:
- bool in_ligature;
};
Note_heads_engraver::Note_heads_engraver()
{
- in_ligature = 0;
}
bool
}
else if (m->is_mus_type ("busy-playing-event"))
return note_reqs_.size ();
- else if (m->is_mus_type ("abort-event"))
- {
- in_ligature = 0;
- }
- else if (m->is_mus_type ("ligature-event"))
- {
- /*
- Urg ; this is not protocol. We should accept and return
- true, or ignore.
- */
- in_ligature = (to_dir (m->get_mus_property("span-direction")) == START);
- return false;
- }
return false;
}
{
for (int i=0; i < note_reqs_.size (); i++)
{
- Item *note =
- new Item (get_property ((in_ligature) ? "LigatureHead" : "NoteHead"));
+ Item *note = new Item (get_property ("NoteHead"));
Music * req = note_reqs_[i];
ENTER_DESCRIPTION(Note_heads_engraver,
-/* descr */ "Generate noteheads (also serves a double functions: makes ligatures.",
-/* creats*/ "NoteHead LigatureHead Dots",
+/* descr */ "Generate noteheads.",
+/* creats*/ "NoteHead Dots",
/* accepts */ "note-event busy-playing-event ligature-event abort-event",
/* acks */ "",
/* reads */ "centralCPosition",
*/
next_distance += 2 * join_thickness;
}
+ else if (pitch_delta == 0)
+ {
+ /*
+ * Make a small space between two adjacent notes with the
+ * same pitch.
+ */
+ next_distance += 2 * join_thickness;
+ }
/*
* Horizontally line-up this head to form a ligature.
/* descr */ "Handles ligatures by glueing special ligature heads together.",
/* creats*/ "VaticanaLigature",
/* accepts */ "ligature-event abort-event",
-/* acks */ "ligature-head-interface note-head-interface rest-interface",
+/* acks */ "note-head-interface rest-interface",
/* reads */ "",
/* write */ "");
*/
Molecule
vaticana_brew_flexa (Grob *me,
- Real interval,
bool solid,
- Real width,
Real thickness,
- bool add_stem,
Direction stem_direction)
{
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Molecule molecule = Molecule ();
+ Real right_height = 0.6 * staff_space;
+
+ Real interval;
+ SCM flexa_height_scm = me->get_grob_property ("flexa-height");
+ if (flexa_height_scm != SCM_EOL)
+ {
+ interval = gh_scm2int (flexa_height_scm);
+ }
+ else
+ {
+ me->warning ("Vaticana_ligature: "
+ "flexa-height undefined; assuming 0");
+ interval = 0.0;
+ }
+
if (interval >= 0.0)
{
me->warning (_ ("ascending vaticana style flexa"));
}
- Real space = Staff_symbol_referencer::staff_space (me);
- Molecule molecule = Molecule ();
- Real right_height = 0.6 * space;
+ Real width;
+ SCM flexa_width_scm = me->get_grob_property ("flexa-width");
+ if (flexa_width_scm != SCM_EOL)
+ {
+ width = gh_scm2double (flexa_width_scm);
+ }
+ else
+ {
+ me->warning ("Vaticana_ligature:"
+ "flexa-width undefined; assuming 2.0");
+ width = 2.0 * staff_space;
+ }
+
+ bool add_stem = to_boolean (me->get_grob_property ("add-stem"));
// Compensate thickness that appears to be smaller in steep section
// of bend.
- Real left_height = right_height + min (0.12 * abs(interval), 0.3) * space;
+ Real left_height =
+ right_height +
+ min (0.12 * abs(interval), 0.3) * staff_space;
if (add_stem)
{
if (consider_interval)
{
- Real y_length = max (abs(interval)/2.0*space +
+ Real y_length = max (abs(interval)/2.0*staff_space +
(right_height-left_height),
- 1.2*space);
+ 1.2*staff_space);
stem_box_y = Interval (0, y_length);
}
else
- stem_box_y = Interval (0, space);
+ stem_box_y = Interval (0, staff_space);
Real y_correction =
(stem_direction == UP) ?
// Compensate optical illusion regarding vertical position of left
// and right endings due to curved shape.
- Real ypos_correction = -0.1*space * sign(interval);
- Real interval_correction = 0.2*space * sign(interval);
- Real corrected_interval = interval*space + interval_correction;
+ Real ypos_correction = -0.1*staff_space * sign(interval);
+ Real interval_correction = 0.2*staff_space * sign(interval);
+ Real corrected_interval = interval*staff_space + interval_correction;
// middle curve of flexa shape
Bezier curve;
if (!String::compare (glyph_name, "flexa"))
{
- SCM flexa_height_scm = me->get_grob_property ("flexa-height");
- if (flexa_height_scm != SCM_EOL)
- {
- flexa_height = gh_scm2int (flexa_height_scm);
- }
- else
- {
- me->warning ("Vaticana_ligature: "
- "flexa-height undefined; assuming 0");
- }
-
- Real flexa_width;
- SCM flexa_width_scm = me->get_grob_property ("flexa-width");
- if (flexa_width_scm != SCM_EOL)
- {
- flexa_width = gh_scm2double (flexa_width_scm);
- }
- else
- {
- me->warning ("Vaticana_ligature:"
- "flexa-width undefined; assuming 2.0");
- flexa_width = 2.0 * staff_space;
- }
-
- bool add_stem = to_boolean (me->get_grob_property ("add-stem"));
- out = vaticana_brew_flexa (me, flexa_height, true,
- flexa_width, thickness, add_stem, DOWN);
+ out = vaticana_brew_flexa (me, true, thickness, DOWN);
}
else
{
% declare head prefix shortcuts
%
virga =
- \once \property Voice.LigatureHead \override #'virga = ##t
+ \once \property Voice.NoteHead \override #'virga = ##t
stropha =
- \once \property Voice.LigatureHead \override #'stropha = ##t
+ \once \property Voice.NoteHead \override #'stropha = ##t
inclinatum =
- \once \property Voice.LigatureHead \override #'inclinatum = ##t
+ \once \property Voice.NoteHead \override #'inclinatum = ##t
auctum =
- \once \property Voice.LigatureHead \override #'auctum = ##t
+ \once \property Voice.NoteHead \override #'auctum = ##t
aucta =
- \once \property Voice.LigatureHead \override #'auctum = ##t
+ \once \property Voice.NoteHead \override #'auctum = ##t
descendens =
- \once \property Voice.LigatureHead \override #'descendens = ##t
+ \once \property Voice.NoteHead \override #'descendens = ##t
ascendens =
- \once \property Voice.LigatureHead \override #'ascendens = ##t
+ \once \property Voice.NoteHead \override #'ascendens = ##t
pes =
- \once \property Voice.LigatureHead \override #'pes-or-flexa = ##t
+ \once \property Voice.NoteHead \override #'pes-or-flexa = ##t
flexa =
- \once \property Voice.LigatureHead \override #'pes-or-flexa = ##t
+ \once \property Voice.NoteHead \override #'pes-or-flexa = ##t
semivocalis =
- \once \property Voice.LigatureHead \override #'semivocalis = ##t
+ \once \property Voice.NoteHead \override #'semivocalis = ##t
oriscus =
- \once \property Voice.LigatureHead \override #'oriscus = ##t
+ \once \property Voice.NoteHead \override #'oriscus = ##t
quilisma =
- \once \property Voice.LigatureHead \override #'quilisma = ##t
+ \once \property Voice.NoteHead \override #'quilisma = ##t
deminutum =
- \once \property Voice.LigatureHead \override #'deminutum = ##t
+ \once \property Voice.NoteHead \override #'deminutum = ##t
%
% declare divisiones shortcuts
(neutral-direction . -1)
(adjust-if-on-staffline . #t)
(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
- (font-family . ancient)
(space-alist . (
(first-note . (minimum-space . 0.0))
(right-edge . (extra-space . 0.1))
(meta . ((interfaces . (tuplet-bracket-interface spanner-interface))))
))
- (LigatureHead
- . (
- (ligature-primitive-callback . ,Note_head::brew_molecule)
- (molecule-callback . ,Ligature_head::brew_molecule)
- (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
- (stem-attachment-function . ,note-head-style->attachment-coordinates)
- (font-family . ancient)
- (style . default)
- (glyph-name-procedure . ,find-notehead-symbol)
- (meta . ((interfaces . (ligature-head-interface rhythmic-head-interface
- rhythmic-grob-interface
- font-interface
- note-head-interface staff-symbol-referencer-interface))))
- ))
-
(LyricHyphen
. (
(thickness . 1.0)
(flexa-width . 2.0)
(ligature-primitive-callback . ,Mensural_ligature::brew_ligature_primitive)
(molecule-callback . ,Mensural_ligature::brew_molecule)
- (font-family . ancient)
(meta . ((interfaces . (mensural-ligature-interface font-interface))))
))
. (
(style . default)
(molecule-callback . ,Note_head::brew_molecule)
+ (ligature-primitive-callback . ,Note_head::brew_molecule)
(glyph-name-procedure . ,find-notehead-symbol)
(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
(stem-attachment-function . ,note-head-style->attachment-coordinates)
(flexa-width . 2.0)
(ligature-primitive-callback . ,Vaticana_ligature::brew_ligature_primitive)
(molecule-callback . ,Vaticana_ligature::brew_molecule)
- (font-family . ancient)
- (meta . ((interfaces . (mensural-ligature-interface font-interface))))
+ (meta . ((interfaces . (vaticana-ligature-interface font-interface))))
))
(VoltaBracket