完善了海报生成

This commit is contained in:
jinye_huang 2025-07-28 10:38:22 +08:00
parent 4f5d8cfbfe
commit 7224f46027
2 changed files with 2 additions and 2 deletions

View File

@ -464,7 +464,7 @@ class VibrantTemplate(BaseTemplate):
def _render_right_column(self, draw: ImageDraw.Draw, content: Dict[str, Any], y: int, x: int, right_margin: int):
"""渲染右栏内容价格、票种和备注增强版本与demo一致"""
price_text = content.get('price', '')
price_text = str(content.get('price', '')) # 确保价格是字符串类型
price_target_width = int((right_margin - x) * 0.7)
price_size, price_actual_width = self._calculate_optimal_font_size_enhanced(
price_text, price_target_width, max_size=120, min_size=40
@ -1020,7 +1020,7 @@ class VibrantTemplate(BaseTemplate):
# 使用中文字体
# 价格
price_text = content.get('price', '')
price_text = str(content.get('price', '')) # 确保价格是字符串类型
if price_text:
price_target_width = int((right_margin - x) * 0.7)
price_size, price_actual_width = self._calculate_optimal_font_size_enhanced(