Bug 162109 - Unexpected, wrong hanging punctuation/letter with JustifyLinesWithShrinking (no space shrinking in the last paragraph line, if needed)
Summary: Unexpected, wrong hanging punctuation/letter with JustifyLinesWithShrinking (...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0 target:24.8.1 target:24...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Paragraph 162220
  Show dependency treegraph
 
Reported: 2024-07-19 17:54 UTC by Mike Kaganski
Modified: 2024-11-01 16:09 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Hanging question mark (2.18 KB, application/vnd.oasis.opendocument.text)
2024-07-19 17:54 UTC, Mike Kaganski
Details
hanging letter (29.42 KB, application/vnd.oasis.opendocument.text-flat-xml)
2024-07-20 09:31 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-07-19 17:54:39 UTC
Created attachment 195402 [details]
Hanging question mark

Open the attachment using 24.2 or 24.8. The trailing question mark is shown outside of the text body area, "hanging" on the right margin. It is not an expected behavior; there was no proper hanging punctuation support implemented in LO yet, and this only happens at the end of a justified paragraph, not in the middle.

It works correctly in 7.6.

The file has JustifyLinesWithShrinking compatibility setting. Most likely related to bug 119908.

Ref.: https://ask.libreoffice.org/t/disable-hanging-punctuation/108353
Comment 1 Aron Budea 2024-07-20 01:47:06 UTC
Reproducible in LO 24.8.0.1.0+ (75f774ecda25b5d45ac6c19f293cc79b62c6914d) / Linux.

This ended up in its current state in two steps. First both lines started hanging (ie. ending outside right margin), with the following commit:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=7d08767b890e723cd502b1c61d250924f695eb98
author		László Németh <nemeth@numbertext.org>	2023-10-16 19:39:30 +0200
committer	László Németh <nemeth@numbertext.org>	2023-10-17 10:37:23 +0200

"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Then the first line stopped hanging, and only the ending punctuation in the second line is hanging since the commit below:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=17eaebee279772b6062ae3448012133897fc71bb
author		László Németh <nemeth@numbertext.org>	2023-11-15 23:31:12 +0100
committer	László Németh <nemeth@numbertext.org>	2023-11-16 16:21:06 +0100

"tdf#119908 sw smart justify: fix justification by shrinking"
Comment 2 László Németh 2024-07-20 09:31:59 UTC
Created attachment 195404 [details]
hanging letter
Comment 3 László Németh 2024-07-20 09:34:59 UTC
It seems, it is a problem with letters, not only punctuation, too.

@Mike, Áron: thanks for the bug report and test document!
Comment 4 Mike Kaganski 2024-07-27 06:54:33 UTC
*** Bug 162220 has been marked as a duplicate of this bug. ***
Comment 5 OldCoder 2024-07-30 19:29:19 UTC
There is a work-around for this bug; or, at least for bug 162220, which has been marked as a duplicate of this one.

The work-around is as follows. Is it possible to do this as a simple patch? I.e.: to set a minimum character spacing for all fonts. If so, I'll apply the patch to LibreOffice 24 in my Linux distro and other distro maintainers may find it useful as well.

Highlight text -> Format -> Character -> Position -> Character spacing -> Set to 0.1 [or any small positive value]
Comment 6 László Németh 2024-08-21 21:23:53 UTC
Proposed fix: https://gerrit.libreoffice.org/c/core/+/172228
Comment 7 László Németh 2024-08-21 21:31:45 UTC
The problem was the missing shrinking of the last paragraph line. A working workaround is for fixing the bad paragraphs: set the "Last line:" to "Justified" on Alignment pane of paragraph formatting.
Comment 8 Commit Notification 2024-08-22 07:15:40 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6b857398a59d16308d6185d01e003e401439f060

tdf#162109 sw smart justify: fix overhanging last line

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 László Németh 2024-08-22 07:18:49 UTC
@Mike and all: thanks for the bug report and feedback!
Comment 10 OldCoder 2024-08-22 22:52:05 UTC
I've built 24.8.0.1 with the patch and have loaded the test file I submitted in the duplicate bug. The issue remains even if one clears direct formatting and then reformats. However, it seems to disappear if one copies the text involved to a new document. So, if it's a useful data point, the patch seems to work for that series.
Comment 11 Commit Notification 2024-08-23 09:56:07 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/e679e3b194901ebb52738be32f20148e4627d4e9

tdf#162109 sw smart justify: fix overhanging last line

It will be available in 24.8.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2024-08-23 09:56:10 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/82d46a18cd9ec8c5027785b6d8303c4a0ce4e34f

tdf#162109 sw smart justify: fix overhanging last line

It will be available in 24.2.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 László Németh 2024-08-25 11:28:29 UTC
(In reply to OldCoder from comment #10)
> I've built 24.8.0.1 with the patch and have loaded the test file I submitted
> in the duplicate bug. The issue remains even if one clears direct formatting
> and then reformats. However, it seems to disappear if one copies the text
> involved to a new document. So, if it's a useful data point, the patch seems
> to work for that series.

I've reopened the bug, because it's really not a duplicate. Many thanks for the quick testing and feedback!
Comment 14 Commit Notification 2024-08-31 14:20:22 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1a87cd290282ea723c5d1a0d80c958b705b9d7ec

tdf#162109 tdf#162220 sw smart justify: add unit tests

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2024-09-03 06:32:49 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/5bf29163c0242b2d113d1d6019ed83f41299c0e4

tdf#162109 tdf#162220 sw smart justify: add unit tests

It will be available in 24.8.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2024-09-03 09:41:38 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/309baeb104310708f771f50b8481654b0ac251ac

tdf#162109 tdf#162220 sw smart justify: add unit tests

It will be available in 24.2.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.