At the moment, the line breaking algorithm for paragraph tries to optimize one thing: Minimum length, i.e. miniumum number of lines and minimum length of text on last line. However, one often wants to optimize a different metric: Minimum number of lines, but most uniform distribution of words or characters over those lines. Thus, we would currently prefer: +-------------------------------------+ | The quick brown fox jumped over the | | lazy dog. | +-------------------------------------+ over: +---------------------------+ | The quick brown fox | | jumped over the lazy dog. | +---------------------------+ I would like to be able to format a paragraph to have the line breaking algorithm prefer the latter over the former. That would be another toggle-able property in paragraph styles within the ODT, if it's not already in there.
(In reply to Eyal Rozenberg from comment #0) Note that an improvement, falling short of complete optimization, is "pulling" words towards the line with the least length covered by words, greedily: +-------------------------------------+ | The quick brown fox jumped over the | | lazy dog. | +-------------------------------------+ => +-------------------------------------+ | The quick brown fox jumped over | | the lazy dog. | +-------------------------------------+ => +-------------------------------------+ | The quick brown fox jumped | | over the lazy dog. | +-------------------------------------+ and not continuing, because "jumped" would make it so that the second line has more than the first. Of course it is trickier with multiple lines which can pull words from previous as well as successive lines.
The illustrations indicate that you have a text box in mind. Otherwise, for ordinary pages a line break just happens at the end of the page. But the first example shows different width, and don't we break respectively? So please provide some STR.
(In reply to Heiko Tietze from comment #2) > The illustrations indicate that you have a text box in mind. Yes and no. This comes up for me in the context of working on a presentation, but I'm interested in _paragraphs_ within textboxes, not the whole textbox. > Otherwise, for ordinary pages a line break just happens at the end of > the page. I'm not sure I understand how that relates to this bug... > But the > first example shows different width, and don't we break respectively? So > please provide some STR. I don't understand the question; but - I'll attach a presentation to illustrate my point. Also, a clarification: While my textual examples involved justification, the bug is not about the justification, it's about the line breaking, i.e. it's just as relevant for Right, Left, or Center alignments.
Created attachment 195816 [details] Illustration of the request Look at the textboxes in the presentation. I would like to get the same line-breaking-points as the second textbox, but automatically, not using manual breaks. (Of course, as an option, not as the default.)
(In reply to Eyal Rozenberg from comment #4) > I would like to get the same line-breaking-points as the second textbox... Paragraph properties > Indent > After Text = 2cm This attribute is also available in the drawing style which makes switching from one to another easy. => INV
(In reply to Heiko Tietze from comment #5) > (In reply to Eyal Rozenberg from comment #4) > > I would like to get the same line-breaking-points as the second textbox... > Paragraph properties > Indent > After Text = 2cm That's not "automatic". If I then add or remove text, the lines will again not be broken to achieve a uniform distribution of line lengths.
(In reply to Eyal Rozenberg from comment #6) > (In reply to Heiko Tietze from comment #5) > > (In reply to Eyal Rozenberg from comment #4) > > > I would like to get the same line-breaking-points as the second textbox... > > Paragraph properties > Indent > After Text = 2cm > > That's not "automatic". If I then add or remove text, the lines will again > not be broken to achieve a uniform distribution of line lengths. Can you illustrate this? An indentation is automatic and will be applied to any text.
(In reply to Heiko Tietze from comment #7) > Can you illustrate this? An indentation is automatic and will be applied to > any text. I mean that as you type more words in a paragraph, the line breaking changes - including in previous lines - so that the lines are kept at a length which is as close to uniform as possible. Of course, for a given fixed line length limit (i.e. not when the textbox can stretch). So, suppose my line is 30 chars long, and I start typing. Here is some text animation for you... 123456789012345678901234567890 The 123456789012345678901234567890 The quick 123456789012345678901234567890 The quick brown fox 123456789012345678901234567890 The quick brown fox jumped here is where things diverge from the default line breaking strategy. The next work, currently, produces: 123456789012345678901234567890 The quick brown fox jumped over 123456789012345678901234567890 The quick brown fox jumped over the 123456789012345678901234567890 The quick brown fox jumped over the lazy but with the alternative line breaking strategy, this would happen: 123456789012345678901234567890 The quick brown fox jumped over 123456789012345678901234567890 The quick brown fox jumped over the 123456789012345678901234567890 The quick brown fox jumped over the lazy 123456789012345678901234567890 The quick brown fox jumped over the lazy dog See what I mean?
(In reply to Eyal Rozenberg from comment #8) > | 123456789012345678901234567890 | > | The quick brown fox jumped | > | over | (should become) > | 123456789012345678901234567890 | > | The quick brown | > | fox jumped over | (with virtual paragraph boundaries) Some kind of "optimal text distribution" regardless the text box width and the paragraph properties. This is certainly not covered by the file format and quite niche. There are plenty alternative workflows to achieve it (admittedly with some more steps). My take: => WF
No further input, => WF The use case is extremely niche, involves tremendous effort to implement, the solution offers no flexibility, and the alternative - insert line breaks - is simple and well-known.