Spaces:
Running
Running
ChenyuRabbitLove
commited on
Commit
•
a1f2ff4
1
Parent(s):
35e2d47
bugfix: fix minor bugs
Browse files
utils/completion_reward.py
CHANGED
@@ -485,12 +485,13 @@ class ImageProcessor:
|
|
485 |
# Draw the text
|
486 |
title_font = ImageFont.truetype("NotoSansTC-Bold.ttf", 34)
|
487 |
body_font = ImageFont.truetype("NotoSansTC-Light.ttf", 14)
|
|
|
488 |
# Calculate space required by the paragraph
|
489 |
paragraph_height = 0
|
490 |
for line in paragraph.split("\n"):
|
491 |
wrapped_lines = textwrap.wrap(line, width=60)
|
492 |
for wrapped_line in wrapped_lines:
|
493 |
-
line_height = draw.
|
494 |
paragraph_height += line_height + 25
|
495 |
|
496 |
|
|
|
485 |
# Draw the text
|
486 |
title_font = ImageFont.truetype("NotoSansTC-Bold.ttf", 34)
|
487 |
body_font = ImageFont.truetype("NotoSansTC-Light.ttf", 14)
|
488 |
+
|
489 |
# Calculate space required by the paragraph
|
490 |
paragraph_height = 0
|
491 |
for line in paragraph.split("\n"):
|
492 |
wrapped_lines = textwrap.wrap(line, width=60)
|
493 |
for wrapped_line in wrapped_lines:
|
494 |
+
_, _, _, line_height = draw.textbbox((0, 0), wrapped_line, font=body_font)
|
495 |
paragraph_height += line_height + 25
|
496 |
|
497 |
|