Forum Feature requests

Right to Left (RTL) text support

keerat
While Prince allows for internationalized fonts to be imported and used, a known issue is the lack of Right to Left support. This inhibits the ability to convert legal, working HTML+CSS in Arabic or Hebrew to PDF. For systems with a global reach, trying to leverage Prince as their PDF solution, this is a substantial issue.

Is there an ETA on this functionality?
mikeday
We would love to support right-to-left text, but it is probably going to have to wait until Prince 7.0, as it's a complex feature that affects a lot of things. For example, our text handling and line breaking would need to be changed to correctly handle spans of right-to-left Hebrew text within a left-to-right Latin paragraph. We can do this, but it's non-trivial, and there are several simpler and higher priority issues we need to fix first.
keerat
Thanks for the info.
jstallent
I just wanted to bump this request to the top and see if it is still on the list for Prince 7.0. Also, is 7.0 even on the radar right now?

Thanks!
mikeday
It certainly is, and will support Hebrew, Arabic and Hindi at the very least. If you would like to take it for an early test run we may be able to provide you with an alpha build, depending on what platform you are running on.
jbarrus
Just to add to this, I would love to have vertical text be a possibility.
jstallent
mikeday wrote:
It certainly is, and will support Hebrew, Arabic and Hindi at the very least. If you would like to take it for an early test run we may be able to provide you with an alpha build, depending on what platform you are running on.


That would be great! I am working on a book right now that has Hebrew. I am running Windows Vista.
mikeday
Here is an early alpha release of Prince 7.0 that includes support for Arabic, Hebrew, and Hindi:

prince-7.0a8-setup.exe

Let us know how it goes! :)
hossein
I've tested it today. In Arabic support, there are at least 2 faults:
1. In Arabic, some words do not join to the letter that comes after them. For example: Alef, Daal, Zaal, Reh, Zeh, Vav, ... . But Prince wrongly tries to join the next character to these letters. Also, Alef does not join properly to previous letter.
2. Rather than UTF-8, Arabic encodings like windows-1256 are not supported.
hossein
For an example, see this picture (I've underlined wrong parts):



For more information, please see chapter 8 of the Unicode manual at:
http://unicode.org/versions/Unicode5.0.0/ch08.pdf
mikeday
Thanks for testing! Which font did you use to create this sample image?
hossein
I tested Prince with various fonts and the problem is always there, but this is my test case for above picture:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>My title</title>
</head>
<body dir="rtl">
<h1>My title</h1>
<p>First Line.<p>
<p>Second Line.</p>
<p>Third Line.</p>
<p>Fourth Line.</p>
</body>
</html>


I didn't set any font family, so Prince used "Times New Roman" as the default font. I changed the text because I couldn't paste utf-8 HTML here. Just copy and paste some text from an Arabic or Persian website (like Wikipedia). That would be fine for testing.
mikeday
Thanks, we'll check this out.
hossein
I forgot to say about another problem. Sometimes after reading parts of the Unicode document (with UTF-8 encoding), PrinceXML falls back on one-byte western encoding and shows wrong characters, because of interpreting two byte characters as 1-byte characters.
If it's needed, I can provide samples for this. My tests where done using prince-7.0a8, just like above problem.
mikeday
Please email me (mikeday@yeslogic.com) a sample. We do know of some issues with some HTML documents, but XML should not have any encoding problems.
jbarrus
I am trying to use hebrew text and have a problem with the points being moved slightly to the left. In the image below, the top line is the correct rendering. I am using Ezra SIL font. I am using Prince 7 linked to above.


mikeday
Rendering the vowel marks in the correct position requires support for OpenType positioning, which we will be adding to Prince for the next release.
mikeday
Hi all,

We have created a new test build of Prince that supports correct alignment of vowel marks and other diacriticals using the OpenType layout features. It also fixes the Arabic shaping bugs.

prince-7.0a10-setup.exe
prince-7.0a10-linux.tar.gz

Please give it a try and let us know how it goes! :D
jbarrus
Fantastic, thanks a lot. I tested the new version with Hebrew characters and it works great. Is there any kind of ETA for Prince 7?
mikeday
Not yet, as there are more font and i18n features we need to work on. However, you're welcome to keep using this alpha version, which should be quite stable.
mikeday
The first beta for Prince 7.0 is now available, and includes support for bidirectional text layout and OpenType fonts with advanced layout features. It supports Arabic, Hebrew, Hindi and other Indic scripts.
bookdev
Since Prince supports RTL text for languages like Arabic and Hebrew, does it also support RTL page progression so the PDF prints properly? That is, the first page of the PDF becomes the last page, etc. If so, could you please be so kind as to let me know the CSS property to effect this? If not, any idea how to reverse the PDF's page order, if it's not too much trouble?
mikeday
Prince has no reverse page order yet, this would require a separate third-party PDF tool like Acrobat.
jim_albright
The latest CSS has some math ability in it I believe. So maybe we could do
page-total - current-page + 1 to display the correct page number.

Jim Albright
Wycliffe Bible Translators

hughmcguire
hi mike any news on reverse page numbering?
mikeday
Perhaps you could use prince-script(counter(page), counter(pages)) and do the subtraction in JavaScript? :)