Bug 56554

Summary: Date field in Hebrew formatting include LTR text which is broken in RTL directionality
Product: LibreOffice Reporter: Lior Kaplan <kaplanlior>
Component: WriterAssignee: Caolán McNamara <caolan.mcnamara>
Status: VERIFIED FIXED    
Severity: normal CC: amiadb
Priority: medium    
Version: 3.3.0 release   
Hardware: Other   
OS: All   
Whiteboard: target:3.7.0 target:3.6.4
Crash report or crash signature: Regression By:
Attachments: problematic document
same date in both LTR and RTL directionality
html export of the example document

Description Lior Kaplan 2012-10-30 00:01:38 UTC
When adding a date filed and choosing a Hebrew date format ("[NatNum2][~jewish]NN DD MMMM YY"), the date appear badly with RTL text directionality.

This seems to happen as the field had parts of it as LTR text, although all the text is Hebrew (which is RTL). Exporting the file to HTML shows that the field has some part of the date twice - both as LTR and RTL, while the rest is RTL. This causes an severe visual problem.
Comment 1 Lior Kaplan 2012-10-30 00:02:25 UTC
Created attachment 69262 [details]
problematic document
Comment 2 Lior Kaplan 2012-10-30 00:03:15 UTC
Created attachment 69263 [details]
same date in both LTR and RTL directionality
Comment 3 Lior Kaplan 2012-10-30 00:03:59 UTC
Created attachment 69264 [details]
html export of the example document
Comment 4 Urmas 2012-10-31 19:13:56 UTC
Why there's a hyphen inside the date?
Comment 5 Lior Kaplan 2012-10-31 19:34:26 UTC
In Hebrew leap years we have two Adar months, the hyphen was meant to connect a letter to the month names to indicate in the 2nd adar. I would rather have it without the  hyphen:

אדר א'
אדר ב'
Comment 6 Lior Kaplan 2012-10-31 20:07:30 UTC
Remove the hyphen from i18npool/source/localedata/data/he_IL.xml does fix the problem, but I'm feeling this is fixing the symptom instead of the source problem. And fixing the symptoms only makes fixing the source problem harder.
Comment 7 Urmas 2012-10-31 21:21:58 UTC
Does adding an RLM before a hyphen solve this?
Comment 8 Lior Kaplan 2012-11-03 21:17:09 UTC
Nope, still broken with RLM added... (display and HTML export)

--- a/i18npool/source/localedata/data/he_IL.xml
+++ b/i18npool/source/localedata/data/he_IL.xml
@@ -391,8 +391,8 @@
         </Month>
         <Month>
           <MonthID>ve-Adar</MonthID>
-          <DefaultAbbrvName>אדר-ב</DefaultAbbrvName>
-          <DefaultFullName>אדר-ב</DefaultFullName>
+          <DefaultAbbrvName>אדר<U+200F>-ב</DefaultAbbrvName>
+          <DefaultFullName>אדר<U+200F>-ב</DefaultFullName>
         </Month>
       </MonthsOfYear>
       <Eras>
Comment 9 Not Assigned 2012-11-05 15:17:17 UTC
Caolan McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4c49af256a456af48f0b29262c0b23aa1f6a9cd5

Related: fdo#56554 fix multi-script html field export



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 10 Caolán McNamara 2012-11-05 15:58:41 UTC
Fixed the html export anyway. If I copy and paste-special the first paragraph as plain text it lays out correctly, and if I change the western font size to 20 I can see that the layout has given - the RTL font correctly in the non-field case but incorrectly for the field case for some reason.
Comment 11 Lior Kaplan 2012-11-06 06:59:51 UTC
Thanks Caolan, I verified the HTML export fix with a private build. 

I'll go on and submit the patch for workaround the date field problem by removing the hyphen.
Comment 12 Caolán McNamara 2012-11-06 11:39:40 UTC
No, don't do that :-) I was still debugging the second part.
Comment 13 Not Assigned 2012-11-06 11:48:13 UTC
Caolan McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=deaa86b263e47965eeb67ebb179023bdf5ba82c2

Resolves: fdo#56554 hyphen in RTL date field split RTL processing



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 14 Lior Kaplan 2012-11-06 22:22:46 UTC
Second commit verified on a private build. Thanks again.

Can these commits also be applied in the 3.6 branch?
Comment 15 Caolán McNamara 2012-11-07 00:12:49 UTC
You can follow the usual review 3-6 process, either via the mailing list or gerrit, or cherry-pick it as a committer with your own sign off to get it into 3-6.
Comment 16 Lior Kaplan 2012-11-07 06:25:54 UTC
What I meant in the previous question was if the commits depend on any master only code or they are (technically) safe for the 3.6 branch. I prefer to verity before cherry-picking them myself (just in case I've missed something).
Comment 17 Caolán McNamara 2012-11-07 11:31:36 UTC
I believe they're technically safe.
Comment 18 Not Assigned 2012-11-12 20:32:23 UTC
Caolan McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=81d9ca8be4f3abdbd4214110f07a34bd6246f7d8&g=libreoffice-3-6

Related: fdo#56554 fix multi-script html field export


It will be available in LibreOffice 3.6.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 19 Not Assigned 2012-11-12 20:32:42 UTC
Caolan McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9d8d8c8432ceb146bc88e4cfed9011208a53db8a&g=libreoffice-3-6

Resolves: fdo#56554 hyphen in RTL date field split RTL processing


It will be available in LibreOffice 3.6.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.