Allow centering symbols in measures and on notes

• May 25, 2019 - 23:54
Reported version
S5 - Suggestion

See discussion started at

Symbols need to be able to be centered on measures. This will allow items like measure repeats to be centered on a measure then adjusted on the Y axis to.

There needs to be a generic symbol control that will allow centering symbols above a measure (like measure repeats) or above the note like the symbol identified as "Divide measure tremolo by 3" for example as is the current default.

Allowing attaching symbols centered on a barline would also be nice, especially in the case of two-measure repeats.


As per my comments on the forum:

"The layout code is already there - we use it for repeat text. So to see what it might look like in action, just add a "Fine" to your score and then set its alignment to center. Of course, repeat text, being attached to the measure rather than a staff, can't be displayed over specific staves, but the point is, the layout code is there. So all we need is a special flag on the existing staff text that says, layout to the measure rather than to the segment. And we already have a flag "layoutToParentWidth", which is what we use for repeat text (and also frame text, which works similarly). If we made it so setting this flag on staff text caused it to layout to the measure (technically, its grandparent, not its parent), then that should do it.

So all that would be required for this to work is a two-line change (my favorite!) to TextBlock::layout(), and to add a way to create/read/write such an element."

The same code could also be adapted and used for symbols, BTW, but even without that, you would be able to get it (along with resizing) using the Special Characters palette within text.

To my thinking, though, I think there should be one common design for all of this, and I think the one I mentioned above will serve as a good model. The "layoutToParentWidth" flag is current what allows text to be centered in frames, it should be trivially simple to support that same flag for symbols (as well as staff text), and then they would do the right thing.

BTW, in case it isn't apparent, symbols can also already be centered in measures if attached to the repeat measure symbol.

I did consider that...and it's nice in theory, but here's a picture from a 3.1-rc score.

symbols not centered.PNG

I did move them both up a little to make them more visible, but notice that neither the repeat nor the tremolo dots are centered above their respective anchor points.

symbol on repeat.PNG

As you can see, symbols are consistently moved a bit to the right of center. The original reason I submitted this suggestion is because I've noticed the tremolo dots are consistently offset to the right, maybe left justified with the anchor - which seems to be the case in this picture.

Right. To be clear, there are two aspects to centering: getting the right alignment point, and then positioning relative to that alignment point.
We're doing the former, but then left-aligning to the repeat measure symbol rather than centering over it. But at least that's a predictable offset adjustment to make, much better than attempting to achieve centering by offsetting from the barline.

What I'm suggesting wouldn't actually change this, but would add a new flag that would do the true centering.

That's what I'm asking for. Centering on anything that is already centered in the measure would be fine, and if you could center on any note or rest also that would be better. I did add that it would be nice to be able to center symbols on a barline also. I would expect it to be the same code for horizontal placement as is used for Rehearsal marks.

It seems we're in agreement.