#include "output-def.hh"
#include "paper-column.hh"
+#include "translator.icc"
+
/*
* This class implements the notation specific aspects of Vaticana
* style ligatures for Gregorian chant notation.
{
private:
+ static bool
+ need_extra_horizontal_space (int prev_prefix_set, int prefix_set,
+ int context_info, int delta_pitch);
bool is_stacked_head (int prefix_set,
int context_info);
Real align_heads (Array<Grob_info> primitives,
* added at most once between to heads.
*/
bool
-need_extra_space (int prev_prefix_set, int prefix_set,
- int context_info, int delta_pitch)
+Vaticana_ligature_engraver::need_extra_horizontal_space (int prev_prefix_set, int prefix_set,
+ int context_info, int delta_pitch)
{
if (prev_prefix_set & VIRGA)
/*
* The paper column where we put the whole ligature into.
*/
Paper_column *column
- = dynamic_cast<Item *> (primitives[0].grob_)->get_column ();
+ = dynamic_cast<Item *> (primitives[0].grob ())->get_column ();
Real join_thickness
= thickness * column->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
int prev_prefix_set = 0;
for (int i = 0; i < primitives.size (); i++)
{
- Item *primitive = dynamic_cast<Item *> (primitives[i].grob_);
+ Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
int prefix_set
= scm_to_int (primitive->get_property ("prefix-set"));
int context_info
{
SCM delta_pitch_scm = prev_primitive->get_property ("delta-pitch");
if (delta_pitch_scm != SCM_EOL)
- {
- delta_pitch = scm_to_int (delta_pitch_scm);
- }
+ delta_pitch = scm_to_int (delta_pitch_scm);
else
{
primitive->programming_error ("Vaticana_ligature:"
* Save the head's final x-offset.
*/
primitive->set_property ("x-offset",
- scm_make_real (x_offset));
+ scm_from_double (x_offset));
/*
* If the head is the 2nd head of a pes or flexa (but not a
*/
}
- if (need_extra_space (prev_prefix_set, prefix_set,
- context_info, delta_pitch))
+ if (need_extra_horizontal_space (prev_prefix_set, prefix_set,
+ context_info, delta_pitch))
ligature_width += extra_space;
/*
String prev_glyph_name = "";
for (int i = 0; i < primitives.size (); i++)
{
- Item *primitive = dynamic_cast<Item *> (primitives[i].grob_);
+ Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
int delta_pitch;
SCM delta_pitch_scm = primitive->get_property ("delta-pitch");
if (delta_pitch_scm != SCM_EOL)
- {
- delta_pitch = scm_to_int (delta_pitch_scm);
- }
+ delta_pitch = scm_to_int (delta_pitch_scm);
else
{
primitive->programming_error ("Vaticana_ligature:"
{
context_info |= STACKED_HEAD;
primitive->set_property ("context-info",
- scm_int2num (context_info));
+ scm_from_int (context_info));
}
/*
if (! (prev_context_info & FLEXA_RIGHT))
/* correct head of previous primitive */
if (prev_delta_pitch > 1)
- prev_glyph_name = "svaticana.epiphonus";
+ {
+ prev_glyph_name = "svaticana.epiphonus";
+ glyph_name = "svaticana.plica";
+ }
else
- prev_glyph_name = "svaticana.vepiphonus";
- glyph_name = "svaticana.plica";
+ {
+ prev_glyph_name = "svaticana.vepiphonus";
+ glyph_name = "svaticana.vplica";
+ }
}
- else // (prev_delta_pitch <= 0)
+ else if (prev_delta_pitch < 0)
{
// cephalicus
if (! (prev_context_info & FLEXA_RIGHT))
prev_primitive->set_property ("add-cauda",
ly_bool2scm (false));
}
- glyph_name = "svaticana.reverse.plica";
+ if (prev_delta_pitch < - 1)
+ {
+ glyph_name = "svaticana.reverse.plica";
+ }
+ else
+ {
+ glyph_name = "svaticana.reverse.vplica";
+ }
+ }
+ else // (prev_delta_pitch == 0)
+ {
+ primitive->programming_error ("Vaticana_ligature:"
+ "deminutum head must have different "
+ "pitch -> ignoring grob");
}
else if (prefix_set & (CAVUM | LINEA))
if ((prefix_set & CAVUM) && (prefix_set & LINEA))
check_for_prefix_loss (prev_primitive);
prev_glyph_name = "flexa";
prev_primitive->set_property ("flexa-height",
- scm_int2num (prev_delta_pitch));
+ scm_from_int (prev_delta_pitch));
prev_primitive->set_property ("flexa-width",
- scm_make_real (flexa_width));
+ scm_from_double (flexa_width));
bool add_cauda = !(prev_prefix_set && PES_OR_FLEXA);
prev_primitive->set_property ("add-cauda",
ly_bool2scm (add_cauda));
check_for_prefix_loss (primitive);
glyph_name = "";
primitive->set_property ("flexa-width",
- scm_make_real (flexa_width));
+ scm_from_double (flexa_width));
}
/*
* ligature grob's value for thickness to each ligature head (even
* if not all of them need to know).
*/
- primitive->set_property ("thickness", scm_make_real (thickness));
+ primitive->set_property ("thickness", scm_from_double (thickness));
prev_primitive = primitive;
prev_prefix_set = prefix_set;
#if 0 // experimental code to collapse spacing after ligature
/* TODO: set to max (old/new spacing-increment), since other
voices/staves also may want to set this property. */
- Item *first_primitive = dynamic_cast<Item *> (primitives[0].grob_);
+ Item *first_primitive = dynamic_cast<Item *> (primitives[0].grob ());
Paper_column *paper_column = first_primitive->get_column ();
paper_column->warning (_f ("Vaticana_ligature_engraver: "
"setting `spacing-increment = %f': ptr =%ul",
ligature_width, paper_column));
paper_column->
- set_property ("forced-spacing", scm_make_real (ligature_width));
+ set_property ("forced-spacing", scm_from_double (ligature_width));
#endif
}
+ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, rest);
+ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, note_head);
ADD_TRANSLATOR (Vaticana_ligature_engraver,
- /* descr */ "Handles ligatures by glueing special ligature heads together.",
- /* creats*/ "VaticanaLigature",
- /* accepts */ "ligature-event",
- /* acks */ "note-head-interface rest-interface",
- /* reads */ "",
+ /* doc */ "Handles ligatures by glueing special ligature heads together.",
+ /* create */ "VaticanaLigature",
+ /* accept */ "ligature-event",
+ /* read */ "",
/* write */ "");