From a7ab8679f4caf517f7af98871faaf67cb8034fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Fri, 25 Apr 2025 16:39:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AD=97=E4=BD=93=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/commons/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sf_base/commons/common.py b/sf_base/commons/common.py index 27b56038..30c06b6d 100644 --- a/sf_base/commons/common.py +++ b/sf_base/commons/common.py @@ -167,10 +167,10 @@ class PrintingUtils(models.AbstractModel): # 设置字体 if font_found: - c.setFont('SimSun', 14) # 增大字体大小到14pt + c.setFont('SimSun', 10) # 增大字体大小到14pt else: # 如果没有找到中文字体,使用默认字体 - c.setFont('Helvetica', 14) + c.setFont('Helvetica', 10) logging.warning("未找到中文字体,将使用默认字体") # 在右下角绘制二维码,预留边距 @@ -182,7 +182,7 @@ class PrintingUtils(models.AbstractModel): if buttom_text: # 在二维码下方绘制文字 text = buttom_text - text_width = c.stringWidth(text, "SimSun" if font_found else "Helvetica", 14) # 准确计算文字宽度 + text_width = c.stringWidth(text, "SimSun" if font_found else "Helvetica", 10) # 准确计算文字宽度 text_x = page_width - qr_size - margin + (qr_size - text_width) / 2 # 文字居中对齐 text_y = margin + 20 # 文字位置靠近底部 c.drawString(text_x, text_y, text)