ulduldp commited on
Commit
45fc8b1
·
verified ·
1 Parent(s): 2c7a9d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -333,8 +333,9 @@ def pick_layout(text: str):
333
  text=text,
334
  font=font,
335
  max_width_px=max_box_width - (padding_x * 2),
336
- max_lines=4
337
  )
 
338
  if not lines:
339
  continue
340
 
@@ -344,7 +345,7 @@ def pick_layout(text: str):
344
  box_w = min(max_box_width, max(widths) + padding_x * 2)
345
  box_h = sum(heights) + line_spacing * (len(lines) - 1) + padding_y * 2
346
 
347
- if box_h <= 420:
348
  return {
349
  "font": font,
350
  "font_size": font_size,
@@ -363,7 +364,7 @@ def pick_layout(text: str):
363
  text=text,
364
  font=font,
365
  max_width_px=max_box_width - (padding_x * 2),
366
- max_lines=4
367
  )
368
  widths = [measure_text_width(font, line) for line in lines] if lines else [0]
369
  heights = [measure_text_height(font, line) for line in lines] if lines else [0]
 
333
  text=text,
334
  font=font,
335
  max_width_px=max_box_width - (padding_x * 2),
336
+ max_lines=5
337
  )
338
+
339
  if not lines:
340
  continue
341
 
 
345
  box_w = min(max_box_width, max(widths) + padding_x * 2)
346
  box_h = sum(heights) + line_spacing * (len(lines) - 1) + padding_y * 2
347
 
348
+ if box_h <= 520:
349
  return {
350
  "font": font,
351
  "font_size": font_size,
 
364
  text=text,
365
  font=font,
366
  max_width_px=max_box_width - (padding_x * 2),
367
+ max_lines=5
368
  )
369
  widths = [measure_text_width(font, line) for line in lines] if lines else [0]
370
  heights = [measure_text_height(font, line) for line in lines] if lines else [0]