Bug 161810 - [DOCX] Justified text does not wrap correctly
Summary: [DOCX] Justified text does not wrap correctly
Status: ASSIGNED
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: László Németh
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:docx, regression
Depends on:
Blocks: DOCX-Anchor-and-Text-Wrap
  Show dependency treegraph
 
Reported: 2024-06-27 11:07 UTC by Eddie Robson
Modified: 2024-09-04 12:06 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
This shows how the justified text intrudes into the margin. (9.19 KB, image/png)
2024-06-27 11:07 UTC, Eddie Robson
Details
A file affected by the issue. (7.59 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-06-27 12:23 UTC, Eddie Robson
Details
Screenshot of the sample file (OK) (131.77 KB, image/png)
2024-06-27 12:49 UTC, Rafael Lima
Details
New Sample document (16.02 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-06-27 14:29 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eddie Robson 2024-06-27 11:07:37 UTC
Created attachment 195000 [details]
This shows how the justified text intrudes into the margin.

Text set to justified in Writer does not wrap properly, and lines will overhang into the margin, seemingly at random. If I change the text to left aligned, usually the part that intrudes into the margin will stay there while the rest of the text adjusts. If I scroll away so that part of the text isn't on the screen, then return to it, the phantom text has usually gone. But if I return the text to justified, the line will again intrude into the margin in the same place. I haven't changed anything in my settings, and this problem has persisted through several updates.
Comment 1 Rafael Lima 2024-06-27 12:11:02 UTC
Is this issue specific to some file? Or does this happen with a new blank file?

Can you share a file where this is happening?

Also, copy and paste your version info. Go to Help - About LibreOffice and then click "Version Information" to copy it.
Comment 2 Eddie Robson 2024-06-27 12:22:55 UTC
Not specific to one file, it affects every new file I create. I've also opened some old ones and it doesn't seem to affect files I created in Word, but older ones created in Libreoffice seem affected. I've only noticed the problem in the past year or so, but I've got files from three years ago which have this problem when I open them now. However, files created more recently seem to suffer from it more severely - I'll upload one.

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 8; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Calc: threaded
Comment 3 Eddie Robson 2024-06-27 12:23:24 UTC
Created attachment 195002 [details]
A file affected by the issue.
Comment 4 Rafael Lima 2024-06-27 12:49:19 UTC
Created attachment 195004 [details]
Screenshot of the sample file (OK)

This is what I'm getting after opening the file. It is working as expected.

Now I'm curious as to why this could be happening on your machine.

Have you tried in safe mode? Maybe there's some setting you changed that is causing this (though I couldn't tell which it might be).

https://help.libreoffice.org/latest/lo/text/shared/01/profile_safe_mode.html
Comment 5 Eddie Robson 2024-06-27 13:03:09 UTC
Thanks - I've opened it in safe mode, but I'm afraid I'm still getting the same issue. I'd also note the first line to spill into the margin is slightly below the screenshot you've attached - the lines that end with "want" and "wanted" are both spilling over.
Comment 6 Rafael Lima 2024-06-27 13:05:47 UTC
(In reply to Eddie Robson from comment #3)
> Created attachment 195002 [details]
> A file affected by the issue.

Forget about my previous comment... if I scroll down I see the issue in the line 

"As the minutes went by, with no response, I regretted sending the message. I didn’t really want to have an argument about it. I would apologise next time I saw him."

Repro with

Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 16; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 4:24.2.3-0ubuntu0.24.04.2
Calc: threaded
Comment 7 Eddie Robson 2024-06-27 13:07:41 UTC
Yeah - it's very inconsistent, there's no logic to it I can see. Sometimes a long block of text won't have any errors, then there'll be several close together.
Comment 8 Rafael Lima 2024-06-27 14:29:40 UTC
Created attachment 195006 [details]
New Sample document

I was suspecting the issue had something to do with your file. So I did the following:

1) Opened your sample file in MS Word
2) Copied all the text
3) Created a new blank Word file and pasted the text as pure text (no formatting)
4) I applied the formatting manually (Liberation Serif, double spacing)
5) Saved the file as DOCX
6) Opened it in LO Writer... now I get the issue, but on different sentences.

So the problem is nothing to do with your file. It is possibly related to DOCX import.

I've just attached the newly created sample file.
Comment 9 Eddie Robson 2024-06-27 14:45:09 UTC
Thank you. I think you might be onto something - I just opened a bunch of different documents from my older files to see what happened, and the error doesn't seem to occur on the .docs but it does on all the .docxs.
Comment 10 Justin L 2024-08-24 14:44:16 UTC
This started in 24.2 with commit 7d08767b890e723cd502b1c61d250924f695eb98
Author: László Németh on Mon Oct 16 19:39:30 2023 +0200
    tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt.
Comment 11 Justin L 2024-09-04 12:06:25 UTC
For both "Answers On A Postcard.docx" and "Answer2.docx", it looks like the problem is only affecting the first line of the paragraph. Other similar bug reports have reported similar problems against the last line.