From 10eb05e675490704404163008b78612dc7decfca Mon Sep 17 00:00:00 2001 From: Poker Design Developer Date: Mon, 1 Jun 2026 22:23:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=B9=E9=BD=90=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=20joker=20=E6=B8=B2=E6=9F=93=EF=BC=8C=E6=B6=88?= =?UTF-8?q?=E9=99=A4=E9=A2=84=E8=A7=88=E4=B8=8E=E5=AF=BC=E5=87=BA=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/apps/exports/utils.py | 8 ++++---- frontend/src/utils/cardRenderer.js | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/backend/apps/exports/utils.py b/backend/apps/exports/utils.py index 344be6d..2e4df09 100644 --- a/backend/apps/exports/utils.py +++ b/backend/apps/exports/utils.py @@ -294,8 +294,8 @@ def draw_joker(canvas, design, which, project, card_key, asset): # 主体图 body_pad_x = int(w * 0.15) - body_pad_y_top = int(h * 0.15) - body_pad_y_bot = int(h * 0.20) + body_pad_y_top = int(h * 0.18) + body_pad_y_bot = int(h * 0.22) body_w = w - 2 * body_pad_x body_h = h - body_pad_y_top - body_pad_y_bot if asset: @@ -308,11 +308,11 @@ def draw_joker(canvas, design, which, project, card_key, asset): offset_y = int(body_h * image_dy) img_copy = asset.copy() + img_copy.thumbnail((body_w, half_h), Image.LANCZOS) if image_scale != 1: sw = max(1, int(img_copy.width * image_scale)) sh = max(1, int(img_copy.height * image_scale)) img_copy = img_copy.resize((sw, sh), Image.LANCZOS) - img_copy.thumbnail((body_w, half_h), Image.LANCZOS) x = body_pad_x + offset_x + (body_w - img_copy.width) // 2 y_top = body_pad_y_top + offset_y + (half_h - img_copy.height) // 2 canvas.alpha_composite(img_copy, (x, y_top)) @@ -372,11 +372,11 @@ def draw_back(canvas, design, asset): offset_y = int(body_h * image_dy) img = asset.copy() + img.thumbnail((body_w, body_h), Image.LANCZOS) if image_scale != 1: sw = max(1, int(img.width * image_scale)) sh = max(1, int(img.height * image_scale)) img = img.resize((sw, sh), Image.LANCZOS) - img.thumbnail((body_w, body_h), Image.LANCZOS) x = body_pad_x + offset_x + (body_w - img.width) // 2 y = body_pad_y_top + offset_y + (body_h - img.height) // 2 canvas.alpha_composite(img, (x, y)) diff --git a/frontend/src/utils/cardRenderer.js b/frontend/src/utils/cardRenderer.js index 38453bb..90d0d47 100644 --- a/frontend/src/utils/cardRenderer.js +++ b/frontend/src/utils/cardRenderer.js @@ -318,8 +318,9 @@ async function drawJokerBody(ctx, w, h, which, design, project) { const pad = Math.max(10, w * 0.04) // 左上角标 - ctx.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif` + ctx.font = `${textSize}px ${design.font_family || 'Times New Roman'}, serif` ctx.fillText('JOKER', pad, pad) + ctx.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif` ctx.fillText(label, pad, pad + textSize + 4) // 右下角标 @@ -329,8 +330,9 @@ async function drawJokerBody(ctx, w, h, which, design, project) { ctx.fillStyle = '#FFFFFF' ctx.textAlign = 'left' ctx.textBaseline = 'top' - ctx.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif` + ctx.font = `${textSize}px ${design.font_family || 'Times New Roman'}, serif` ctx.fillText('JOKER', 0, 0) + ctx.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif` ctx.fillText(label, 0, textSize + 4) ctx.restore()