You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Text.md
+6-14
Original file line number
Diff line number
Diff line change
@@ -11,25 +11,17 @@ There are several ways in fpdf to add text to a PDF document, each of which come
11
11
| [`.write_html()`](#write_html) | several | no | yes | auto | An extension to `.write()`, with additional parsing of basic HTML tags.
12
12
13
13
## Typography and Language Specific Concepts
14
+
### Supported Features
15
+
With supporting Unicode fonts, fpdf2 should handle the following text shaping features correctly. More details can be found in [TextShaping](TextShaping.html).
16
+
* Automatic ligatures / glyph substitution - Some writing systems (eg. most Indic scripts such as Devaganari, Tamil, Kannada) frequently combine a number of written characters into a single glyph. In latin script, "ff", "fi", "ft", "st" and others are often combined. In programming fonts "<=", "++" "!=" etc. may be combined into more compact representations.
17
+
* Special diacritics that use separate code points (eg. in Diné Bizaad, Hebrew) will be placed in the correct location relative to their base character.
18
+
* Kerning, where the spacing between characters varies depending on their combination (eg. moving the succeeding lowercase character closer to an uppercase "T".
19
+
* Left-to-right and right-to-left text formatting (the latter most prominently in Arabic and Hebrew).
14
20
15
21
### Limitations
16
22
There are a few advanced typesetting features that fpdf doesn't currently support.
17
-
18
-
* Automatic ligatures - Some writing systems (eg. most Indic scripts such as Devaganari, Tamil, Kannada) frequently combine a number of written characters into a single glyph. This would require advanced font analysis capabilities, which aren't currently implemented.
19
23
* Contextual forms - In some writing systems (eg. Arabic, Mongolian, etc.), characters may take a different shape, depending on whether they appear at the beginning, in the middle, or at the end of a word, or isolated. Fpdf will always use the same standard shape in those cases.
20
24
* Vertical writing - Some writing systems are meant to be written vertically. Doing so is not directly supported. In cases where this just means to stack characters on top of each other (eg. Chinese, Japanese, etc.), client software can implement this by placing each character individuall at the correct location. In cases where the characters are connected with each other (eg. Mongolian), this may be more difficult, if possible at all.
21
-
* Right-to-Left writing - Letters of scripts that are written right to left(eg. Arabic, Hebrew) appear in the wrong order
22
-
* Special Diacritics - Special diacritics that use separate code points (eg. in Diné Bizaad, Hebrew) appear displaced
23
-
24
-
### Right-to-Left & Arabic Script workaround
25
-
For Arabic and RTL scripts there is a temporary solution (using two additional libraries `python-bidi` and `arabic-reshaper`) that works for most languages; only a few (rare) Arabic characters aren't supported. Using it on other scripts(eg. when the input is unknown or mixed scripts) does not affect them:
26
-
```python
27
-
from arabic_reshaper import reshape
28
-
from bidi.algorithm import get_display
29
-
30
-
some_text ='اَلْعَرَبِيَّةُכַּף סוֹפִית'
31
-
fixed_text = get_display(reshape(some_text))
32
-
```
33
25
34
26
### Character or Word Based Line Wrapping
35
27
By default, `multi_line()` and `write()` will wrap lines based on words, using space characters and soft hyphens as seperators.
0 commit comments