|
if scaling == "shrink": |
|
if not wrap.remaining_text: |
|
return None |
Code doesn't reach newline join
|
newline = "\n" if isinstance(self.text, str) else b"\n" |
|
self.text = newline.join(wrap.lines) |
Example:
width, height = 198, 228
text = "Master Librarian"
font = ImageFont.truetype("Courier.ttf", 30)
image_text = ImageText.Text(text, font)
image_text.stroke(width=0.7, fill="#ffffff")
a = image_text.wrap(width, height, scaling=("shrink", 20))
wrap = ImageText._Wrap(image_text, width, height, font)
print(repr(image_text.text), repr(a), repr(wrap.lines))
Outputs 'Master Librarian' None ['Master', 'Librarian']
Pillow/src/PIL/ImageText.py
Lines 221 to 223 in ec16a57
Code doesn't reach newline join
Pillow/src/PIL/ImageText.py
Lines 269 to 270 in ec16a57
Example:
Outputs
'Master Librarian' None ['Master', 'Librarian']