Bug 156942 - "Fit width to text" shouldn't default to "extend width to fit whole paragraph on a single line"
Summary: "Fit width to text" shouldn't default to "extend width to fit whole paragraph...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha1+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevEval
Depends on:
Blocks: Autofit
  Show dependency treegraph
 
Reported: 2023-08-26 21:51 UTC by Eyal Rozenberg
Modified: 2023-09-08 06:38 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2023-08-26 21:51:49 UTC
The textbox Position and Size dialog, Position and Size tab has a "Fit width to text" option. What it actually does is increase or decrease the textbox width so that the widest paragraph fully fits on a _single line_.

While this is a useful feature, there is another way to "fit width", at least when "Fit height" is disabled, which is: set the width so that the textbox text fits in exactly the number of lines which fill the textbox horizontally without exceeding its bounds.

Thus, for example,

*---------------------*
| I like textboxes in |
| Impress & Draw.     |
|                     |
*---------------------*

(with no paragraph breaks inside the textbox) becomes

*-----------------*
| I like          |
| textboxes in    |
| Impress & Draw. |
*-----------------*

no change to the height, decrease to the width to fill the vertical space for the third line.

I claim the fact that this is not the default behavior is a bug. Why? Because:

1. The current behavior is very often undesirable: If you have a long stretch of text, it will just extend beyond the boundaries of the slide and your window.
2. By reducing the textbox height to one line's worth, or alternatively, increasing the margins to only fit one line - one can get the same effect of the existing behavior with this behavior.

So, if you ask me - we should just switch the behavior. Alternatively, we could have the "fit width" option have three states: None, fit to single line, fit to box height (not necessarily with these names).

--- 

Caveat: If this were to come to pass, the semantics of "Fit width" together with "Fit height" would have to be reconsidered carefully. Although TBH, their combination is kind of a mess today.
Comment 1 Heiko Tietze 2023-08-28 09:13:21 UTC
"Fit width to text" expands or shrinks the text box depending on the widest line. 

*---------------------*
| I like              |
| textboxes in        |
| Impress & Draw.     |
*---------------------*
                 <====
*--------*
| I lik  |
| textbox|
| es.    |
| in     |     
| Impress|
| & Draw.|
*--------*
           ======>

IMO easy to understand and well working - no need to change.

What you ask for is to change the content of the text box. Could be another line wrapping or the text size. Correct?
Comment 2 Eyal Rozenberg 2023-08-28 09:31:43 UTC
(In reply to Heiko Tietze from comment #1)
> IMO easy to understand 

is it? You just said that:

> "Fit width to text" expands or shrinks the text box depending on the widest
> line. 

which is not what it does.
Comment 3 Heiko Tietze 2023-08-29 08:44:40 UTC
(In reply to Heiko Tietze from comment #1)
> What you ask for is to change the content of the text box. Could be another
> line wrapping or the text size. 

Correct?
Comment 4 Eyal Rozenberg 2023-08-29 19:21:41 UTC
(In reply to Heiko Tietze from comment #3)
> > What you ask for is to change the content of the text box. Could be another
> > line wrapping or the text size. 
> 
> Correct?

No, I'm not asking for a change in the content of the text box. The only question is how wide to make the text box. 

Options are:

1. Same as what the user set it to.
2. The minimum possible width at which the content fits inside the box (with paragraphs possibly laid out on multiple lines.
3. The minimum possible width at which each paragraph in the content fits onto a single line.

As we increase or decrease the width, paragraphs are laid out on more or less lines; that does not mean the content has changed.

It is important to note that there are no "lines" in the textbox content. There are _pararagraphs_; and there may be line _breaks_, but not lines. (And this is why the description of functionality in comment #1 is not valid - it presupposes there being lines of known width which need accommodating.)
Comment 5 Heiko Tietze 2023-09-08 06:38:19 UTC
We discussed the topic in the design meeting.

The request is not to change the change the actual "Fit width to text" function, which is discussed in bug 156939, but to introduce optional line breaking, so that the paragraph fits to the chosen box height. If the option would be enabled, line break tries to fill the height, accepting white-space at the right/left side.

Arranging text in textboxes is an extremely common activity with Impress. Also, with the current behavior being unwieldy, using this functionality couldn't be common.

It's not a common functionality - and needs to be available in ODF.

(The summary should reflect the request to introduce a different line break algorithm.)