Bug 156672 - Simple LTR math formula incorrectly rendered in RTL direction
Summary: Simple LTR math formula incorrectly rendered in RTL direction
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, regression
Depends on:
Blocks: Formula-Editor RTL-CTL
  Show dependency treegraph
 
Reported: 2023-08-08 12:19 UTC by Hossein
Modified: 2023-12-04 20:59 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
RTL formula (40.58 KB, application/vnd.oasis.opendocument.text)
2023-08-08 12:19 UTC, Hossein
Details
A set of RTL formulas compared with LTR ones (44.00 KB, application/msword)
2023-08-08 12:25 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2023-08-08 12:19:58 UTC
Created attachment 188849 [details]
RTL formula

Description:
The formula is incorrectly displayed as RTL, and the parenthesizes are incorrectly reversed.

Steps to Reproduce:
1. Open attachment

Actual Results:
The formula "f(x)" is incorrectly displayed as RTL, and the parenthesizes are incorrectly reversed and is displayed as "f)x(".

Expected Results:
The formula should not be displayed as RTL, and the parenthesizes should not be reversed. If you make the paragraph LTR, the formula is displayed correctly.

Reproducible: Always


User Profile Reset: No


Additional Info:
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 4582cea56eedfe3529fe360c68fc4b95b7d47ac5
CPU threads: 12; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Hossein 2023-08-08 12:25:56 UTC
Created attachment 188850 [details]
A set of RTL formulas compared with LTR ones

Compare the RTL formulas with the LTR formulas. The RTL formulas are garbled and rendered incorrectly.
Comment 2 Hossein 2023-08-08 12:33:56 UTC
The problem is twofold:

1. DOC file open, which leads to the above problem. The problem is not visible in DOCX.

2. When editing the formulas, changing direction should not have any effect (probably other than using localized numerals, if needed).
Comment 3 Hossein 2023-08-08 12:36:46 UTC
@Khaled:
This can be an interesting piece of font rendering. :-)
Comment 4 Hossein 2023-08-12 13:34:44 UTC
Not reproducible in 3.3. Marking as regression.

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 5 ⁨خالد حسني⁩ 2023-08-13 08:28:56 UTC
Bibisected to:

commit 6b8c157a0b4f37a09fdbf656919b2df06a3abc3e
Date:   Thu Mar 4 15:35:44 2021 +0100

    make RenderMaskPrimitive2DPixel() clip using clipping (tdf#140797)

But I think it just changes the conditions that expose this bug. If I revert this commit, the issue is fixed unless the UI is RTL, then the issue shows up again. It is even worse with RTL UI, since the equation is always broken regardless of the paragraph direction.

So I don't think it is a regression per se.

4.3 looks good with RTL UI, bibisecting again.
Comment 6 ⁨خالد حسني⁩ 2023-08-13 10:13:47 UTC
Bivisected with RTL UI to a271321ab7d66eab007f998237e7fb09dd5c9bf7, but this makes little sense and reverting this commit makes no difference.
Comment 7 ⁨خالد حسني⁩ 2023-08-28 10:56:56 UTC
FWIW, the formula is not imported as a Math formula, but as a vector image, so Formula Editor is probably not involved at all here.