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
docs/ src/ tests/: Page.insert_htmlbox(): also down-scale to fit long words.
We use mupdf.FZ_PLACE_STORY_FLAG_NO_OVERFLOW with fz_place_story_flags().
Also updated test_htmlbox1() to match new behaviour where Page.insert_htmlbox()
returns with a small positive <height> on success.
Copy file name to clipboardExpand all lines: docs/page.rst
+14-4Lines changed: 14 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -847,14 +847,24 @@ In a nutshell, this is what you can do with PyMuPDF:
847
847
848
848
:returns: A tuple of floats `(spare_height, scale)`.
849
849
850
-
- `spare_height`: -1 if content did not fit, else >= 0. It is the height of the unused (still available) rectangle stripe. Positive only if scale = 1 (no down-scaling happened).
851
-
- `scale`: down-scaling factor, 0 < scale <= 1.
850
+
- spare_height: The (positive) height of the remaining space in `rect` below the
851
+
text, or -1 if we failed to fit.
852
+
- scale: The scaling required; `0 < scale <= 1`. Will be `scale_low`
853
+
if we failed to fit.
852
854
853
-
Please refer to examples in this section of the recipes: :ref:`RecipesText_I_c`.
855
+
Please refer to examples in this section of the recipes: :ref:`RecipesText_I_c`.
854
856
855
857
|history_begin|
856
858
857
-
* New in v1.23.8; rebased-only.
859
+
* New in v1.26.5:
860
+
861
+
* do additional scaling to fit long words.
862
+
*
863
+
If we succeeded and scaled down, the returned `spare_height` is now
864
+
generally positive instead of being fixed to zero, because the final
865
+
rect's height is usually not an exact multiple of the font line
Copy file name to clipboardExpand all lines: tests/test_textbox.py
+82-1Lines changed: 82 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,11 @@
7
7
"""
8
8
importpymupdf
9
9
10
+
importgentle_compare
11
+
12
+
importos
13
+
importtextwrap
14
+
10
15
# codespell:ignore-begin
11
16
text="""Der Kleine Schwertwal (Pseudorca crassidens), auch bekannt als Unechter oder Schwarzer Schwertwal, ist eine Art der Delfine (Delphinidae) und der einzige rezente Vertreter der Gattung Pseudorca.
0 commit comments