Apache OpenOffice (AOO) Bugzilla – Issue 62413
Text in formula editor should not be right-aligned in RTL
Last modified: 2013-08-07 14:56:23 UTC
In RTL mode, when I enter a formula such as (%log(x)) over sqrt(2) the text appears on the left, but the cursor appears on the right. Additionally, the doesn't appear next to the left margin as in English OOo, but indented somewhat. See attached screenshot. If I save the formula, and then reload it, the text in the Formula Editor appears aligned to the right. Since formulas are always LTR, even in RTL mode the text should be left-aligned to the margin by default.
Created attachment 34371 [details] Text is indented too much
MRU->TL: as long as formula commands are not localized to CTL text, the text in command window should be always left aligned.
ayaniger->tl: Have you had a chance to look at this? This bug makes the formula editor almost unusable for Hebrew users. If you don't have time now, I can devote time to fixing it, but I would need some initial direction.
I'm attaching a patch which solves the problem. Please review.
Created attachment 39273 [details] Disables RTL in formula edit window
I asked a native Arabic writing colleague and he disagrees with what I understood as your statement. Thus please could you attach a text(!) document with a) a sample of how an arabic text with a formula will actually be written b) how you think it should be displayed in Math's edit window. (and if it should be aligned right or left in the edit window) Example in english we would write: "1st-word 2nd-word 3rd-word E = mc^2" and would see it that way in the edit window and in the graphic window. Whereas in Arabic my colleague said one would have it written like "mc^2 = E 3rd-word 2nd-word 1st-word" and everything aligned to the right.
Created attachment 39282 [details] Sample Hebrew document with math
I've attached a Hebrew text document with a formula in the text. Unfortunately, I don't know Arabic. I created this document in Writer, and used Insert/Object/Formula for the equation only. I and the Hebrew users I contacted understood that since formulas are inherently LTR, there's no need for right alignment. If you use the formula editor for text as well, it doesn't work in Hebrew. At present, if you type Hebrew text in the edit window, it comes out backwards in the graphic window. I didn't think this mattered, since formulas are LTR, and Writer would take take of the text. If this does matter, then major work has to be done in OOo Math to make it usable for RTL.
There seems to be some confusion here. Let us try to straighten it out. Alignment First of all, mathematical formulae that appear in Hebrew texts are right aligned, just like any other LTR text that is embedded in a Hebrew or Arabic text. Directionality Mathematical formulae in their entirety are considered to be embedded LTR texts in Israel for the purposes of Hebrew and Arabic text *as printed in Israel*. Israel is also an Arabic speaking country and with it's own Arabic locale. It might be that mathematical formulae are displayed otherwise on other Arabic locales though I rather doubt it. Please ask Waleed Husny or the Arabeyes list or Magdy Abdel Kudous at Sun about this. Therefore, in the absence of explicit directional overrides, the first character of a Western numerical expression or mathematical formula embedded in a Hebrew or Arabic text increments the Bidi algorithm embedding level of the paragraph, and the first strong RTL (Hebrew or Arabic) character following the numerical expression decrements the embedding level. In simple terms, "A = B" in a Hebrew or Arabic text printed in Israel looks exactly like "A = B" in an English text printed in Manchester - there is no switching sides around the "=" sign. I will solicit Matti Allouche's comment on this, since he has a sharper grasp of the Bidi algortihm and the higher level protocols than I.
TL->ayaniger: Currently I fail to see the difference the patch makes. I modified a src680 m182 with the patch and set my CTL language to arabic/hebrew and the formula displayed in the edit and graphic window looks exactly as without the patch. However: it is quite different from the display in OOo 2.0.3. I remember that I have fixed sth in this area for 2.0.4 but with a quick search I did not find that issue. I have to search for it again. Also I asked QA to provide me with a arabic or hebrew environment to check if that will change sth. In the meanwhile could you also please check the issue with a version >= m182?
If found the issue I was taking care of for OOo 2.0.4 it was issue 37362. But that should have no effect on the edit window. Thus I still wonder where the change from OOo 2.0.3 to OOo 2.0.4 originates from.
Created attachment 39413 [details] document with arabic sample text
TL->ayaniger: I was now able to confirm that your patch makes a diference in an evironment with Hebrew or Arabic locale. (Note: The same can be achieved by setting the environment variable SAL_RTL_ENABLED=1 in any non CTL office before starting soffice). Thus I will apply the patch as you suggested. Please note though that the patch does not affect the problem that was stated as 'remaining' in issue 37362: If you type what would be in proper hebrew/arabic setting - "word2 word1" this will be fine in edit window and graphic display but - "word2" "word1" or - word2 word1 will be switched because the parser gets to read the text in the order it was typed and it does not know about RTL at all.
Fixed in CWS tl25. Files changed: - starmath/source/edit.cxx
.
SBA->MRU: Please take over, thx.
Verified in CWs tl25.
Correcting target from 2.x to 2.3.
Checked fix in SRC680m206.