Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -227,7 +227,9 @@ def add_text_overlay(image, title_ko, author_ko,
|
|
227 |
|
228 |
# Calculate position for this character
|
229 |
char_x = start_x - char_width // 2
|
230 |
-
|
|
|
|
|
231 |
|
232 |
# Draw shadow
|
233 |
draw.text((char_x + shadow_offset, char_y + shadow_offset),
|
@@ -269,9 +271,10 @@ def add_text_overlay(image, title_ko, author_ko,
|
|
269 |
|
270 |
# Adjust start_y for author (place it lower than title if both are vertical)
|
271 |
if title_position in vertical_position_coords:
|
272 |
-
# Calculate how much space the title takes
|
273 |
title_length = len(title_ko) if title_ko else 0
|
274 |
-
|
|
|
275 |
|
276 |
for i, char in enumerate(author_text):
|
277 |
# Get character bbox
|
@@ -285,7 +288,9 @@ def add_text_overlay(image, title_ko, author_ko,
|
|
285 |
|
286 |
# Calculate position for this character
|
287 |
char_x = start_x - char_width // 2
|
288 |
-
|
|
|
|
|
289 |
|
290 |
# Draw shadow
|
291 |
draw.text((char_x + shadow_offset, char_y + shadow_offset),
|
|
|
227 |
|
228 |
# Calculate position for this character
|
229 |
char_x = start_x - char_width // 2
|
230 |
+
# Use fixed spacing based on font size for consistent vertical spacing
|
231 |
+
vertical_spacing = int(title_size * 1.2) # 120% of font size for better spacing
|
232 |
+
char_y = start_y + i * vertical_spacing
|
233 |
|
234 |
# Draw shadow
|
235 |
draw.text((char_x + shadow_offset, char_y + shadow_offset),
|
|
|
271 |
|
272 |
# Adjust start_y for author (place it lower than title if both are vertical)
|
273 |
if title_position in vertical_position_coords:
|
274 |
+
# Calculate how much space the title takes with new spacing
|
275 |
title_length = len(title_ko) if title_ko else 0
|
276 |
+
vertical_spacing = int(title_size * 1.2)
|
277 |
+
start_y += title_length * vertical_spacing + author_size
|
278 |
|
279 |
for i, char in enumerate(author_text):
|
280 |
# Get character bbox
|
|
|
288 |
|
289 |
# Calculate position for this character
|
290 |
char_x = start_x - char_width // 2
|
291 |
+
# Use fixed spacing based on font size for consistent vertical spacing
|
292 |
+
vertical_spacing = int(author_size * 1.2) # 120% of font size for better spacing
|
293 |
+
char_y = start_y + i * vertical_spacing
|
294 |
|
295 |
# Draw shadow
|
296 |
draw.text((char_x + shadow_offset, char_y + shadow_offset),
|