Bug 150670 - [ENHANCEMENT] Better justification
Summary: [ENHANCEMENT] Better justification
Status: RESOLVED DUPLICATE of bug 38159
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.4.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks: Font-Rendering
  Show dependency treegraph
 
Reported: 2022-08-29 14:21 UTC by ajlittoz
Modified: 2022-08-30 06:31 UTC (History)
3 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 ajlittoz 2022-08-29 14:21:29 UTC
This is a follow on to https://ask.libreoffice.org/t/justification-spacing-issues/80948

In this question, OP complains about "excessive" word spacing. Read "excessive" as "professional typographers can provide a better look with narrower spaces and an extra word at end".

The complaint is related to the justification algorithm. Here is what I understand about it:

- justification is done on a line by line basis
- contents for a line is collected (line is initially empty)
   + add word to line and add its width to current total width
   + add spaces and add their font-defined width to total width
   + if new word would overflow allowed paragraph width, stop
   + final step: expand evenly spaces to fit paragraph width

Of course, last "word" may be a portion of one because of hyphenation.

It happens quite frequently that, even with hyphenation, spaces are dramatically expanded, resulting in an ugly-looking line. This may be caused by next word being really long, as is the case with URL for instance. Or in tables and multi-column context, even words with "moderate" length can cause the issue because of the narrow width of the column.

My suggestion is to modify the final expansion step.

- after computing the expansion factor, check it against an "acceptable" upper limit, e.g. ×2 standard space
- if space ends up too large, tentatively get next word (or portion of it), and see how spaces should be _shrinked_ to accept it into the line
- check the shrink factor against an acceptable lower limit, e.g. ×0.5 standard space (may be too small to be visually nice, so perhaps ×0.75?)
- if shrink factor is below the limit, fall back to present justification.

These limits should be controlled by user, either as new parameters in Aligment or Text Flow tabs in paragraph style, or (to avoid changing the way styles are presently saved) as parameters in Tools>Options advanced configuration.
Comment 1 V Stuart Foote 2022-08-30 04:48:40 UTC
Reasonable and seems less comprehensive than suggestions in bug 38159, but I guess could be exactly the same effort and this is simply a dupe.

NTL, +1
Comment 2 Heiko Tietze 2022-08-30 06:31:49 UTC
Reminds me on the lately added word length limit for hyphenation in bug 149248 (implemented by László).

Unfortunately (or luckily) we are bound to common rules so text rendered in LibreOffice looks pixel-perfect in other applications. But I can imagine a solution with auto character scaling, as requested in bug 38159, and "expand evenly spaces to fit paragraph width" is actually a duplicate.

*** This bug has been marked as a duplicate of bug 38159 ***