Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 228244 - BIDI3.4:Error in displaying arabic data on exported report PDF , PPT
Summary: BIDI3.4:Error in displaying arabic data on exported report PDF , PPT
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 major (vote)
Target Milestone: 2.3.0 RC1   Edit
Assignee: Yu Chen CLA
QA Contact:
URL:
Whiteboard: Autoed,G-text
Keywords:
Depends on: 225536
Blocks:
  Show dependency tree
 
Reported: 2008-04-22 14:04 EDT by Mohamed Tarief CLA
Modified: 2011-03-17 07:19 EDT (History)
1 user (show)

See Also:


Attachments
ScreenShots (2.01 KB, application/octet-stream)
2008-04-22 14:04 EDT, Mohamed Tarief CLA
no flags Details
ScreenShots (36.93 KB, application/octet-stream)
2008-04-23 04:31 EDT, Mohamed Tarief CLA
no flags Details
Expected appearance (?) (9.40 KB, image/jpeg)
2008-04-27 09:10 EDT, Lina Kemmel CLA
no flags Details
Proposed patch (21.92 KB, patch)
2008-04-29 10:10 EDT, Lina Kemmel CLA
no flags Details | Diff
Proposed patch using ICU (21.92 KB, patch)
2008-04-29 12:14 EDT, Lina Kemmel CLA
bjorn.freeman-benson: iplog+
Lina.Kemmel: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mohamed Tarief CLA 2008-04-22 14:04:39 EDT
Created attachment 97059 [details]
ScreenShots

Build ID: I20080419

Steps To Reproduce:
XXXX:Arabic Letters

1.Open New Project dialog from Eclipse File menu, select Business Intelligence and Reporting Tools, and click Next.

2.Type any Arabic Project name on Report Project dialog and click Finish. Open Associated Perspective dialog is displayed. Click Yes. 

3.On Navigator view, right click the project and select Import, select File System, and select the XXXX_Flat_File_CSV.rptdesign attached, then click Finish.

4.Double click the XXXX_Flat_File_CSV.rptdesign on Navigator view. The report design is displayed. Then, double click the Data Source and set the “Select Folder” to the path you have copied XXXX_CSV.csv file attached.

5.Preview the report in Web Viewer from Run->Run Report->In Web Viewer menu, again. Open Export Report dialog, select PDF, and click OK 

6.Repeat step 4 for PPT.

Expected Results:The Arabic data is displayed correctly
Actual Results:
1.On PDF : The Arabic Statement is Reversed
2.On PPT : The Letters of each Arabic word is reversed.

More information:
Locale : Arabic Locale
Comment 1 Mohamed Tarief CLA 2008-04-23 04:31:17 EDT
Created attachment 97173 [details]
ScreenShots
Comment 2 Lina Kemmel CLA 2008-04-27 09:10:35 EDT
Created attachment 97724 [details]
Expected appearance (?)

Mohamed, can you please tell if this screen shot shows Arabic text correctly? Thanks.
Comment 3 Mohamed Tarief CLA 2008-04-29 05:04:25 EDT
(In reply to comment #2)
> Created an attachment (id=97724) [details]
> Expected appearance (?)
> Mohamed, can you please tell if this screen shot shows Arabic text correctly?
> Thanks.

Yes , it is correct.
Thanks.
Comment 4 Lina Kemmel CLA 2008-04-29 10:10:02 EDT
Created attachment 97982 [details]
Proposed patch

The size of this patch is around 75 effective lines of code.

It is supposed to fix the order of words and also non-word Bidi runs, but not the reversed order of characters in PPT outputs. The latter is supposed to be covered by bug 225536.
Comment 5 Lina Kemmel CLA 2008-04-29 11:48:44 EDT
The proposed patch is supposed to address reordering of bidirectional text for presentation purposes, by the PDF layout and rendering engine.

The Bidirectional Algorithm (http://www.unicode.org/reports/tr9) prescribes three main phases of Bidi reordering:
1. "Separation of the input text into paragraphs."
2. "Resolution of the embedding levels of the text."
3. "Reordering the text for display on a line-by-line basis using the resolved
    embedding levels, once the text has been broken into lines."

The patch applies to the phases (2) and (3).

Phase (2) has already been handled in the layout engine, e.g. by the ChunkGenerator and BidiSplitter classes. Some minor changes were made though in order to operate absolute embedding (nesting) levels instead of run directions. Absolute levels are required in phase (3).

Phase (3) is concerned with the actual reordering of the Bidi chunks determined in phase (2) and is implemented in org.eclipse.birt.report.engine.layout.pdf.
emitter.LineLayout#reorderVisually method. This method is invoked by a PDF line layout manager, at the line aligning stage. First, it invokes ICU to reorder (a copy of) text chunks, placing them into the visual (display) order. (Note that the order of original chunks is not affected.) Second, it changes X positions of the actual text chunks in accordance with the just determined display order.

Please note that instead of the standard Java java.text.Bidi engine we now use the ICU Bidi engine (com.ibm.icu.text.Bidi), which may have a better standard-compliance.
Comment 6 Lina Kemmel CLA 2008-04-29 12:14:37 EDT
Created attachment 98017 [details]
Proposed patch using ICU

I resubmit the patch after correcting one place that accidentally refers to java.text.Bidi instead of com.ibm.icu.text.Bidi.
Comment 7 Lina Kemmel CLA 2008-04-29 12:46:12 EDT
I hope this patch will block bug #181909.
Comment 8 Cheng-Yee Lin CLA 2008-04-29 13:46:54 EDT
This issue is affecting the translation enablement testing in the BiDi area.  The code size of the patch for fixing this problem is pretty small.  Can the patch be accepted into the BIRT code base as soon as possible?
Comment 9 Yu Chen CLA 2008-05-07 06:14:16 EDT
Mohamed, can you attach the report design? I need it to test the result.
Comment 10 Lina Kemmel CLA 2008-05-07 06:35:15 EDT
Albert, Mohamed supplied a report design with attachment 97173 [details].
Comment 11 Lina Kemmel CLA 2008-05-07 06:37:06 EDT
ouch, sorry - attachment 97059 [details].
Comment 12 Yu Chen CLA 2008-05-08 02:00:31 EDT
The patch has been checked into cvs.

Fixed.
Comment 13 John Ryding CLA 2008-06-04 17:19:44 EDT
This problem has been verified fix for the PDF export, but still persists in the PPT exported file.
Comment 14 Yu Chen CLA 2008-06-04 22:34:43 EDT
In PPT 2007, bidi text can be reversed automatically.
But in PPT 2003, PPT does not has this feature. the bidi text need to be reversed in PPT emitter.
Comment 15 Wei Yan CLA 2008-06-05 00:26:31 EDT
As the latest 2007 support it, I think we needn't fix this issue. If you have different opinion, please reopen this entry.
Comment 16 Lina Kemmel CLA 2008-06-05 04:16:42 EDT
It works for me also in PPT 2003.

To support Bidi, pre-2007 PPT needs Bidi feature to be enabled at the OS level. To do so on non-Bidi locales, one has to select Windows "Regional and Language Options -> Languages -> Install files for Complex script and right-to-left languages..."

(Perhaps in the future we could check in BIRT if Bidi is enabled as the default or a supplemental locale, and proceed with PPT reordering accordingly.)
Comment 17 Lina Kemmel CLA 2008-06-05 04:31:44 EDT
(In reply to comment #16)
> (Perhaps in the future we could check in BIRT if Bidi is enabled as the default
> or a supplemental locale, and proceed with PPT reordering accordingly.)
- Actually, this doesn't make much sense, since end user operating system settings may be different. So it's user responsibility to enable his OS for Bidi.

Comment 18 Bjorn Freeman-Benson CLA 2008-06-18 16:09:00 EDT
Comment on attachment 98017 [details]
Proposed patch using ICU

per Ganymede IP log
Comment 19 Mohamed Tarief CLA 2008-07-06 07:57:07 EDT
Fixed
Comment 20 Lina Kemmel CLA 2008-09-05 07:09:32 EDT
The fix patch should also cover the following bugs:

- bug 129567
- bug 181909