findNeumesToJustify method
Implementation
ChantNotationElement? findNeumesToJustify(List<Lyric> prevLyrics) {
toJustify = [];
ChantNotationElement? prev;
ChantNotationElement curr;
ChantNotationElement? next;
ChantNotationElement? nextOrCurr;
int lastIndex = notationsStartIndex + numNotationsOnLine;
for (int i = notationsStartIndex; i < lastIndex; i++) {
prev = nextOrCurr;
curr = score.notations[i];
next = (curr is Accidental && i + 1 < score.notations.length)
? score.notations[i + 1]
: null;
if (next != null) i++;
nextOrCurr = next ?? curr;
final hasLyrics = nextOrCurr.hasLyrics;
if (prev == null) continue;
if (extraTextOnlyIndex != null &&
i >= extraTextOnlyIndex! &&
curr is TextOnly) {
continue;
}
LyricArray.mergeIn(prevLyrics, prev.lyrics);
if (prev.keepWithNext == true) continue;
if (curr is! Divider &&
prevLyrics.isNotEmpty &&
prevLyrics[0].allowsConnector &&
hasLyrics) {
continue;
}
if (nextOrCurr is ChantLineBreak) continue;
if (nextOrCurr == custos && !hasLyrics) continue;
if (i == 0 && score.useDropCap && hasLyrics) continue;
toJustify.add(curr);
}
if (nextOrCurr != null) LyricArray.mergeIn(prevLyrics, nextOrCurr.lyrics);
return nextOrCurr;
}