From ca9b3fae676d03384f4d7454bfad1883c00edd49 Mon Sep 17 00:00:00 2001 From: rysson Date: Sun, 23 Jul 2023 15:15:07 +0200 Subject: [PATCH] Update docs about NBSP (#834) --- CHANGELOG.md | 1 + docs/Text.md | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fda90ac23..2eb10e38c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default', - [`FPDF.table()`](https://pyfpdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.table): the `colspan` setting has been fixed - [documentation](https://pyfpdf.github.io/fpdf2/Tables.html#column-span) - [`FPDF.image()`](https://pyfpdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.image): allowing images path starting with `data` to be passed as input - the initial text color is preserved when using `FPDF.write_html()` - _cf._ [issue #846](https://github.com/PyFPDF/fpdf2/issues/846) +- variable-width non-breaking space support [issue #834](https://github.com/PyFPDF/fpdf2/issues/834) ### Deprecated - the `center` optional parameter of [`FPDF.cell()`](https://pyfpdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.cell) is **no more** deprecated, as it allows for horizontal positioning, which is different from text alignment control with `align="C"` diff --git a/docs/Text.md b/docs/Text.md index 45c737269..094d531be 100644 --- a/docs/Text.md +++ b/docs/Text.md @@ -32,8 +32,9 @@ fixed_text = get_display(reshape(some_text)) ``` ### Character or Word Based Line Wrapping -By default, `multi_line()` and `write()` will wrap lines based on words, using space characters and soft hyphens as seperators. -For languages like Chinese and Japanese, that don't usually seperate their words, character based wrapping is more appropriate. +By default, `multi_line()` and `write()` will wrap lines based on words, using space characters and soft hyphens as separators. +Non-breaking spaces (\U00a0) do not trigger a word wrap, but are otherwise treated exactly as a normal space character. +For languages like Chinese and Japanese, that don't usually separate their words, character based wrapping is more appropriate. In such a case, the argument `wrapmode="CHAR"` can be used (the default is "WORD"), and each line will get broken right before the character that doesn't fit anymore.