mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-10 05:15:05 +08:00
Update nodes.py
This commit is contained in:
parent
051c3fcd9a
commit
bdc5a71e8a
6
nodes.py
6
nodes.py
@ -744,12 +744,10 @@ creates animation between them.
|
|||||||
try: #new pillow
|
try: #new pillow
|
||||||
# Iterate through words to create lines
|
# Iterate through words to create lines
|
||||||
for word in words:
|
for word in words:
|
||||||
left, _, right, _ = font.getbbox(word)
|
word_width = font.getbbox(word)[2]
|
||||||
font_width = right - left
|
|
||||||
word_width = font_width * len(word) # Assuming each character is the same width
|
|
||||||
if current_line_width + word_width <= width - 2 * text_x:
|
if current_line_width + word_width <= width - 2 * text_x:
|
||||||
current_line.append(word)
|
current_line.append(word)
|
||||||
current_line_width += word_width + font_width # Add space width
|
current_line_width += word_width + font.getbbox(" ")[2] # Add space width
|
||||||
else:
|
else:
|
||||||
lines.append(" ".join(current_line))
|
lines.append(" ".join(current_line))
|
||||||
current_line = [word]
|
current_line = [word]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user