Bug 152083 - Ligatures are incorrectly reversed opening RTL PDF files
Summary: Ligatures are incorrectly reversed opening RTL PDF files
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.5.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.5.0 target:7.4.4
Keywords:
Depends on:
Blocks: PDF-Import-Draw RTL CTL
  Show dependency treegraph
 
Reported: 2022-11-17 11:34 UTC by Hossein
Modified: 2024-08-03 09:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Arabic/Persian ligatures (12.12 KB, application/vnd.oasis.opendocument.text)
2022-11-17 11:34 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2022-11-17 11:34:57 UTC
Created attachment 183641 [details]
Arabic/Persian ligatures

Description:
After previous fixes in tdf#104597 by Kevin, in many cases RTL text from PDF files are imported correctly, but this is not the case for all possible RTL text. Specially, ligatures like لا and الله are incorrectly reversed.


Steps to Reproduce:
1. Open ODT attachment
2. Export it to PDF via Writer
3. Open the PDF file in Draw

Actual Results:
Ligatures like لا and الله are loaded incorrectly.


Expected Results:
The text shown in Draw should be the same as the text in the ODT file


Reproducible: Always


User Profile Reset: No


Additional Info:
Version: 7.5.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 783bc24136929f1dc7b3d49b01794df627cc0bdb
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Buovjaga 2022-11-17 13:16:32 UTC
Repro

Arch Linux 64-bit
Version: 7.5.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b57307e8f3553fcb292c9c11fcf58bcef3a6cb3c
CPU threads: 8; OS: Linux 6.0; UI render: default; VCL: gtk3
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 8 November 2022
Comment 2 Kevin Suo 2022-11-19 16:43:13 UTC
The below change on gerrit could fix this issue:
https://gerrit.libreoffice.org/c/core/+/142978
Comment 3 Commit Notification 2022-11-25 07:45:14 UTC
Kevin Suo committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3a2f0e4772e7b4646dd518b33aeafb6fd7025179

Resolves tdf#152083: Ligatures are incorrectly reversed in Draw pdf import

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2022-11-25 16:49:36 UTC
Kevin Suo committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/9c29107a2590e8ccc92e6ae6445beff186f38511

Resolves tdf#152083: Ligatures are incorrectly reversed in Draw pdf import

It will be available in 7.4.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Hossein 2022-11-26 02:07:45 UTC
Thanks Kevin!

This is fixed in Draw and Impress. Could you please also fix the same problem in Writer?

I've tested opening the file in writer by choosing "PDF - Portable Document Format (Writer)" as the file type, and the problem was still there.

Version: 7.5.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 3b0b9fcb80242abcedc01eb388a57b1016916353
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 6 Kevin Suo 2022-11-26 13:14:40 UTC
(In reply to Hossein from comment #5)
> ould you please also fix the same problem in Writer?
Yes, but I think there are some cleanups needed in DrawXmlOptimizer::optimizeTextElements. So will do fix this issue on Writer after the cleanups are done to avoid back-and-forth revision of the code in writertreevisiting.cxx.
Comment 7 Kevin Suo 2022-12-03 02:13:27 UTC
Done for Writer in:
https://gerrit.libreoffice.org/c/core/+/143606

But as you may see, there is another problem with this for Writer - The spaces tween rtl and non-rtl frames seems wrong. This may be a separate issue since it exists before the change #143606.
Comment 8 Commit Notification 2022-12-04 14:54:46 UTC
Kevin Suo committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/842e3b988aca27d7c9f71ce1efc6653271cc3430

tdf#152083 related: make the isComplex check block as a separate function

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2022-12-04 20:00:23 UTC
Kevin Suo committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/616c4c6bcb5ddeb932cf1e154f0a1a79c6a8bd45

tdf#152083: sdext Pre-reverse the text for RTL in Writer pdfimport as well

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 ⁨خالد حسني⁩ 2023-06-26 13:14:49 UTC
Is this fixed now?
Comment 11 Hossein 2023-06-26 13:34:41 UTC
(In reply to ⁨خالد حسني⁩ from comment #10)
> Is this fixed now?
Yes.
I see that the problem is not there in LO 24.2 master. Both Impress and Writer show the PDF text correctly.

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 2ef138de767c312188d41a7f206234eafac3108b
CPU threads: 12; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded