Skip to content

Commit

Permalink
Doc: mention that text() does lack features (py-pdf#1265)
Browse files Browse the repository at this point in the history
* adept comparison table in Text.md (add text shaping)
* add a note in the functions doc string
  • Loading branch information
bmiklautz committed Sep 30, 2024
1 parent 90c7d7f commit 8057e2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
14 changes: 7 additions & 7 deletions docs/Text.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ There are several ways in fpdf to add text to a PDF document, each of which come

## Simple Text Methods

| method | lines | markdown support | HTML support | accepts new current position | details |
| -- | :--: | :--: | :--: | :--: |-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`.text()`](#text) | one | no | no | fixed | Inserts a single-line text string with a precise location on the base line of the font. |
| [`.cell()`](#cell) | one | yes | no | yes | Inserts a single-line text string within the boundaries of a given box, optionally with background and border. |
| [`.multi_cell()`](#multi_cell) | several | yes | no | yes | Inserts a multi-line text string within the boundaries of a given box, optionally with background, border and padding. |
| [`.write()`](#write) | several | no | no | auto | Inserts a multi-line text string within the boundaries of the page margins, starting at the current x/y location (typically the end of the last inserted text). |
| [`.write_html()`](#write_html) | several | no | yes | auto | An extension to `.write()`, with additional parsing of basic HTML tags.
| method | lines | markdown support | HTML support | text shaping | accepts new current position | details |
| -- | :--: | :--: | :--: | :--: | :--: |-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`.text()`](#text) | one | no | no | no | fixed | Inserts a single-line text string with a precise location on the base line of the font. |
| [`.cell()`](#cell) | one | yes | no | yes | yes | Inserts a single-line text string within the boundaries of a given box, optionally with background and border. |
| [`.multi_cell()`](#multi_cell) | several | yes | yes | yes | yes | Inserts a multi-line text string within the boundaries of a given box, optionally with background, border and padding. |
| [`.write()`](#write) | several | no | no | yes | auto | Inserts a multi-line text string within the boundaries of the page margins, starting at the current x/y location (typically the end of the last inserted text). |
| [`.write_html()`](#write_html) | several | no | no | yes | auto | An extension to `.write()`, with additional parsing of basic HTML tags.

## Flowable Text Regions

Expand Down
9 changes: 8 additions & 1 deletion fpdf/fpdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def set_encryption(
permissions=AccessPermission.all(),
encrypt_metadata=False,
):
""" "
"""
Activate encryption of the document content.
Args:
Expand Down Expand Up @@ -2551,6 +2551,13 @@ def text(self, x, y, text=""):
y (float): ordinate of the origin
text (str): string to print
txt (str): [**DEPRECATED since v2.7.6**] string to print
Notes
-----
`text()` is kept for backwards compatibility. It lacks many of the
features available in `FPDF.write()`, `FPDF.cell()` and `FPDF.multi_cell()`
like markdown and text shaping.
"""
if not self.font_family:
raise FPDFException("No font set, you need to call set_font() beforehand")
Expand Down

0 comments on commit 8057e2b

Please sign in to comment.