Bug 163149 - smart justified text does not wrap correctly around frame - extends into the picture area
Summary: smart justified text does not wrap correctly around frame - extends into the ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.2.0 target:24.8.3
Keywords: bibisected, bisected, filter:docx, regression
Depends on:
Blocks: DOCX-Anchor-and-Text-Wrap
  Show dependency treegraph
 
Reported: 2024-09-25 14:04 UTC by Justin L
Modified: 2024-10-17 05:15 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Image-square-tight-wrap_C15.pdf: how page 1 looks in master (25.2) (86.56 KB, application/pdf)
2024-09-25 14:04 UTC, Justin L
Details
simplified test file (14.63 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-10-15 21:24 UTC, László Németh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2024-09-25 14:04:44 UTC
Created attachment 196677 [details]
Image-square-tight-wrap_C15.pdf: how page 1 looks in master (25.2)

Using Image-square-tight-wrap_C15.docx (attachment 174372 [details] from bug 143934), several justified lines are shown extending into the image frame area.

This started in 24.2 for "mauris ac" and "ante, non"
with commit 17eaebee279772b6062ae3448012133897fc71bb
Author: László Németh on Wed Nov 15 23:31:12 2023 +0100
    tdf#119908 sw smart justify: fix justification by shrinking

and an additional hanging text for "Donec ac ante" was introduced with 24.2 backport commit 8d247e3ad47e0b828437abb019e1573dbb1c05b1
Author: László Németh on Tue Dec 19 11:58:40 2023 +0100
    tdf#119908 tdf#158776 sw smart justify: shrink only spaces
Comment 1 Justin L 2024-09-26 12:23:51 UTC
I'm surprised that you haven't reverted "smart justify" from stable version 24.2 and 24.8. It has proven to not be reliable yet.

At minimum, it should be hidden behind an experimental flag for stable versions.
Comment 2 László Németh 2024-10-06 22:32:33 UTC
(In reply to Justin L from comment #1)

> I'm surprised that you haven't reverted "smart justify" from stable version
> 24.2 and 24.8. It has proven to not be reliable yet.

@Justin: I'm sorry, I've just noticed your bug report, preparing my LiboCon presentation. I've fixed all the (mostly newly) reported problems in the last few months, but this, and the Bug 163039 (about Arabic footnote indices), were quite new for me.

> 
> At minimum, it should be hidden behind an experimental flag for stable
> versions.

I'm going to fix the remaining regressions soon. If it would be late for 24.2.7 (https://wiki.documentfoundation.org/ReleasePlan/24.2#24.2.7_release), I'll disable smart justify there.

Hopefully these are the last regressions. :) If yes or no, it's still worth to add an option to disable smart justify, prepared for any eventuality.

Many thanks for your suggestion and feedback!
Comment 3 Justin L 2024-10-07 11:26:30 UTC
(In reply to László Németh from comment #2)
> > At minimum, it should be hidden behind an experimental flag for stable
> > versions.
> 
> Hopefully these are the last regressions. :)
Yes, hopefully. However, it is purely speculation to assume that there aren't unreported regressions - or that these fixes won't cause their own regressions.

I understand the value in having your code out in front of the general public to flush out these edge cases. And that was entirely the point of the "fresh" releases. Since this is really tricky and brand new stuff, I'd strongly suggest making it experimental in 24.2 _regardless_ of whether you think you have fixed the final bugs.

Don't get me wrong. I stand in awe of what you have accomplished. After all, I was also tasked with looking at this project and I walked away as something far beyond anything I could even dream about. But since it is so tricky, it should be very well "proven and tested" before it is forced on the general user base. I suggest that "proven" status simply cannot be confirmed even for 24.8 any more. So I suggest that after 24.8.5 (the first "stable") release is out, that 24.8.6 has smart justify flagged as experimental again.
Comment 4 László Németh 2024-10-15 21:24:54 UTC
Created attachment 197065 [details]
simplified test file
Comment 5 László Németh 2024-10-15 21:27:34 UTC
Proposed fix: https://gerrit.libreoffice.org/c/core/+/174985
Comment 6 László Németh 2024-10-15 23:11:59 UTC
(In reply to Justin L from comment #3)
> (In reply to László Németh from comment #2)
> > > At minimum, it should be hidden behind an experimental flag for stable
> > > versions.
> > 
> > Hopefully these are the last regressions. :)
> Yes, hopefully. However, it is purely speculation to assume that there
> aren't unreported regressions - or that these fixes won't cause their own
> regressions.
> 
> I understand the value in having your code out in front of the general
> public to flush out these edge cases. And that was entirely the point of the
> "fresh" releases. Since this is really tricky and brand new stuff, I'd
> strongly suggest making it experimental in 24.2 _regardless_ of whether you
> think you have fixed the final bugs.

There are other values, too. The change does not affect the 2007 DOCX format, e.g. DOCX documents previously saved mostly with Writer.

The transitional DOCX format has now been renamed to "DOCX 2010–365" on the Writer's user interface, meaning that users are now more likely to choose. This DOCX file format has already had the default smart justify in MSO, so interoperability requires the use of the new line break as soon, as possible in Writer, too.

Despite the remaining regressions (or now regression), the recent smart justify implementation solved all the paragraph line count/page count and page layout interoperability problems of the "transitional" format resulted by the different line break algorithm. It results the same 100-page book opening a "DOCX 2010–365", not e.g. a 101-105 page book with broken layout or with images on different pages, maybe broken "references" (directly typed page numbers) etc. So it has reduced the interoperability problem by a hundredth, in terms of fewer pages affected by the remaining interoperability problem.

> 
> Don't get me wrong. I stand in awe of what you have accomplished. After all,
> I was also tasked with looking at this project and I walked away as
> something far beyond anything I could even dream about. But since it is so

I could spend much more time on the task, so likely I'm less bothered about going blindly forward. :)

> tricky, it should be very well "proven and tested" before it is forced on
> the general user base. I suggest that "proven" status simply cannot be
> confirmed even for 24.8 any more. So I suggest that after 24.8.5 (the first
> "stable") release is out, that 24.8.6 has smart justify flagged as
> experimental again.

Most of the users won't update LibreOffice, so it's a good idea to leave this change to the last stable bug fix release. My problem is that disabling smart justify could result serious regressions again, more proven regressions, than potential bug fixes. But this is just my opinion, based on the above.

Justin, thanks for your feedback! Sorry we didn't meet now at the conference, but hope to see you soon! I tried to tell everyone I could, that my main experience with LibreOffice development is that we cannot do it alone. The code is simply too big and therefore complicated. It takes the continuous work of 30-50 developers to maintain such a large code base. So I am very grateful not only for your comments here, but also for your bug fixes! I also hope that our improvements will inspire others to help, with code or otherwise. I see this as more important than anything else at the moment, because even within the foundation there are those who do not recognise the need for, let alone the limits of, continuous, predictable and recognisable development.
Comment 7 Commit Notification 2024-10-16 09:30:20 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

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

tdf#163149 sw smart justify: fix line shrinking at image wrapping

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 8 László Németh 2024-10-16 21:24:15 UTC
Back-port is started to 24.8 and 24.2.
Comment 9 Commit Notification 2024-10-17 05:15:13 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/92317442b61001e479feb1a5c376d36584ecd5d1

tdf#163149 sw smart justify: fix line shrinking at image wrapping

It will be available in 24.8.3.

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.