From 8e3857d46e647ab3184512938fbd08e4a91327ff Mon Sep 17 00:00:00 2001 From: Lucas Cimon <925560+Lucas-C@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:57:13 +0200 Subject: [PATCH] Adding warning in documentation for issue #1090 (#1249) --- docs/PageBreaks.md | 2 ++ docs/TextShaping.md | 15 ++++++++------- docs/index.md | 3 ++- docs/overrides/main.html | 8 ++++---- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/PageBreaks.md b/docs/PageBreaks.md index c46e0cc9e..2cae0bb8d 100644 --- a/docs/PageBreaks.md +++ b/docs/PageBreaks.md @@ -21,6 +21,8 @@ Simply call `.add_page()`. The special string `{nb}` will be substituted by the total number of pages on document closure. This special value can changed by calling [alias_nb_pages()](fpdf/fpdf.html#fpdf.fpdf.FPDF.alias_nb_pages). +!!! warning "This is currently incompatible with [text shaping](./TextShaping.md).
_cf._ [GitHub issue #1090](https://github.com/py-pdf/fpdf2/issues/1090)" + ## will_page_break ## `will_page_break(height)` lets you know if adding an element will trigger a page break, diff --git a/docs/TextShaping.md b/docs/TextShaping.md index 08647d7c5..01f8aca71 100644 --- a/docs/TextShaping.md +++ b/docs/TextShaping.md @@ -2,6 +2,8 @@ _New in [:octicons-tag-24: 2.7.5](https://github.com/py-pdf/fpdf2/blob/master/CHANGELOG.md)_ +!!! warning "This is currently incompatible with [the special `{nb}` string](./PageBreaks.md) that inserts the number of pages.
_cf._ [GitHub issue #1090](https://github.com/py-pdf/fpdf2/issues/1090)" + ## What is text shaping? ## Text shaping is a fundamental process in typography and computer typesetting that influences the aesthetics and readability of text in various languages and scripts. It involves the transformation of Unicode text into glyphs, which are then positioned for display or print. @@ -32,8 +34,6 @@ Another common use of glyph substitution is to replace a sequence of characters ![](text-shaping-substitution.png) - - ## Usage ## Text shaping is disabled by default to keep backwards compatibility, reduce resource requirements and not make uharfbuzz a hard dependency. @@ -87,20 +87,21 @@ Direction can be `ltr` (left to right) or `rtl` (right to left). The `ttb` (top [Valid OpenType language codes](https://learn.microsoft.com/en-us/typography/opentype/spec/languagetags) -# Bidirectional Text # + +## Bidirectional Text # _New in [:octicons-tag-24: 2.7.8](https://github.com/py-pdf/fpdf2/blob/master/CHANGELOG.md)_ Bidirectional text refers to text containing both left-to-right (LTR) and right-to-left (RTL) language scripts. Languages such as Arabic, Hebrew, and Persian are written from right to left, whereas languages like English, Spanish, and French are written from left to right. The Unicode Bidirectional Algorithm is a set of rules defined by the Unicode Consortium to properly display mixed-directional text. This algorithm ensures that characters are shown in their correct order, preserving the logical sequence of the text. -## Unicode Bidirectional Algorithm ## +### Unicode Bidirectional Algorithm ## The Unicode Bidirectional Algorithm, often abbreviated as the *Bidi* Algorithm, is essential for displaying text containing both RTL and LTR scripts. It determines the directionality of characters and arranges them in a visually correct order. This algorithm takes into account the inherent directionality of characters (such as those in Arabic or Hebrew being inherently RTL) and the surrounding context to decide how text should be displayed. -## Paragraph direction ## +### Paragraph direction ## ![](bidi_paragraph.svg) -## Bidirectional text in fpdf2 ## +### Bidirectional text in fpdf2 ## fpdf2 will automatically apply the unicode bidirectional algorithm if text shaping is enabled. If no `direction` parameter is provided - or `direction` is `None` - paragraph direction will be set according to the first directional character present on the text. @@ -109,4 +110,4 @@ If there is a need to explicitly set the direction of a paragraph, regardless of ```python fpdf.set_text_shaping(use_shaping_engine=True, direction="rtl") -``` \ No newline at end of file +``` diff --git a/docs/index.md b/docs/index.md index a58d54b79..aa17e9db9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -101,6 +101,8 @@ or [open a discussion](https://github.com/py-pdf/fpdf2/discussions). ### They use fpdf2 ### +Online classes & open source projects: + * **Harvard University** uses `fpdf2` in their [CS50 introductory class](https://cs50.harvard.edu/python/2022/psets/8/shirtificate/) * [Undying Dusk](https://lucas-c.itch.io/undying-dusk) : a **video game in PDF format**, with a gameplay based on exploration and logic puzzles, in the tradition of dungeon crawlers * [OpenDroneMap](https://github.com/OpenDroneMap/ODM) : a command line toolkit for processing aerial drone imagery @@ -111,7 +113,6 @@ or [open a discussion](https://github.com/py-pdf/fpdf2/discussions). `fpdf2` also has a demo script to convert a GIF into a one-page-per-frame PDF: [gif2pdf.py](https://github.com/py-pdf/fpdf2/blob/master/tutorial/gif2pdf.py) * [csv2pdf](https://github.com/TECH-SAVVY-GUY/csv2pdf) : convert CSV files to PDF files easily * [Planet-Matriarchy-RPG-CharGen](https://github.com/ShawnDriscoll/Planet-Matriarchy-RPG-CharGen) : a PyQt based desktop application (= `.exe` under Windows) that provides a RPG character sheet generator -* [Petleo GMBH](https://petleo.net) : a software company that offers digital solutions for veterinarians, pet owners and pet service providers. ### Usage statistics diff --git a/docs/overrides/main.html b/docs/overrides/main.html index d0addc4ca..42dbbce62 100644 --- a/docs/overrides/main.html +++ b/docs/overrides/main.html @@ -1,11 +1,11 @@ {% extends "base.html" %} {% block announce %} -
- - New release: 2.7.9 on 2024/05/17 + {% endblock %} {% block extrahead %}