Text alignment in vertical frames: allow specifying text reference point (e.g. baseline) and frame reference point (e.g. bottom) separately

• Aug 27, 2022 - 16:32
Reported version
S5 - Suggestion

Issue #306872: "Align baseline of text to reference point" in vertical frame is broken, and the older related issues linked in its comments, illustrate that the vertical alignment options for text effectively bundle two settings together, often with counterintuitive results:
- The reference point in the text object (e.g. top of bounding box, baseline of first line, bottom of bounding box)
- The reference point in the enclosing vertical frame (top edge, center line, bottom edge)

Current MuseScore 3.6.2 (I’m using it on Windows 10) offers four options for vertical text alignment, most of which behave counterintuitively. The “top” and “bottom” options use the text’s bounding box, making multiple items (like lyricist and composer) look uneven if some have caps/ascenders (top) or descenders (bottom) and others don’t. (See the screencap of a score header below, under “Examples”.) The “baseline” option puts the text items’ baselines (of the first line if there are line breaks) at the center of the frame (thus the bug report that it breaks positioning for lyricist and composer, compared to “bottom”).

(Nothing special about score headers or lyricist or composer items. The same behaviors occur in other vertical frames with ordinary text items.)

-------- Proposed improvement: offer and gently expose more options --------

Replace the current four vertical alignment options…
Text vertical alignment current UI.png
…with three or four “most useful” default combinations, a (possibly hidden) “custom” alignment display-and-button, and a “More/Less” toggle:
Text vertical alignment mockup 1 default bundles compact.png

In this mockup, the initial options (perhaps customizable in Preferences) are
- “Stable top of text” (analogous to the baseline, insensitive to whether the particular text item has caps, ascenders, etc. on the first line) aligned with top of frame (e.g. consistently aligned titles and part labels)
- Center of text (bounding box?) aligned with centerline of frame
- Baseline of text (bottom line if multiline) aligned with bottom of frame (e.g. lyricist and composer)
- Bottom of bounding box aligned with bottom of frame (current “bottom” behavior)

Choosing “More” reveals separate controls for the two reference points:
Text vertical alignment mockup 2 showing More.png

On the text item:
- “Stable top of text” (caps height, if practical on all platforms, would let occasional diacritics above capital letters rise above the “regular text height”; that would be reasonable behavior. Typographic ascent would be another reasonable choice.)
- Baseline (of top line if multiline)
- Baseline (of bottom line if multiline)
- Top of bounding box
- Center of bounding box
- Bottom of bounding box

On the vertical frame:
- top edge
- centerline
- bottom edge

Changing either or both of these from one of the default buttons above reveals and highlights the “custom” button with the actual settings:
Text vertical alignment mockup 3 changed showing custom button.png
If the settings are changed to once again correspond to one of the default combinations, the “custom” button stays visible (but not highlighted) with the last non-default combination used, regardless of the More/Less toggle.

-------- Examples of use --------

Current MuseScore text item alignment in a score header:
vert alignment demo 1 actual with bounding boxes.png

Using some of the proposed options, with “top” text items aligned using caps height:
vert alignment demo 1 desired caps height cap accents above.png

Alternative implementation, using typographic ascent:
vert alignment demo 1 desired2 typographic ascent including accented caps.png