Measure Number Offset Value Changes Everytime Opening the File

• Jan 19, 2021 - 09:06
Reported version
3.6
Priority
P1 - High
Type
Functional
Frequency
Once
Severity
S3 - Major
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project

Description:

If the measure number offset is modified by user, MuseScore automatically change the offset value each time reopening the score file.
more infos here: Measure Number Offset Value Changes Everytime Opening the File

Steps to reproduce:

  1. Create a new score.
  2. Select a measure number text and modify its offset value (either X or Y or both).
  3. Save the file.
  4. Reopen the file. Check the measure number offset value we've modified in Step 2.

Expected behavior: The offset value should be the same with the value when we save the file.
Actual behavior: The offset value changes each time we reopen the score file.

Version number: MuseScore 3.6.0.485471459, revision: 269baf7
Operating system: Windows 10 (10.0), Arch.: x86_64

Here is a test file that I've modified both X and Y value of the measure number offset at Measure 18 to 5sp. But both value change to 2.86sp when reopening it. The values will also change again if we save the file and reopen it.
measure_number_offset_change.mscz

I've also checked the nightly build MuseScore version (64-bit): 3.6.0.495159827, revision: c094067, and the issue can be reproduced.


Comments

My score seems to save to left alignment for the measure numbers which makes the numbers (especially double digit ones) look too far to the right. Temporary fix is to make sure the styling is X: 0.00 and Y: 2.00 with the center text alignment option selected (not the left align that seems to be the broken default).

Status PR created fixed

Fixed in branch 3.x, commit 3203f5b45b

_fix #315781: measure number offset changes on reload

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

Measure numbers were formerly scaled with spatium, but now they are not.
The offset should still be in sp rather than mm,
so a new fucntionoffsetIsSpatiumDependent() was introduced,
analogous to sizeIsSpatiumDependent(), to allow measure numbers
to have size not scale with spatium but keep the scaling of offset.
However, the function depended on checking the parent of the element,
on the idea that measure numebrs are attached to measures,
whereas other non-spatium-dependent elements like title text are not.
Unfortunately, during score read, parent is not set yet,
so this check was failing.

Instead, this commit checks the ON_STAFF element flag,
which really tells us the same basic thing.
So, for measure numbers, ON_STAFF is true,
so even though sizeIsSpatiumDependent is false,
offsetIsSpatiumDependent will return true.
For title text and other elements for which sizeIsSPatiumDependent,
ON_STAFF is false, so the offset will continue to not scale.
This is the correct solution going forward as well
should any other elements need to have size and offset scaling
managed differently._

Fix version
3.6.1