Bug 126544 - Some DOCX styles' "text direction" changes with UI Language
Summary: Some DOCX styles' "text direction" changes with UI Language
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:6.4.0 target:6.3.1
Keywords: filter:docx
Depends on:
Blocks: RTL-CTL
  Show dependency treegraph
 
Reported: 2019-07-25 15:25 UTC by eladhen2
Modified: 2022-09-14 16:08 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
the file exanplifying the bug (6.76 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-07-25 15:29 UTC, eladhen2
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eladhen2 2019-07-25 15:25:29 UTC
Description:
Some styles of text in DOCX files have their text direction set to Right-To-Left when User Interface language is set to Hebrew and to Left-To-Right when user interface language is set to English.

Steps to Reproduce:
1. install libreoffice-l10n-he to make Hebrew User Interface Possible
2. set User Interface language to Hebrew in Tools>Options>Language>User Interface
3. open attached bugexample.docx file. Observe that the text direction of the heading styles is set to Right-To-Left and that the heading texts are aligned to the right.
4. Set user interface to English in Tools>Options>Language>User Interface
5. open attached bugexample.docx file. Observe that the text direction of the heading styles is set to Left-To-Right and that the text is aligned to the left.

Actual Results:
When opened in a Hebrew (and possibly other RTL languages) interface the Heading texts in this DOCX (and in many others, but not all) are aligned to the right and have their Text Direction set as Right-To-Left.
When opened in an English interface the Heading texts in this DOCX (and in many others, but not all) are aligned to the left and have their Text Direction set as Left-To-Right.

Expected Results:
Text Direction and alignment should be independent of User Interface and dependent only on the file itself. This is still the case in Libreoffice 5.1


Reproducible: Sometimes


User Profile Reset: Yes



Additional Info:
System:    Host: UX305FA Kernel: 4.4.0-157-generic x86_64 (64 bit gcc: 5.4.0)
           Desktop: Cinnamon 3.6.7 (Gtk 3.18.9-1ubuntu3.3)
           Distro: Linux Mint 18.3 Sylvia

Version: 6.2.5.2
Build ID: 1:6.2.5-0ubuntu0.16.04.1~lo1
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk2;
Comment 1 eladhen2 2019-07-25 15:29:36 UTC
Created attachment 152987 [details]
the file exanplifying the bug
Comment 2 eladhen2 2019-07-25 16:02:22 UTC
Opened the file with older versions through Appimages. in 6.1.5 and earlier it behaves as expected so the bug is since 6.2.0.
Comment 3 eladhen2 2019-07-26 14:14:11 UTC
Bug still present in:
Version: 6.3.0.2
Build ID: 728469fa359ba8c83d812146293a0b0aa53945ba
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3; 
Locale: he-IL (he_IL.UTF-8); UI-Language: en-US
Comment 4 eladhen2 2019-07-29 10:00:12 UTC
Just checked on 

Version: 6.1.6.3
Build ID: 5896ab1714085361c45cf540f76f60673dd96a72
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk2; 
Locale: he-IL (he_IL.UTF-8); Calc: group threaded

The bug isn't there.
Comment 5 Eyal Rozenberg 2019-07-30 10:34:18 UTC
Confirming with:

Version: 6.3.0.1
Build ID: 1:6.3.0~rc1-2
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; 
Locale: he-IL (en_IL); UI-Language: en-US
Calc: threaded

Note that, unlike the headers, the Body Text and "טקסט גדול" paragraphs are right-aligned both with the Hebrew and with the English interface.
Comment 6 eladhen2 2019-07-31 15:52:07 UTC
Reproduced in:

Version: 6.4.0.0.alpha0+
Build ID: 9ee5ad5a0b84bfa652da34694ba4f75668f06087
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2019-07-30_13:21:44
Locale: he-IL (he_IL.UTF-8); UI-Language: en-US
Comment 7 Xisco Faulí 2019-08-01 09:03:00 UTC
Also reproduced in

Version: 5.2.0.0.alpha1+
Build ID: 5b168b3fa568e48e795234dc5fa454bf24c9805e
CPU Threads: 4; OS Version: Linux 4.15; UI Render: default; 
Locale: ca-ES (ca_ES.UTF-8

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 8 Xisco Faulí 2019-08-01 09:03:38 UTC
@Justin Luth, I thought you might be interested in this issue...
Comment 9 Justin L 2019-08-01 09:40:47 UTC
The root of the problem seems to be that the heading paragraph styles are inheriting from -none- instead of 
<w:style w:type="paragraph" w:styleId="1">
  <w:name w:val="Heading 1"/>
  <w:basedOn w:val="Style14"/>

<w:style w:type="paragraph" w:styleId="Style14">
  <w:name w:val="שורת כותרת"/>
  <w:basedOn w:val="Normal"/>
Comment 10 Justin L 2019-08-01 14:14:36 UTC
proposed fix at https://gerrit.libreoffice.org/76805
Comment 11 Commit Notification 2019-08-01 17:30:24 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/b47a8f091ad8f9048a6b7962e9cde5d04ea0d665%5E%21

tdf#126544 writerfilter: check parent style exists before assigning

It will be available in 6.4.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 12 Commit Notification 2019-08-02 06:47:19 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/+/8b81a453b22611f25674f5e44ae411d78c2fcada%5E%21

tdf#126544 writerfilter: check parent style exists before assigning

It will be available in 6.3.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 13 Justin L 2019-08-02 07:41:31 UTC
It wasn't an RTL specific bug in the end. This should be a good over-all compatibility fix.
Comment 14 Xisco Faulí 2019-08-02 08:41:45 UTC
Verified in

Version: 6.4.0.0.alpha0+
Build ID: 620fff54ca9cd04459cc5d963ef94d4438129fe4
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

@Justin Luth, thanks for fixing this issue. Probably it fixes other reported issues.