Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #36366: parse verse number, left align to syllable #1391

Merged
merged 2 commits into from
Oct 22, 2014

Conversation

MarcSabatella
Copy link
Contributor

As discussed in issue and in #1322, it is desirable to move away from separate Verse Number elements and toward a scheme where we automatically process leading verse numbers in lyric syllables. This PR implements such a scheme. If a lyric of the form

digits (optional separators) word

then the digits are taken to be a verse number, and the lyric is left aligned at the start of the word. A lyric consisting of digits only is not affected, so you can use numbers as lyrics with no problems.

I also elected to address http://musescore.org/en/node/24856 - ignoring leading punctuation - since it was easy to deal with both leading digitas and leading punctuation at the same time. Leading punctuation is ignored when positioning lyrics just as leading digits are, but the syllable is still centered.

I also fixed an issue where if you explicitly set the lyric style to left aligned, bad things happened with melisma. Again, I was modifying this code anyhow, this fix came for free.

@MarcSabatella
Copy link
Contributor Author

Rebasing lost the old line comments, but for the record, I added comments (in the code) about the regular expression, also simplified the code a little.

// find:
// 1) string of numbers and non-word characters at start of syllable
// 2) at least one other character (indicating start of actual lyric)
QRegExp leadingPattern("(^[\\d\\W]+)([^\\d\\W]+)");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarcSabatella
Copy link
Contributor Author

Same story wioth the rebase - maybe there is a better way? - but anyhow, I updated to use QRegularExpression.

So as should be clear from the comments in the issue, this solution is not perfect (nor do I expect any automatic solution could be). Someone might want to fine tune more from what I have.

We could also experiment with taking the pattern matching, but use it to actually split the lyric into a main lyric and a separate verse number element. We'd still need to make the verse number elements lay out correctly and work correctly with respect to linked parts, but it would be an easy way to enter verse numbers.

FWIW, I did try this, essentially just moving my parsing code from layout1() to endEdit(), actually splitting the lyric into two parts and copying the first part to _verseNumber while setting the actual lyric to the second part. It basically works just fine - well, as well as the verse number code worked before, anyhow. It's just a slightly simpler way of creating the verse elements. We'd still need to work oput the layout and linking issues. And my assumption is that this is what we are trying to avoid dealing with.

wschweer added a commit that referenced this pull request Oct 22, 2014
fix #36366: parse verse number, left align to syllable
@wschweer wschweer merged commit da6215a into musescore:master Oct 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants