Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically inserting page-progression-direction="rtl" in rtl languages ​​(Arabic and Hebrew) #2592

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

zevisvei
Copy link

I would also like to add that the text direction will automatically be right to left, but I didn't find where exactly this is defined in the code

Another thing I would like to do - when converting a pdf to text in rtl languages, the text is completely reversed, meaning that the order of the letters is also left to right, but I would need some guidance on where this is defined in the code

Thank you very much and Happy New Year

@kovidgoyal
Copy link
Owner

You cant do this in opf2/oeb classes are they are used by all formats not just EPUB. Instead you do it in the plugins/epub_output.py file. There check if page progression direction is unset and set it based on book language instead.

For PDF output you would need to modify the PDF output plugin to set the dir attribute based on detected language for each parapgraph/span/whatever.

@zevisvei
Copy link
Author

zevisvei commented Jan 1, 2025

@kovidgoyal
Is this good?
If I put it in the opf2/oeb classes, could it cause problems?, I'm asking because the definition of the scroll direction is common to several formats, so it might be worth putting it within these classes.
Regarding the pdf, the problem is that when the input is pdf, the text itself is reversed, meaning that instead of abcd it appears as dcba.

@kovidgoyal
Copy link
Owner

Yes that should be fine. I dont want it done automatically in opf2/oeb as these are used in a lot of places and doing it automatically could break something somewhere.

As for your PDF issue do you mean the text output by pdftohtml (which calibre uses) is reversed? If so then you should report it to the pdftohtml project (aka poppler).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants