Issue 62413 - Text in formula editor should not be right-aligned in RTL
Summary: Text in formula editor should not be right-aligned in RTL
Status: CLOSED FIXED
Alias: None
Product: Math
Classification: Application
Component: ui (show other issues)
Version: OOo 2.0.1
Hardware: All All
: P3 Trivial with 2 votes (vote)
Target Milestone: ---
Assignee: michael.ruess
QA Contact: issues@sw
URL:
Keywords:
Depends on:
Blocks: 96765
  Show dependency tree
 
Reported: 2006-02-22 08:04 UTC by alan
Modified: 2013-08-07 14:56 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Text is indented too much (42.15 KB, image/jpeg)
2006-02-22 08:08 UTC, alan
no flags Details
Disables RTL in formula edit window (628 bytes, patch)
2006-09-20 18:22 UTC, alan
no flags Details | Diff
Sample Hebrew document with math (11.20 KB, application/vnd.oasis.opendocument.text)
2006-09-21 11:12 UTC, alan
no flags Details
document with arabic sample text (7.55 KB, application/octet-stream)
2006-09-28 11:02 UTC, thomas.lange
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description alan 2006-02-22 08:04:36 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.
Comment 1 alan 2006-02-22 08:08:26 UTC
Created attachment 34371 [details]
Text is indented too much
Comment 2 michael.ruess 2006-02-22 10:22:12 UTC
MRU->TL: as long as formula commands are not localized to CTL text, the text in
command window should be always left aligned.
Comment 3 alan 2006-09-12 09:38:11 UTC
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.
Comment 4 alan 2006-09-20 18:21:09 UTC
I'm attaching a patch which solves the problem. Please review.
Comment 5 alan 2006-09-20 18:22:29 UTC
Created attachment 39273 [details]
Disables RTL in formula edit window
Comment 6 thomas.lange 2006-09-21 10:28:44 UTC
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.
Comment 7 alan 2006-09-21 11:12:05 UTC
Created attachment 39282 [details]
Sample Hebrew document with math
Comment 8 alan 2006-09-21 11:27:48 UTC
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.
Comment 9 yba 2006-09-22 09:56:39 UTC
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.
Comment 10 thomas.lange 2006-09-25 09:53:25 UTC
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?
Comment 11 thomas.lange 2006-09-25 10:23:02 UTC
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.
Comment 12 thomas.lange 2006-09-28 11:02:04 UTC
Created attachment 39413 [details]
document with arabic sample text
Comment 13 thomas.lange 2006-09-28 11:10:03 UTC
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.
Comment 14 thomas.lange 2006-09-28 11:35:02 UTC
Fixed in CWS tl25.

Files changed:
- starmath/source/edit.cxx
Comment 15 thomas.lange 2006-11-27 11:46:34 UTC
.
Comment 16 stefan.baltzer 2007-01-22 16:00:52 UTC
SBA->MRU: Please take over, thx.
Comment 17 michael.ruess 2007-01-25 11:01:38 UTC
Verified in CWs tl25.
Comment 18 michael.ruess 2007-02-15 11:17:29 UTC
Correcting target from 2.x to 2.3.
Comment 19 michael.ruess 2007-03-22 19:15:23 UTC
Checked fix in SRC680m206.