+ /*
+ * Execptional rule for porrectus:
+ *
+ * If the current head is preceded by a \flexa and succeded by a
+ * \pes (e.g. "a \flexa g \pes a"), then join the current head and
+ * the previous head into a single curved flexa shape.
+ */
+ if ((context_info & FLEXA_RIGHT) && (context_info & PES_LOWER))
+ {
+ check_for_prefix_loss (prev_primitive);
+ prev_glyph_name = "flexa";
+ prev_primitive->set_property ("flexa-height",
+ scm_from_int (prev_delta_pitch));
+ prev_primitive->set_property ("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_from_double (flexa_width));
+ }
+
+ /*
+ * Exceptional rule for pes:
+ *
+ * If this head is stacked on the previous one due to a \pes, then
+ * set the glyph of the previous head to that for this special
+ * case, thereby avoiding potential vertical collision with the
+ * current head.
+ */
+ if (prefix_set & PES_OR_FLEXA)
+ {
+ if ((context_info & PES_UPPER) && (context_info & STACKED_HEAD))
+ {
+ if (prev_glyph_name == "vaticana.punctum")
+ if (prev_delta_pitch > 1)
+ prev_glyph_name = "vaticana.lpes";
+ else
+ prev_glyph_name = "vaticana.vlpes";
+ }
+ }
+
+ if (prev_primitive)
+ prev_primitive->set_property ("glyph-name",
+ ly_string2scm (prev_glyph_name));
+
+ /*
+ * In the backend, flexa shapes and joins need to know about line
+ * thickness. Hence, for simplicity, let's distribute the
+ * ligature grob's value for thickness to each ligature head (even
+ * if not all of them need to know).
+ */
+ primitive->set_property ("thickness", scm_from_double (thickness));
+
+ prev_primitive = primitive;
+ prev_prefix_set = prefix_set;
+ prev_context_info = context_info;
+ prev_delta_pitch = delta_pitch;
+ prev_glyph_name = glyph_name;
+ }
+
+ prev_primitive->set_property ("glyph-name",
+ ly_string2scm (prev_glyph_name));
+
+ align_heads (primitives, flexa_width, thickness);
+
+ // append all dots to paper column of ligature's last head
+ add_mora_column (prev_primitive->get_column ());
+
+#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 ());
+ 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_from_double (ligature_width));
+#endif