+ if (allow_flexa
+ && to_boolean (primitive->get_property ("ligature-flexa")))
+ {
+ /*
+ flexa requested, check whether allowed:
+ - there should be a previous note
+ - both of the notes must be of brevis shape
+ (i.e. can't be maxima or flexa;
+ longa is forbidden as well - it's nonexistent anyway)
+ - no compulsory flexa for the next note,
+ i.e. it's not an ultimate descending breve
+ */
+ make_flexa = !at_beginning && prev_brevis_shape && duration_log > -2;
+ if (make_flexa && i == s - 2)
+ {
+ /*
+ check last condition: look ahead to next note
+ */
+ Grob_info next_info = primitives[i + 1];
+ Item *next_primitive = dynamic_cast<Item *> (next_info.grob ());
+ if (Rhythmic_head::duration_log (next_primitive) == -1)
+ {
+ /*
+ breve: check whether descending
+ */
+ int const next_pitch = unsmob_pitch
+ (next_info.event_cause ()->get_property ("pitch"))->steps ();
+ if (next_pitch < pitch)
+ /*
+ sorry, forbidden
+ */
+ make_flexa = false;
+ }
+ }
+ }
+