+2002-05-18 Juergen Reuter <reuter@ipd.uka.de>
+
+ * mf/parmesan-heads.mf, scm/grob-description.scm,
+ scm/grob-property-description.scm, scm/interface-description,
+ lily/include/my-lily-parser.hh, lily/include/ligature-head.hh,
+ lily/include/mensural-ligature.hh, lily/include/lily-proto.hh,
+ lily/include/ligature-engraver.hh,
+ lily/include/ligature-bracket.hh, lily/parser.yy,
+ lily/ligature-bracket-engraver.cc, lily/mensural-ligature.cc,
+ lily/mensural-ligature-engraver.cc, lily/note-heads-engraver.cc,
+ lily/ligature-head.cc, lily/ligature-engraver.cc,
+ lily/ligature-bracket.cc, input/test/mensural-ligatures.ly:
+ implemented white mensural ligatures (still with a big list of
+ TODOs)
+
+
2002-05-19 Han-Wen <hanwen@cs.uu.nl>
* lily/*.cc: use LY_DEFINE everywhere. Move doc strings from
#include "lily-proto.hh"
#include "lily-guile.hh"
-class Ligature_bracket
+struct Ligature_bracket
{
-public:
- Ligature_bracket (SCM);
DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static bool has_interface (Grob*);
-
-private:
};
#endif /* LIGATURE_BRACKET_HH */
--- /dev/null
+/*
+ ligature-engraver.hh -- declare Ligature_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2002 Juergen Reuter <reuter@ipd.uka.de>
+
+ */
+#ifndef LIGATUREENGRAVER_HH
+#define LIGATUREEENGRAVER_HH
+
+#include "engraver.hh"
+
+class Ligature_engraver : public Engraver
+{
+protected:
+ virtual void stop_translation_timestep ();
+ virtual void start_translation_timestep ();
+ virtual void finalize ();
+
+ virtual void acknowledge_grob (Grob_info);
+ virtual bool try_music (Music*);
+ virtual void process_music ();
+ virtual void try_stop_ligature ();
+ virtual Spanner *create_ligature_spanner ();
+
+ Spanner *finished_ligature_p_;
+ Spanner *ligature_p_;
+ SCM brew_ligature_primitive_proc;
+
+public:
+ TRANSLATOR_DECLARATIONS(Ligature_engraver);
+
+private:
+ Drul_array<Span_req*> reqs_drul_;
+
+ Span_req *prev_start_req_;
+
+ // moment where ligature started.
+ Moment ligature_start_mom_;
+
+ Grob *last_bound;
+
+};
+
+#endif // ENGRAVERGROUP_HH
class Key_performer;
class Keyword_ent;
class Keyword_table;
+class Ligature_engraver;
+class Ligature_bracket_engraver;
class Line_group_engraver_group;
class System;
class Local_key_item;
class Melisma_playing_req;
class Melisma_req;
class Melodic_req;
+class Mensural_ligature_engraver;
class Midi_chunk;
class Midi_def;
class Midi_duration;
SCM last_beam_start_;
void beam_check (SCM);
- SCM last_ligature_start_;
-
Input here_input () const;
void push_spot ();
Input pop_spot ();
/*
- ligature-bracket-engraver.cc -- implement Ligature__bracket_engraver
+ ligature-bracket-engraver.cc -- implement Ligature_bracket_engraver
source file of the GNU LilyPond music typesetter
(c) 2002 Juergen Reuter <reuter@ipd.uka.de>
*/
-#include "engraver.hh"
-#include "musical-request.hh"
-#include "warn.hh"
-#include "drul-array.hh"
-#include "item.hh"
+#include "ligature-engraver.hh"
#include "spanner.hh"
-#include "score-engraver.hh"
-#include "note-head.hh"
-#include "stem.hh"
-#include "rest.hh"
-class Ligature_bracket_engraver : public Engraver
+class Ligature_bracket_engraver : public Ligature_engraver
{
- Drul_array<Span_req*> reqs_drul_;
-
- Spanner *finished_ligature_bracket_p_;
- Spanner *ligature_bracket_p_;
- Span_req *prev_start_req_;
-
- // moment where ligature started.
- Moment ligature_start_mom_;
- Grob *last_bound;
-
protected:
- virtual void stop_translation_timestep ();
- virtual void start_translation_timestep ();
- virtual void finalize ();
-
- virtual void acknowledge_grob (Grob_info);
- virtual bool try_music (Music*);
- virtual void process_music ();
+ virtual Spanner *create_ligature_spanner ();
public:
TRANSLATOR_DECLARATIONS(Ligature_bracket_engraver);
Ligature_bracket_engraver::Ligature_bracket_engraver ()
{
- ligature_bracket_p_ = 0;
- finished_ligature_bracket_p_ = 0;
- reqs_drul_[LEFT] = reqs_drul_[RIGHT] = 0;
- prev_start_req_ = 0;
- last_bound = 0;
-}
-
-bool
-Ligature_bracket_engraver::try_music (Music *m)
-{
- if (Span_req *req_ = dynamic_cast<Span_req*> (m))
- {
- if (scm_equal_p (req_->get_mus_property ("span-type"),
- ly_str02scm ("abort")) == SCM_BOOL_T)
- {
- reqs_drul_[START] = 0;
- reqs_drul_[STOP] = 0;
- if (ligature_bracket_p_)
- ligature_bracket_p_->suicide ();
- ligature_bracket_p_ = 0;
- }
- else if (scm_equal_p (req_->get_mus_property ("span-type"),
- ly_str02scm ("ligature-bracket")) == SCM_BOOL_T)
- {
- Direction d = req_->get_span_dir ();
- reqs_drul_[d] = req_;
- return true;
- }
- }
- return false;
-}
-
-void
-Ligature_bracket_engraver::process_music ()
-{
- if (reqs_drul_[STOP])
- {
- if (!ligature_bracket_p_)
- reqs_drul_[STOP]->origin ()->warning (_ ("can't find start of ligature"));
- else
- {
- if (!last_bound)
- {
- reqs_drul_[STOP]->origin ()->warning (_ ("no right bound"));
- }
- else
- {
- ligature_bracket_p_->set_bound (RIGHT, last_bound);
- }
- }
- prev_start_req_ = 0;
- finished_ligature_bracket_p_ = ligature_bracket_p_;
- ligature_bracket_p_ = 0;
- }
- last_bound = unsmob_grob (get_property ("currentMusicalColumn"));
-
- if (ligature_bracket_p_)
- {
- // TODO: maybe forbid breaks only if not transcribing
- top_engraver ()->forbid_breaks ();
- }
- if (reqs_drul_[START])
- {
- if (ligature_bracket_p_)
- {
- reqs_drul_[START]->origin ()->warning (_ ("already have a ligature"));
- return;
- }
-
- prev_start_req_ = reqs_drul_[START];
- ligature_bracket_p_ = new Spanner (get_property ("LigatureBracket"));
-
- Grob *bound = unsmob_grob (get_property ("currentMusicalColumn"));
- if (!bound)
- {
- reqs_drul_[START]->origin ()->warning (_ ("no left bound"));
- }
- else
- {
- ligature_bracket_p_->set_bound (LEFT, bound);
- }
-
- ligature_start_mom_ = now_mom ();
-
- announce_grob(ligature_bracket_p_, reqs_drul_[START]->self_scm());
- }
-}
-
-void
-Ligature_bracket_engraver::start_translation_timestep ()
-{
- reqs_drul_[START] = 0;
- reqs_drul_[STOP] = 0;
-}
-
-void
-Ligature_bracket_engraver::typeset_ligature_bracket ()
-{
- if (finished_ligature_bracket_p_)
- {
- typeset_grob (finished_ligature_bracket_p_);
- finished_ligature_bracket_p_ = 0;
- }
-}
-
-void
-Ligature_bracket_engraver::stop_translation_timestep ()
-{
- typeset_ligature_bracket ();
-}
-
-void
-Ligature_bracket_engraver::finalize ()
-{
- typeset_ligature_bracket ();
- if (ligature_bracket_p_)
- {
- prev_start_req_->origin ()->warning (_ ("unterminated ligature"));
- ligature_bracket_p_->suicide ();
- }
}
-void
-Ligature_bracket_engraver::acknowledge_grob (Grob_info info)
+Spanner *
+Ligature_bracket_engraver::create_ligature_spanner ()
{
- if (ligature_bracket_p_)
- {
- if (Rest::has_interface (info.grob_l_))
- {
- reqs_drul_[START]->origin ()->warning (_ ("ligature may not contain rest; ignoring rest"));
- prev_start_req_->origin ()->warning (_ ("ligature was started here"));
- // TODO: maybe better should stop ligature here rather than
- // ignoring the rest?
- }
- }
+ return new Spanner (get_property ("LigatureBracket"));
}
ENTER_DESCRIPTION(Ligature_bracket_engraver,
/* descr */ "Handles Ligature_requests by engraving Ligature brackets.",
/* creats*/ "LigatureBracket",
-/* acks */ "rest-interface",
+/* acks */ "ligature-head-interface rest-interface",
/* reads */ "",
/* write */ "");
}
ADD_INTERFACE(Ligature_bracket, "ligature-bracket-interface",
- "",
+ "A bracket indicating a ligature in the original edition",
"width thickness height");
virtual void process_music ();
virtual void stop_translation_timestep ();
-};
+private:
+ bool in_ligature;
+};
Note_heads_engraver::Note_heads_engraver()
{
+ in_ligature = 0;
}
bool
{
return note_req_l_arr_.size ();
}
+ else if (Span_req *req_ = dynamic_cast<Span_req*> (m))
+ {
+ if (scm_equal_p (req_->get_mus_property ("span-type"),
+ ly_str02scm ("abort")) == SCM_BOOL_T)
+ {
+ in_ligature = 0;
+ }
+ else if (scm_equal_p (req_->get_mus_property ("span-type"),
+ ly_str02scm ("ligature")) == SCM_BOOL_T)
+ {
+ in_ligature = (req_->get_span_dir () == START);
+ }
+ }
return false;
}
{
for (int i=0; i < note_req_l_arr_.size (); i++)
{
- Item *note_p = new Item (get_property ("NoteHead"));
-
+ Item *note_p =
+ new Item (get_property ((in_ligature) ? "LigatureHead" : "NoteHead"));
+
Music * req = note_req_l_arr_[i];
Duration dur = *unsmob_duration (req->get_mus_property ("duration"));
$$-> set_spot (THIS->here_input ());
$1-> set_spot (THIS->here_input ());
}
+ | E_LEFTSQUARE {
+ Span_req *l = new Span_req;
+ l->set_span_dir (START);
+ l->set_mus_property ("span-type", ly_str02scm ("ligature"));
+ l->set_spot (THIS->here_input ());
+
+ $$ = new Request_chord (SCM_EOL);
+ $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
+ $$->set_spot (THIS->here_input ());
+ }
+ | E_RIGHTSQUARE {
+ Span_req *l = new Span_req;
+ l->set_span_dir (STOP);
+ l->set_mus_property ("span-type", ly_str02scm ("ligature"));
+ l->set_spot (THIS->here_input ());
+
+ $$ = new Request_chord (SCM_EOL);
+ $$->set_mus_property ("elements", gh_cons (l->self_scm (), SCM_EOL));
+ $$->set_spot (THIS->here_input ());
+ }
| E_BACKSLASH {
$$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED));
$$->set_spot (THIS->here_input ());
b->set_mus_property ("span-type", ly_str02scm ("beam"));
$$ = b;
}
- | E_LEFTSQUARE {
- Span_req *b = new Span_req;
- b->set_span_dir (START);
- b->set_mus_property ("span-type", ly_str02scm ("ligature-bracket"));
- $$ = b;
- THIS->last_ligature_start_ = b->self_scm ();
- }
- | E_RIGHTSQUARE {
- Span_req *b = new Span_req;
- b->set_span_dir (STOP);
- b->set_mus_property ("span-type", ly_str02scm ("ligature-bracket"));
- $$ = b;
- }
| BREATHE {
$$ = new Breathing_sign_req;
}
%
brevis_wid# := 2 staff_space#;
-def draw_brevis(expr brevwid) =
+def draw_neo_brevis(expr brevwid) =
save beamheight, head_width;
save holeheight, stem_width;
save serif_size, serif_protrude;
enddef;
+def draw_neo_left_stemmed_head (expr wid) =
+ draw_neo_brevis(wid);
+
+ x6 = x7 = head_width - stem_width/2;
+ y6 = y5;
+ y7 = y5 - 2.25staff_space;
+ pickup pencircle scaled stem_width;
+ draw z6 .. z7;
+enddef;
+
+fet_beginchar("Left stemmed notehead", "lneo_mensural", "mensuralleftstemmedhead");
+ draw_neo_left_stemmed_head (brevis_wid#)
+fet_endchar;
+
%
% Some sources (eg Musix/OpusTeX think that the appendage should be on
% the left, some say right. Right wins democratically.
%
def draw_neo_longa (expr wid) =
- draw_brevis(wid);
+ draw_neo_brevis(wid);
save theta;
x7r = head_width;
fet_endchar;
fet_beginchar("Brevis notehead", "-1neo_mensural", "mensuralbrevishead")
- draw_brevis(brevis_wid#);
+ draw_neo_brevis(brevis_wid#);
fet_endchar;
def draw_neo_mensural_black_head (expr wid) =
brevis_wid# := 1 staff_space#;
-def draw_longa (expr wid) =
+def draw_brevis (expr wid) =
+ % TODO. For the moment, fall back to draw_neo_brevis.
+ draw_neo_brevis(wid);
+enddef;
+
+def draw_left_stemmed_head (expr wid) =
draw_brevis(wid);
save theta;
+ x6 = x7 = stem_width/2;
+ y6 = y5;
+ y7 = y5 - 2.25staff_space;
+ pickup pencircle scaled stem_width;
+ draw z6 .. z7;
+enddef;
+
+fet_beginchar("Left stemmed notehead", "lmensural", "mensuralleftstemmedhead");
+ draw_left_stemmed_head (brevis_wid#)
+fet_endchar;
+
+def draw_longa (expr wid) =
+ draw_brevis(wid);
+
x6 = x7 = head_width - stem_width/2;
y6 = y5;
y7 = y5 - 2.25staff_space;
--- /dev/null
+(use-modules
+ (ice-9 regex))
+
+(define (format-c-header c-h)
+ (regexp-substitute/global
+ #f ","
+ (regexp-substitute/global #f "(SCM|\\)|\\() *" c-h 'pre "" 'post)
+ 'pre " " 'post)
+ )
+
+(define (document-scheme-function name c-header doc-string)
+ (string-append
+ "@defun " (symbol->string name) " " (format-c-header c-header) "\n"
+ doc-string
+ "\n@end defun\n\n")
+ )
+
+(define all-scheme-functions
+ (hash-fold
+ (lambda (key val prior)
+ (cons (cons key val) prior)
+ )
+ '() (ly-get-all-function-documentation))
+ )
+
+(define (document-all-scheme-functions)
+ (let*
+ (
+
+ (fdocs (map (lambda (x)
+ (document-scheme-function (car x) (cadr x) (cddr x))
+ )
+ all-scheme-functions)
+ )
+ (sfdocs (sort fdocs string<?))
+ )
+
+ (apply string-append sfdocs)
+
+ ))
+
+
(meta . ((interfaces . (key-signature-interface font-interface break-aligned-interface))))
))
+ (Ligature
+ . (
+ (molecule-callback . ,Ligature_bracket::brew_molecule)
+ (meta . ((interfaces . (ligature-interface))))
+ ))
+
(LigatureBracket
. (
(width . 0.75)
(height . 0.5)
+ (ligature-primitive-callback . ,Note_head::brew_molecule)
(molecule-callback . ,Ligature_bracket::brew_molecule)
(meta . ((interfaces . (ligature-bracket-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 . mensural)
+ (meta . ((interfaces . (ligature-head-interface rhythmic-head-interface note-head-interface staff-symbol-referencer-interface))))
+ ))
+
(LyricHyphen
. (
(thickness . 1.0)
(meta . ((interfaces . (lyric-syllable-interface self-alignment-interface text-interface font-interface))))
))
+ (MensuralLigature
+ . (
+ (thickness . 1.4)
+ (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))))
+ ))
+
(Porrectus
. (
(style . mensural)
procedure is tried.")
(grob-property-description 'flag-style string? "turn stroke through stem on/off.")
(grob-property-description 'flag-width-function procedure? "Procedure that computes the width of a half-beam (a non-connecting beam.).")
+(grob-property-description 'flexa-width number? "width of a flexa shape in a ligature grob.")
(grob-property-description 'font-family symbol? "partial font
definition: music roman braces dynamic math ...")
(grob-property-description 'font-name string? "file name for the font to load.
'()
)
+(ly-add-interface
+ 'ligature-interface
+ "A ligature"
+ '()
+ )
+
(ly-add-interface
'mark-interface
"a rehearsal mark"