Bug 138895 - FILEOPEN DOCX Shape distance from text imported with rounding error
Summary: FILEOPEN DOCX Shape distance from text imported with rounding error
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.0.0.5 release
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:7.2.0 target:7.1.3
Keywords: bibisected, bisected, regression
Depends on:
Blocks: OOXML-Shapes
  Show dependency treegraph
 
Reported: 2020-12-14 13:38 UTC by NISZ LibreOffice Team
Modified: 2021-03-18 13:11 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Word (22.71 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-12-14 13:38 UTC, NISZ LibreOffice Team
Details
Screenshot of the original document side by side in Word and Writer (142.18 KB, image/png)
2020-12-14 13:38 UTC, NISZ LibreOffice Team
Details
Reduced testcase (15.44 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-03-09 21:03 UTC, Miklos Vajna
Details
Reduced testcase (15.44 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2021-03-09 21:05 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2020-12-14 13:38:03 UTC
Created attachment 168148 [details]
Example file from Word

Attached file was reduced from the attachment #130189 [details] of bug #105134
This document has some textboxes that have different values set for distance from text.
These values are imported to Writer with a tiny rounding error.

Steps to reproduce:
    1. Open attached file

Actual results:
The last line of the bulleted paragraph is below the textbox with red text.
This is because the distance from text values are a bit incorrectly imported:
- Left: 1.27 cm -> 1.32 cm
- Right: 0.76 cm -> 0.84 cm
- Top and Bottom: 0.51 cm -> 0.56 cm

Expected results:
Same values as in Word.

LibreOffice details:
Version: 7.2.0.0.alpha0+ (x64)
Build ID: 61d07657caab5e0fb8ec4446f67a7044e14dae4b
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL

Also in:
Version: 6.0.0.3
Build ID: 64a0f66915f38c6217de274f0aa8e15618924765
CPU threads: 4; OS: Windows 6.3; UI render: default; 
Locale: en-US (hu_HU); Calc: CL

Version: 5.0.0.5
Build ID: 1b1a90865e348b492231e1c451437d7a15bb262b
Locale: hu-HU (hu_HU)

Not yet in:
Version: 4.4.0.3
Build ID: de093506bcdc5fafd9023ee680b8c60e3e0645d7
Locale: hu_HU
The textbox was imported as shape, with correct distance values. The last line of the previous paragraph was not broken below the shape, just like in Word.

Additional Information: 

Bibisected using bibisect-win32-5.0 to:
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=a5a836d8c43dc9cebbbf8af39bf0142de603a7c6 
author	Miklos Vajna <vmiklos@collabora.co.uk>	2014-12-04 10:42:40 +0100
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2014-12-04 11:25:38 +0100

DOCX filter: effect extent should be part of the margin

Adding CC to: Miklos Vajna
Comment 1 NISZ LibreOffice Team 2020-12-14 13:38:27 UTC
Created attachment 168149 [details]
Screenshot of the original document side by side in Word and Writer
Comment 2 Xisco Faulí 2021-02-23 09:16:22 UTC
Reproduced in

Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: a1d987cf3d0e1ae4d87f7d06ae93e71a0cc59f0c
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Adding Cc: to Miklos Vajna
Comment 3 Miklos Vajna 2021-03-09 21:03:37 UTC
Created attachment 170382 [details]
Reduced testcase

Reverting the writerfilter part of the commit doesn't bring back the 1:1 match for Writer:Word anymore, so that'll be more complicated than just the above commit.

I attach a reduced testcase where reverting the above commit does fix the problem: there is a line above the shape in Word, there is no such thing in Writer and the revert results in the same Word-like layout in Writer as well.

I plan to take a look at this reduced testcase.
Comment 4 Miklos Vajna 2021-03-09 21:05:23 UTC
Created attachment 170383 [details]
Reduced testcase

Reverting the writerfilter part of the commit doesn't bring back the 1:1 match for Writer:Word anymore, so that'll be more complicated than just the above commit.

I attach a reduced testcase where reverting the above commit does fix the problem: there is a line above the shape in Word, there is no such thing in Writer and the revert results in the same Word-like layout in Writer as well.

I plan to take a look at this reduced testcase.
Comment 5 Miklos Vajna 2021-03-11 08:13:34 UTC
Ignore the above 2 comments, I didn't notice that the bugdoc uses Tahoma and I didn't have that installed. Once it's installed, I can confirm that the bug goes away with reverting the bisected commit.
Comment 6 Commit Notification 2021-03-16 08:43:30 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

tdf#138895 DOCX filter: fix handling for effect extent vs line width

It will be available in 7.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 7 Commit Notification 2021-03-18 13:11:41 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

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

tdf#138895 DOCX filter: fix handling for effect extent vs line width

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