habulaj commited on
Commit
765a05b
·
verified ·
1 Parent(s): 1e54360

Update routers/video.py

Browse files
Files changed (1) hide show
  1. routers/video.py +13 -2
routers/video.py CHANGED
@@ -121,8 +121,14 @@ def render_headline_text(draw: ImageDraw.Draw, text: str, x: int, y: int, max_wi
121
  line_width = bbox[2] - bbox[0]
122
  centered_x = x - (line_width // 2)
123
 
 
 
 
 
 
 
124
  # Desenhar texto principal (branco)
125
- draw.text((centered_x, current_y), line, fill=(0, 0, 0, 89), font=final_font) # Texto com opacidade para sombra
126
 
127
  # Atualizar posição para próxima linha (subindo)
128
  current_y -= int(line_height * 1.2) # Line height de 120%
@@ -223,8 +229,13 @@ def render_headline_text_white(draw: ImageDraw.Draw, text: str, x: int, y: int,
223
  line_width = bbox[2] - bbox[0]
224
  centered_x = x - (line_width // 2)
225
 
 
 
 
 
 
226
  # Desenhar texto principal (branco)
227
- draw.text((centered_x, current_y), line, fill=(255, 255, 255, 255), font=final_font)
228
 
229
  # Atualizar posição para próxima linha (subindo)
230
  current_y -= int(line_height * 1.2)
 
121
  line_width = bbox[2] - bbox[0]
122
  centered_x = x - (line_width // 2)
123
 
124
+ # Ajustar Y para que a base da linha fique na posição correta
125
+ # O textbbox retorna (left, top, right, bottom), então precisamos ajustar
126
+ text_bbox = draw.textbbox((0, 0), line, font=final_font)
127
+ text_height = text_bbox[3] - text_bbox[1]
128
+ adjusted_y = current_y - text_height
129
+
130
  # Desenhar texto principal (branco)
131
+ draw.text((centered_x, adjusted_y), line, fill=(0, 0, 0, 89), font=final_font) # Texto com opacidade para sombra
132
 
133
  # Atualizar posição para próxima linha (subindo)
134
  current_y -= int(line_height * 1.2) # Line height de 120%
 
229
  line_width = bbox[2] - bbox[0]
230
  centered_x = x - (line_width // 2)
231
 
232
+ # Ajustar Y para que a base da linha fique na posição correta
233
+ text_bbox = draw.textbbox((0, 0), line, font=final_font)
234
+ text_height = text_bbox[3] - text_bbox[1]
235
+ adjusted_y = current_y - text_height
236
+
237
  # Desenhar texto principal (branco)
238
+ draw.text((centered_x, adjusted_y), line, fill=(255, 255, 255, 255), font=final_font)
239
 
240
  # Atualizar posição para próxima linha (subindo)
241
  current_y -= int(line_height * 1.2)