@@ -760,7 +760,7 @@ def add_font(self, family, style="", fname=None, uni=False):
760
760
761
761
# Check if font already added or one of the core fonts
762
762
if fontkey in self .fonts or fontkey in self .core_fonts :
763
- warnings .warn ("Core font or font already added: doing nothing" )
763
+ warnings .warn (f "Core font or font already added ' { fontkey } ' : doing nothing" )
764
764
return
765
765
if uni :
766
766
for parent in ("." , FPDF_FONT_DIR , SYSTEM_TTFONTS ):
@@ -1082,6 +1082,11 @@ def rotation(self, angle, x=None, y=None):
1082
1082
The rotation affects all elements which are printed inside the indented context
1083
1083
(with the exception of clickable areas).
1084
1084
1085
+ Args:
1086
+ angle (float): angle in degrees
1087
+ x (float): abscissa of the center of the rotation
1088
+ y (float): ordinate of the center of the rotation
1089
+
1085
1090
Notes
1086
1091
-----
1087
1092
@@ -1214,18 +1219,15 @@ def cell(self, w, h=0, txt="", border=0, ln=0, align="", fill=False, link=""):
1214
1219
s += (
1215
1220
f"BT 0 Tw { (self .x + dx ) * k :.2F} "
1216
1221
f"{ (self .h - self .y - 0.5 * h - 0.3 * self .font_size ) * k :.2F} "
1217
- f "Td ["
1222
+ "Td ["
1218
1223
)
1219
1224
1220
- t = txt .split (" " )
1221
- numt = len (t )
1222
- for i in range (numt ):
1223
- tx = t [i ]
1224
- tx = enclose_in_parens (
1225
- escape_parens (tx .encode ("UTF-16BE" ).decode ("latin-1" ))
1226
- )
1227
- s += f"{ tx } "
1228
- if (i + 1 ) < numt :
1225
+ words = txt .split (" " )
1226
+ for i , word in enumerate (words ):
1227
+ word = escape_parens (word .encode ("UTF-16BE" ).decode ("latin-1" ))
1228
+ s += f"({ word } ) "
1229
+ is_last_word = (i + 1 ) == len (words )
1230
+ if not is_last_word :
1229
1231
adj = - (self .ws * self .k ) * 1000 / self .font_size_pt
1230
1232
s += f"{ adj } ({ space } ) "
1231
1233
s += "] TJ"
@@ -1237,7 +1239,6 @@ def cell(self, w, h=0, txt="", border=0, ln=0, align="", fill=False, link=""):
1237
1239
self .current_font ["subset" ].append (ord (char ))
1238
1240
else :
1239
1241
txt2 = escape_parens (txt )
1240
-
1241
1242
s += (
1242
1243
f"BT { (self .x + dx ) * k :.2f} "
1243
1244
f"{ (self .h - self .y - 0.5 * h - 0.3 * self .font_size ) * k :.2f} "
@@ -1326,8 +1327,8 @@ def multi_cell(
1326
1327
(in any order):
1327
1328
`L`: left ; `T`: top ; `R`: right ; `B`: bottom. Default value: 0.
1328
1329
align (str): Allows to center or align the text. Possible values are:
1329
- `L` or empty string: left align (default value) ; `C`: center ;
1330
- `R`: right align
1330
+ `J`: justify (default value); `L` or empty string: left align ;
1331
+ `C`: center ; ` R`: right align
1331
1332
fill (bool): Indicates if the cell background must be painted (`True`)
1332
1333
or transparent (`False`). Default value: False.
1333
1334
split_only (bool): if `True`, does not output anything, only perform
0 commit comments