(mPDF >= 2.5)
Hyphenation was changed in mPDF 5.7 to support the CSS property hyphens (cf.)
The CSS property $hyphens is supported on block elements (e.g. <div>), inline elements (e.g. <span>) and <td/th>.
Default = manual
The default can be changed by altering $defaultCSS in config.php
Words are not broken at line breaks, even if characters inside the word suggest line break points.
Words are only broken at line breaks where there are characters inside the word that suggest line break opportunities. Characters can be explicit or conditional.
Words can be broken at appropriate hyphenation points, as determined by characters inside the word, resources.
SHY inside the word take priority over hyphenation points determined by other resources.
The soft-hyphen character (U+00AD or ­) and the <wbr> tag (from mPDF 5.7) are supported in WriteHTML().
Automatic hyphenation is set using CSS:
Automatic hyphenation is based on the commonly used TeX algorithm and requires pattern files for each language. The following languages are supplied with mPDF 2.5:
A pattern file for each language is found in the folder /patterns/ and the variable $SHYlanguages needs to be updated in config.php if any additions are made.
Pattern checking can be fine-tuned by 4 variables if required:
|$SHYleftmin||2||Minimum number of characters allowed to the left of a hyphen.|
|$SHYrightmin||2||Minimum number of characters allowed to the right of a hyphen.|
|$SHYcharmin||2||Minimum number of characters of words to be checked.|
|$SHYcharmax||10||Maximum number of characters in a pattern used for pattern checking (10 usually is more than enough). this is NOT the maximum length of words to be checked.|
If automatic hyphenation does not recognise a particular word, you can add words to a dictionary file with your own hyphenation. Edit the file “pathtoyourmpdf/patterns/dictionary.txt” and add a new line for each word, marking the possible hyphenations with a forward slash. You can mark more than one place for each word e.g. “dis/es/tab/lish/men/tar/i/an/ism”
- SHYlang - Specify the language to use for automatic hyphenation