Bug 163520 - v-alignment mechanism makes strange/invalid assumptions regarding line spacing and its location
Summary: v-alignment mechanism makes strange/invalid assumptions regarding line spacin...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.8.2.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Textbox
  Show dependency treegraph
 
Reported: 2024-10-18 23:35 UTC by Eyal Rozenberg
Modified: 2024-10-18 23:36 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
vertical alignment illustrations (32.24 KB, application/vnd.oasis.opendocument.presentation)
2024-10-18 23:35 UTC, Eyal Rozenberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2024-10-18 23:35:58 UTC
Created attachment 197143 [details]
vertical alignment illustrations

Consider the attached presentation with several textboxes on each slide:

The first slide uses our Liberation Serif font.

You will note that the vertical alignment logic aligns-bottom so that the descender just touches the rectangle edge; but aligns-top so that there is quite some distance between the ascender height and the top of the rectangle. It seems this distance is about what you would find as the distance to a preceding line of text, whose baseline is the top edge of the rectangle; that is verified when we consider the two lines of ochre text I've overlaid over each of the top-aligned and bottom-aligned text.

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.

This is already problematic, in two ways:

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.

2. More importantly, even if we do assume line spacing - it cannot be assumed to be located above the single line! If we assume each single line has it, then surely, half of it must be above and half below. Or perhaps - the relative placement should depend on the v-alignment, i.e. if we start from the top, then v-space is below each line; if we start from the bottom - it is above; and if we're valigned to the middle, then again half above and half below.

-----

Ok, so far we talked about the first slide. Things seemed to make sense and I have an argument against the logic we're using. Now let's proceed to the next slide, where the font is Carlito, having somewhat different metrics. Here - nothing seems to make sense! The bottom-valigned text doesn't touch the bottom, the top-valigned doesn't agree with the above line starting at the top of the box, and I can't even guess what the middle v-alignment means exactly. The logic seems beyond scrutiny. Could it be that the heights are calculated based on metrics for another font? If not - what is it?


-----

No, why is all this an issue? Well, because every *** **** time I try to get text to be on the bottom, or the top, of a textbox - I can't quite get it there, and I need to either enter empty lines above or below, or play with faux-subscripting/super-scripting. And it's even worse for middle v-align, where the fact that the line is _not_ in the middle is even more apparent (the top and bottom enjoy some benefit of the doubt due to margins which are somewhat arbitrary). See also bug 163235 about middle v-alignment specifically.