From d901c67125fcbbf90e111d1ee9091394269c114b Mon Sep 17 00:00:00 2001 From: thug0bin Date: Thu, 12 Mar 2026 22:45:29 +0900 Subject: [PATCH] =?UTF-8?q?fix(pmr):=20=EB=9D=BC=EB=B2=A8=20=EB=B0=95?= =?UTF-8?q?=EC=8A=A4=20=EB=82=B4=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20=EC=9D=BC=EA=B4=80=EC=84=B1=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 고정 라인 높이(32px) 기준 중앙 정렬 (글자 내용과 무관하게 동일 레이아웃) - 1회복용량 ↔ 복용횟수 간격 조정 (6px) - 박스 내 텍스트 전체 5px 위로 조정 --- backend/pmr_api.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/pmr_api.py b/backend/pmr_api.py index eb2f90b..f9f121c 100644 --- a/backend/pmr_api.py +++ b/backend/pmr_api.py @@ -994,18 +994,19 @@ def create_label_image(patient_name, med_name, add_info='', dosage=0, frequency= time_text = f"1일 {frequency}회" # 박스 내 텍스트 중앙 배치 (수직 중앙 정렬) - line_spacing = 5 + line_spacing = 6 # 1회복용량 ↔ 복용횟수 간격 bbox1 = draw.textbbox((0, 0), dosage_text, font=info_font) text1_height = bbox1[3] - bbox1[1] bbox2 = draw.textbbox((0, 0), time_text, font=info_font) text2_height = bbox2[3] - bbox2[1] - total_text_height = text1_height + line_spacing + text2_height - + # 방법 2: 폰트 최대 높이 기준 고정 (글자 내용과 무관하게 일정한 레이아웃) + fixed_line_height = 32 # 폰트 크기 30 기반 고정 라인 높이 + fixed_total_height = fixed_line_height * 2 + line_spacing center_y = (box_top + box_bottom) // 2 - start_y = center_y - (total_text_height // 2) - 5 # 약간 위로 조정 + start_y = center_y - (fixed_total_height // 2) - 5 # 박스 내 텍스트 전체 위로 조정 draw_centered(dosage_text, start_y, info_font) - draw_centered(time_text, start_y + text1_height + line_spacing, info_font) + draw_centered(time_text, start_y + fixed_line_height + line_spacing, info_font) y = box_bottom + 10