DynaPDF Manual - Page 52
Previous Page 51 Index Next Page 53
Complex Text Layout
Page 52 of 821
Complex Text Layout
Support for complex text layout is required for languages like Arabic, Thai, Devanagari, Lao,
and many others. At time of publication DynaPDF supports complex text layout on Windows
The implementation in DynaPDF based on Microsofts Uniscribe. This is the Unicode library that
is used behind the scenes in almost all Windows controls and Unicode aware applications.
Complex text layout depends on the availability of OpenType fonts. Most fonts which are
delivered with Windows are OpenType fonts.
How to enable Complex Text Layout?
Complex text layout can be enable with the flag gfComplexText with SetGStateFlags(). Please
note that this feature requires DynaPDF Professional or higher.
Automatic Font Substitution
A major feature of complex text layout is called Automatic Font Substitution. That means if the
current font doesn't support the requested script, it will be automatically changed if another
font is available that supports it.
Although automatic font substitution produces often good results without further interaction, a
human would often use another font. In order to improve automatic font substitution it is
possible to create one or more alternate font lists. The active list of alternate fonts is tested
before any system font. This makes it possible to improve automatic font substitution because
humans have usually a better knowledge which fonts are common in their region.
In simple text layout, only one font is used to output a line of text. In complex text layout it is
generally possible that more than one font is used, e.g. if a piece of text is not supported by the
However, automatic font substitution can be implemented in many different ways. Some
applications try to replace the font whenever a glyph cannot be found. Others change the font
only for entire words or sentences. The challenge is to make all requested glyphs available
without embedding a huge number of fonts and without requiring too much processing time.
DynaPDF changes a font only for entire script items. A script item is a run of characters with
compatible properties and with the same direction. This is a good compromise between speed,
document size, and resulting output quality.
Alternate font lists
Automatic font substitution can be improved by setting an alternate font list with fonts which
support the language that must be output. It is possible to create several different lists, e.g. for
different font styles or languages.
Previous topic: Compiling DynaPDF on macOS, Compiling with XCode, Compiling on the Command Line
Next topic: Font embedding, Complex text layout and form fields