cherrytree icon indicating copy to clipboard operation
cherrytree copied to clipboard

RTL export broken

Open Man-with-Arrow opened this issue 2 years ago • 4 comments

Version, Operative system v0.99.47, Fedora 35. Bug has been present since I started using Cherrytree on Debian 8, around 2015.

Describe the bug Documents in RTL script are exported as LTR.

To Reproduce Create a new node with any RTL script. Note that Cherrytree renders it perfectly fine. Export to PDF or HTML. Notice that it's now aligned as LTR - punctuation and characters are fine.

Screenshots Screenshot from 2022-05-14 15-46-56 Screenshot from 2022-05-14 15-47-34

Potential Solution

After exporting to HTML, adding dir=rtl to the exported HTML's <head> makes the whole file RTL, and breaks LTR paragraphs. A solution could be to add the dir attribute to each paragraph on export, according to the detected alignment in Cherrytree itself.

Man-with-Arrow avatar May 14 '22 12:05 Man-with-Arrow

can you attach to the issue a sample cherrytree document with mixed RTL and LTR text so I'll try and fix at least the html export

giuspen avatar May 20 '22 19:05 giuspen

Of course. Please let me know if there's anything else I can do to help!

Man-with-Arrow avatar May 21 '22 10:05 Man-with-Arrow

FIY, @giuspen - as of commit 446f5cc, there are very marked improvements! HTML export does indeed seem complete, while PDF export is almost there - at least for me, lines that start in LTR and also contain RTL (or vice-versa) have the wrong alignment for the second type.

Major props to you for being so responsive and fixing this issue!

Man-with-Arrow avatar Jun 13 '22 17:06 Man-with-Arrow

Yes I'm getting there with the pdf too, even though much more difficult than the html. Good that you keep an eye, so when I'll declare it complete some testing will help. I think it will take few more commits.

giuspen avatar Jun 13 '22 21:06 giuspen