When creating a multilingual document containing Arabic, Indic, CJK, Vietnamese or Thai languages, the text in these languages needs to be identified in order to correctly display them using appropriate fonts.
Marking up your HTML text using the lang attribute is one way to do this. The attribute can be used on any block or
in-line tag e.g.
<div lang="zh-CN">....</div> or
<span lang="ru">...</span>. It is also
Important: Support for the attribute $lang is only active when the variable
$useLang is set to
The language codes supported are determined by config_cp.php :
- en, ca, cy, da, de, es, eu, fr, ga, fi, is, it, nl, no, pt, sv
- cs, hr, hu, pl, ro, sk, sl
- bg, mk, ru, sr, uk
- et, kl, lt, lv
- el, tr
- vi, th
- CJK: ja, zh, zh-CN, zh-HK, zh-TW, ko
- RTL: he, ar, fa, ps, ur, sd
- INDIC: as, bn, gu, hi, kn, ks, ml, ne, or, pa, sd-IN, ta, te
Codes such as
'en-US' are supported, and interpreted as
When a language is set, the following happens (determined by function
- available fonts are restricted to those which contain the necessary glyphs to display this language
- justification type (
jSpacingmPDF < 5.1) is set when a block tag has the property
text-align: justify;for span/inline elements the justification is disabled for the enclosing block element.
Note: Automatic language detection using
will detect language use in the text passed to mPDF, and add
<span lang="xx" class="lang_xx">..</span> tags to mark up.
Using automatic language detection may add to the processing time when creating a large document.