https://bugs.documentfoundation.org/show_bug.cgi?id=163520
--- Comment #5 from Jonathan Clark <[email protected]> --- Responding with observations and subjective preferences. I do not know why Impress works the way it currently does, and I do not have an opinion about how the implementation should change, if at all. It's possible this was a design decision made for UX or interoperability reasons about which I'm unaware. (In reply to Eyal Rozenberg from comment #0) > Moreover, you'll note that the middle-aligned text does not actually have > its x character - the fundamental one for font metrics - cross the vertical > middle at its center. Even the capital-X doesn't cross the middle at its > center. IIANM, it seems that its the middle of the line+space-above vertical > segment that intersects the middle of the shape's height. Fonts do not provide such a centerline metric. The closest they provide is a strikeout height, but it is not meant for this purpose and I don't think it's safe to use. Using (ascent - descent) / 2 is the most reasonable available closed-form guess. (This is not what we do: see below.) One thing to keep in mind is, if your goal is to make this "look right", a closed-form solution will never be adequate. What "looks right" is when the optical weight of the text above the centerline is equal to the optical weight of the text below it. Correct-looking vertical placement depends on the content of the text. Even if font authors could provide a tuned metric for vertical centering, it would look just as wrong in many situations as what we currently do. > 1. It is not legitimate to assume that a single line of text has, or > requires, any inter-line spacing, at all. At least, this is not a legitimate > assumption in a textbox. I confirm that the vertical positioning of top- and middle-anchored text is based on line height, rather than just font ascent and descent. This is difficult to see with text metrics alone, but can be easily demonstrated by changing the line spacing in the shape style. When line spacing is single, we are vertically positioning text using (ascent - descent + line gap). These are all font metrics, but arguably we are not using them in an intuitive or visually appealing way. Our current approach results in text that appears to me to be positioned too low in general. Subjectively, I think the current approach looks reasonable for top-aligned multi-line text boxes. In this case, each line in the text box has the same amount of whitespace above it as the each of the following lines, which looks correct to me. However, for single-line, I would intuitively expect the line to be anchored at the ascent, not at the ascent+line gap as is the current behavior. It's possible to manually tweak vertical placement by manually changing the line spacing, but there's no way of doing this that is robust against font changes (or, worse, substitutions). Middle-anchored text also looks wrong to me in all cases. Intuitively, I would expect the white space above the ascent of the first line to equal the white space below the descent of the last line. That means, if there's an odd number of lines, the text should be vertically positioned at (ascent - descent) / 2 relative to the middle line, or at the midpoint of the line gap for an even number of lines. Instead, currently, we center based on the sum of the line heights. A two-line text box will be centered at the descent of the first line. This makes all vertically centered text boxes look lopsided to me. This is all just my subjective opinion about what looks good and what makes sense. Others may disagree. There may also be UX or interoperability concerns about which I'm unaware, so it's best if other developers comment on this too. -- You are receiving this mail because: You are the assignee for the bug.
