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 #315636: no space between barline and note with invisible key or time signature #7328

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

MarcSabatella
Copy link
Contributor

Resolves: https://musescore.org/en/node/315636

When code was added to better handle invisible key or time signatures
at the beginning of a score,
this inadvertently affected spacing between barline and first note
if there were invisible key or time signature changes later.
The spacing was never actually correct here -
it was controlled by the key or time signature margin -
but it more or less worked and scores depended on it.

The problem is that the changes made involved
setting the width of these invisible segments to 0
and skipping them.
Whereas previously, they got processed enough
to yield some space between the barline and first note.
The firx here is just to limit the effect of the previous change
so not all segments with all elements invisible,
but only those in system header measures,
or segments after the beginning of the measure.
Thus we continue to handle beginnings of scores and systems well,
and also courtesies at the end of measures.
But we revert to the previous behavior for key or time signatures
at the beginning of measures that are not headers.
Again, it wasn't ideal, but it basically worked,
nand now works again the same way.

I left TODO's in the code to indicate something
of what would need to happen to fix this "for real",
with the space controlled by barNoteDistance as the user expects,
rather than depending on the key or time signature margins.
A quick attempt to implement this led to problems
that convinced me to put it off until a larger scale rewrite
of the spacing algorithms as a whole.

Resolves: https://musescore.org/en/node/315636

When code was added to better handle invisible key or time signatures
at the beginning of a score,
this inadvertently affected spacing between barline and first note
if there were invisible key or time signature changes later.
The spacing was never actually *correct* here -
it was controlled by the key or time signature margin -
but it more or less worked and scores depended on it.

The problem is that the changes made involved
setitng the width of these invisible segments to 0
and skipping them.
Whereas previously, they got processed enough
to yield some space betwene the barline and first note.
The firx here is just to limit the effect of the previous change
so not *all* segments with all elements invisible,
but only those in system header measures,
or segments after the beginning of the measure.
Thus we continue to handle beginnings of scores and systems well,
and also courtesies at the end of measures.
But we revert to the previous behavior for key or time signatures
at the beginning of measures that are *not* headers.
Again, it wasn't ideal, but it basically worked,
nand now works again the same way.

I left TODO's in the code to indicate something
of what would need to happen to fix this "for real",
with the space controlled by barNoteDistance as the user expects,
rather than depending on the key or time signature margins.
A quick attempt to implement this led to problems
that convinced me to put it off until a larger scale rewrite
of the spacing algorithms as a whole.
@njvdberg
Copy link
Contributor

njvdberg commented Jan 26, 2021

With this PR there is an larger distance between the first note in a measure and the left barline:
after
This distance also depends whether it is preceded by a invisible key or time signature.
Without this PR this distance is more or less the same:
before
Is this an expected result of the PR?

@MarcSabatella
Copy link
Contributor Author

MarcSabatella commented Jan 26, 2021

Yes. See discussion on Telegram. My PR restores 3.5.2 behavior that people are already used to and have adjusted for where needed. The above clearly shows too little space after the barline in 3.6. It is barely sufficient in that example, but consider what happens if there is an accidental or second:

image

versus with my P (and same in 3.5.2):

image

It is true that there is slightly too much space in the case of the invisible time signature as compared to key signature, but that's inconsequential in comparison. And again it's the same in 3.5.2. That's because the space here is not barNoteDistance as it should be (but never has been), instead it's controlled by the margin settings for the key and time signatures respectively, which happen to differ slightly.

[ note: originally this had the wrong images, fixed now ]

@MarcSabatella
Copy link
Contributor Author

MarcSabatella commented Jan 26, 2021

Also, to be clear: the amount of space in 3.6 here might be similar between invisible key and time signatures, but it's definitely way less than it should be - less than what it would be with no key or time signature at all. Here is 3.6:

image

and here is my PR (same as 3.5.2, given same style settings):

image

As noted, it's not perfectly consistent because were aren't using barNoteDistance. but it's workable, and accommodates accidentals or seconds, which 3.6 does not.

@vpereverzev vpereverzev merged commit c8d326a into musescore:3.x Jan 27, 2021
igorkorsukov added a commit to igorkorsukov/MuseScore that referenced this pull request Feb 12, 2021
vpereverzev pushed a commit that referenced this pull request Feb 12, 2021
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