Text on Prebend is wrongly placed

• Mar 17, 2019 - 10:34
Reported version
3.0
Type
Functional
Frequency
Few
Severity
S3 - Major
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project

Reported at #93191: Bend tool: notation and layout problems. This bug was introduced in musescore 3 and is present in the nightly 1d5ae8a. The text indication is badly placed with the prebend.
In MuseScore 3:
prebend_ms3.png
In MuseScore 2:
prebend_ms2.png

Related to #286108: [EPIC] Bends issues.


Comments

Now that's funny. The screenshot above was taken with the MuseScore screenshot tool (Print mode) and it shows a correct rendering of the pre-bend text (the position of the bend arrow in notation is too low for the note, and that's another -known- issue). I took an Alt-PrtScr screenshot of the window where the pre-bend is rendered wrongly:
Clipboard 1.jpg

Regression No Yes

OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit): 3.2.0.7613, revision: b64f852

This is still not fixed in the latest nightly.

  1. Apply a bend to a note.
  2. Open bend properties and click on "Prebend";
  3. Click OK.

Expected result: The prebend text should be just above the bend. e.g.
prebend_ms2.png
Actual result: The prebend text is way too far above the prebend. This is the case for any bend which has a prebend in it (i.e. where the first node is greater than 0). e.g.
prebend_ms3.png

Attachment Size
prebend_ms3.png 1.33 KB

The hint in https://musescore.org/en/node/286188#comment-904341 helps confirm what I think is going on here: we are attempting to scale the positioning of the text according to screen resolution, and that calculation isn't working right in all cases.

I am pretty sure the problem stems from this change, which no doubt did fix something for some cases: https://github.com/musescore/MuseScore/commit/d3353c4e4a8f35a10e98c29bd…

The problem is I don't really understand enough about how these pixel ratios and paint devices and so forth work to have any confidence about a fix. I can, through trial and error, adjust the calculation to work on my system with my particular screen resolution, but I'd have little faith it would work on all systems.

If someone who "gets" this better wants to take a look, it's the values of textWidth and textHeight in Bend::draw() that are off - way too big, on my system, when drawing on screen (but as mentioned, the screenshot tool sees things differently). Some sort of scaling according to MScore::pixelRatio, DPI, and/or SPATIUM 20 is probably called for.

Or maybe we don't try to do this offset ourselves instead position more like we do in the case a few lines below (non-prebend) where we let Qt handle the alignment (e.g., using AlignHCenter, AlignBottom)? I'm sure there is probably a reason it's done differently for prebend, but when I tried using the same calculation as for the normal case, it worked fine. And it has the advantage of being more predictable - it's unlikely to do different things on different systems depending on OS or screen resolution.

Status PR created fixed

Fixed in branch master, commit ad7bd1a3d2

_fix #286188: text on prebend misplaced

For some reason, we place the text on prebends differently than others,
and while the code worked in 2.3.2, it no longer does,
and I think it has to do with changes made for screen scaling.
Fixing the screen scaling is possible but hard to test
and hard to guarantee it will be correct on all systems.
So instead, I am fixing this by changing the code that places the text
to use the same approach as other bends:
setitng the alignment to bottom center
rather than try to align ourselves using font metrics._

Fix version
3.3.0