Synopse PDF engine 1.7.2
The Unicode part of the Synopse PDF engine has been updated in order to support right-to-left languages and ligatures (i.e. glyph shaping).
Therefore, our Open Source engine is one of the few PDF producer able to natively handle Arabic languages. Even most commercial engines don't implement this nice feature.
"Glyph Shaping" is needed e.g. for Arabic language, because the character change its shape depending on its position in the word.
The Synopse PDF engine can now optionally call the Windows Uniscribe API, to render Ordering (e.g. Left to Right direction) and Shaping of the text. The USE_UNISCRIBE conditional must be defined, and the UseUniscribe property of the TPdfDocument class must be set to true.
The UseUniscribe property can be temporary to TRUE, when using the Canvas property, then back to FALSE when the Uniscribe API is not needed any more. Windows Uniscribe library can be slower, that's the reason why it is disabled by default.
Note that the UseUniscribe property must be set appropriately before the content generation if you use any TPdfDocumentGdi.VCLCanvas text output with such scripting (since the PDF rendering is done once just before the saving, e.g. before SaveToFile() or SaveToStream() methods calls).
Our Synopse PDF engine don't handle Font Fallback yet: the font you use must contain ALL glyphs necessary for the supplied unicode text - squares or blanks will be drawn for any missing glyph/character.
Using the Windows Uniscribe API is working very well (it is used internaly by Windows for drawing complex text), is almost well documented on MSDN, but there are very few sample code available. So writing this code was not so easy... but I hope it will be useful for some users! Thanks Mahammed Nasman for your comments and link to the MSDN site!
You can download the updated full source code of this unit, with other
needed Synopse units, from synpdf.zip licensed under a
The Unicode sample code has been updated also, and can be downloaded from here.
Here is the resulting PDF content. Feedback is welcome!