diff --git a/python/Bag1.py b/python/Bag1.py index 8e1a4ea..fb1518f 100644 --- a/python/Bag1.py +++ b/python/Bag1.py @@ -140,10 +140,16 @@ def _zpl_escape(s: str) -> str: return s.replace("\\", "\\\\").replace("^", "\\^") -def generate_zpl_dataflex(batch_no: str, item_code: str, item_name: str) -> str: +def generate_zpl_dataflex( + batch_no: str, + item_code: str, + item_name: str, + font_regular: str = "E:STXihei.ttf", + font_bold: str = "E:STXihei.ttf", +) -> str: """ Generate ZPL for DataFlex label (53 mm media, 90° rotated). - Uses UTF-8 (^CI28) and fonts msjh.ttc / msjhbd.ttc for Chinese/English. + Uses UTF-8 (^CI28) and configurable .TTF fonts for Chinese (e.g. E:STXihei.ttf). """ desc = _zpl_escape((item_name or "—").strip()) code = _zpl_escape((item_code or "—").strip()) @@ -154,11 +160,11 @@ def generate_zpl_dataflex(batch_no: str, item_code: str, item_name: str) -> str: ^PO N ^CI28 ^FO70,70 -^A@R,60,60,E:MSJH.TTC^FD{desc}^FS +^A@R,60,60,{font_regular}^FD{desc}^FS ^FO220,70 -^A@R,50,50,E:MSJHBD.TTC^FD{code}^FS +^A@R,50,50,{font_bold}^FD{code}^FS ^FO310,70 -^A@R,45,45,E:MSJHBD.TTC^FD批次: {batch}^FS +^A@R,45,45,{font_bold}^FD批次: {batch}^FS ^FO150,420 ^BQN,2,6^FDQA,{batch_no}^FS ^XZ""" diff --git a/python/bag1_settings.json b/python/bag1_settings.json index c4e668b..37f71ef 100644 --- a/python/bag1_settings.json +++ b/python/bag1_settings.json @@ -2,7 +2,7 @@ "api_ip": "127.0.0.1", "api_port": "8090", "dabag_ip": "192.168.17.27", - "dabag_port": "9100", + "dabag_port": "3008", "laser_ip": "192.168.7.77", "laser_port": "9100", "label_com": "COM2"