Bug 166113 - FILEOPEN DOCX smart justify: Times New Roman not justified identically to MS Word 2019
Summary: FILEOPEN DOCX smart justify: Times New Roman not justified identically to MS ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.8.0.0 alpha1+
Hardware: All All
: low minor
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0 target:25.8.0.0.beta2
Keywords: bibisected, bisected
Depends on:
Blocks: DOCX-Smart-Justify
  Show dependency treegraph
 
Reported: 2025-04-09 20:21 UTC by Justin L
Modified: 2025-06-30 16:03 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
forum-mso-en-18077_smartJustify.zip: DOCX file, PDFs and overlay images (4.16 MB, application/zip)
2025-04-09 20:21 UTC, Justin L
Details
compare.docx: other test document (9.90 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-06-11 11:31 UTC, László Németh
Details
compare.fodt: flat ODF version of the previous test document with metric-equivalent Liberation Serif (34.81 KB, application/vnd.oasis.opendocument.text-flat-xml)
2025-06-11 11:38 UTC, László Németh
Details
compare_mso.pdf: compare.docx in MS Word (24.72 KB, application/pdf)
2025-06-11 11:41 UTC, László Németh
Details
compare_docx_before.pdf: compare.docx in Writer before the recent fixes (45.59 KB, application/pdf)
2025-06-11 11:45 UTC, László Németh
Details
compare_docx_after.pdf: compare.docx in Writer after the recent fixes (same as in MS Word) (45.46 KB, application/pdf)
2025-06-11 11:47 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 2025-04-09 20:21:41 UTC
Created attachment 200262 [details]
forum-mso-en-18077_smartJustify.zip: DOCX file, PDFs and overlay images

I ran across this justified document that seems to be fairly simple - just using the Times New Roman font. However, our justification (as of 25.8 master) doesn't match the output I got from MS Word. The smart justify seemed to get worse results starting in 24.8.

During my bibisect, I focused on the first paragraph of the second page. In MS Word it ends with the single word "Soissons." in a line on its own - but in LO it easily fits on the previous line
starting with 24.8 commit 36bfc86e27fa03ee16f87819549ab126c5a68cac
Author: László Németh on Tue Dec 19 11:58:40 2023 +0100
    tdf#119908 tdf#158776 sw smart justify: shrink only spaces

In my PDF comparison, both MS Word 2019 and LO bibisect were running on the same windows machine, so both used the identical Times New Roman font version. (That said, it looks quite different with MS Word 2010 on a different windows box, so it sounds like a bit of a moving target...)

Marking as low priority, since this is mainly just submitted for information and not really as a concerned bug report.

To understand the contents of the PNG files:
- the most useful overlays are prev-import (24.8 oldest) and import (24.8.6) where RED=MS Word 2019 and grayscale is LO.
- the import-compare and export-compare overlays didn't need to be included. In these overlays, RED=24.8.6, BLUE=24.8oldest, and grayscale is MSO - so any red showing suggests a regression.

Found by Collabora's mso-test
Comment 1 László Németh 2025-04-10 19:14:32 UTC
@Justin: many thanks for the report! I think, it will allow to refine the MSO interoperability a lot, e.g. a possible limit on the difference between the space sizes of the  consecutive lines (part of the Knuth-Plass algorithm), or the unnecessary +1 space, or some mistake in handling text portions etc.
Comment 2 Commit Notification 2025-06-09 22:00:15 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/529755f0919217a84a12daad0fddfddd1124f0e9

tdf#166113 sw smart justify: adjust algorithm for interoperability

It will be available in 26.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 3 Commit Notification 2025-06-10 03:36:46 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

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

tdf#166113 sw smart justify: adjust algorithm for interoperability

It will be available in 25.8.0.0.beta2.

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 4 László Németh 2025-06-11 11:31:45 UTC
Created attachment 201199 [details]
compare.docx: other test document
Comment 5 László Németh 2025-06-11 11:38:54 UTC
Created attachment 201200 [details]
compare.fodt: flat ODF version of the previous test document with metric-equivalent Liberation Serif
Comment 6 László Németh 2025-06-11 11:41:08 UTC
Created attachment 201201 [details]
compare_mso.pdf: compare.docx in MS Word
Comment 7 László Németh 2025-06-11 11:45:51 UTC
Created attachment 201202 [details]
compare_docx_before.pdf: compare.docx in Writer before the recent fixes

(always greedy space shrinking)
Comment 8 László Németh 2025-06-11 11:47:47 UTC
Created attachment 201203 [details]
compare_docx_after.pdf: compare.docx in Writer after the recent fixes (same as in MS Word)

(non-greedy space shrinking or expansion)
Comment 9 Commit Notification 2025-06-13 09:30:03 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/938022c445545a16010951515c88d6c45f138d70

tdf#166113 sw smart justify: fix tdf160170.py regression test

It will be available in 26.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 10 Commit Notification 2025-06-13 12:12:38 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-25-8":

https://git.libreoffice.org/core/commit/333d908450a16150bef74cc61ccdae330048746d

tdf#166113 sw smart justify: fix tdf160170.py regression test

It will be available in 25.8.0.0.beta2.

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 11 László Németh 2025-06-30 15:39:48 UTC
Fixed for plain text. See Bug 166145 for the remaining possible differences (text span).
Comment 12 Commit Notification 2025-06-30 16:03:38 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

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

tdf#167298 tdf#166113 sw word spacing: add word spacing indicator

It will be available in 26.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.