I am generating multi-lingual PDF using Apache FOP 2.5, including Latin, Cyrillic and Arabic characters. I managed to include the proper fonts, and I was able to deal with the right-to-left display for Arabic, when needed.
However I am facing an issue with letter-spacing in Arabic characters : the characters are spaced out from each other. This is what I see in the generated PDF
But this is what I have in the original XML (please note how the Arabic characters are close to each other) :
I am using the Deja Vu font and I have computed the metrics of the font using what is described here.
How can I solve this ?
I have read this article which basically inserts letter-spacing="-2pt"
everytime the string to be displayed is in Arabic. But I don't want to hardcode tests on the language in the stylesheet.
Any help appreciated !
EDIT :
- Using FOP 2.5
- I confirm that
complex-script
is enabled (added a debug message to be sure) - I had set
kerning="yes"
set in the config file
Thanks to the very valuable comments received, I was able to solve the problem by :
In the meanwhile I saw that embedding the fonts in my application was more difficult in FOP 2.5 than in FOP 1.1 because it is harder to set relative URLs in FOP font configuration. I was able to solve this with this other answer.