@teincfood/core 0.10.20 → 0.10.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/printer/receipt.js +22 -13
- package/package.json +1 -1
package/dist/printer/receipt.js
CHANGED
|
@@ -14,6 +14,11 @@ const ESC_ALIGN_LEFT = "\x1B\x61\x00";
|
|
|
14
14
|
const ESC_ALIGN_CENTER = "\x1B\x61\x01";
|
|
15
15
|
const ESC_BOLD_ON = "\x1B\x45\x01";
|
|
16
16
|
const ESC_BOLD_OFF = "\x1B\x45\x00";
|
|
17
|
+
// Font A is the legible 12×24 thermal font on virtually every ESC/POS head.
|
|
18
|
+
const ESC_FONT_A = "\x1B\x4D\x00";
|
|
19
|
+
// Double-strike is independent of bold and does not change character width, so
|
|
20
|
+
// it deepens every glyph without breaking the 32-column layout.
|
|
21
|
+
const ESC_DOUBLE_STRIKE_ON = "\x1B\x47\x01";
|
|
17
22
|
const GS_SIZE_NORMAL = "\x1D\x21\x00";
|
|
18
23
|
const GS_SIZE_DOUBLE_W = "\x1D\x21\x11";
|
|
19
24
|
const GS_BAR_HEIGHT = "\x1D\x68\x3C";
|
|
@@ -386,6 +391,7 @@ export function generateEscpos(order, logoRasterB64) {
|
|
|
386
391
|
// NOTE: no logo in ESC/POS text mode — a logo URL cannot be rendered without
|
|
387
392
|
// a raster pipeline (GS v 0). HTML receipts embed the logo instead.
|
|
388
393
|
push(ESC_INIT);
|
|
394
|
+
push(ESC_FONT_A);
|
|
389
395
|
if (logoRasterB64) {
|
|
390
396
|
try {
|
|
391
397
|
push(binaryFromBase64(logoRasterB64));
|
|
@@ -394,6 +400,9 @@ export function generateEscpos(order, logoRasterB64) {
|
|
|
394
400
|
/* logo is decorative — never fail the receipt */
|
|
395
401
|
}
|
|
396
402
|
}
|
|
403
|
+
// Solid-black text: double-strike every line. This is what turns faint
|
|
404
|
+
// grey thermal output into a crisp receipt on low-density heads.
|
|
405
|
+
push(ESC_DOUBLE_STRIKE_ON);
|
|
397
406
|
push(ESC_ALIGN_CENTER);
|
|
398
407
|
for (const part of nameBlockEscpos(business?.name || "Teinc Food"))
|
|
399
408
|
push(part);
|
|
@@ -602,33 +611,33 @@ export function generateHtml(order, logoDataUri) {
|
|
|
602
611
|
<html>
|
|
603
612
|
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
604
613
|
<style>
|
|
605
|
-
body{font-family:monospace;max-width:320px;margin:0 auto;padding:16px;background:#fff;color:#
|
|
606
|
-
.header{text-align:center;border-top:2px solid #
|
|
614
|
+
body{font-family:"Courier New",Courier,"Liberation Mono",monospace;font-weight:600;max-width:320px;margin:0 auto;padding:16px;background:#fff;color:#000;-webkit-print-color-adjust:exact;print-color-adjust:exact;}
|
|
615
|
+
.header{text-align:center;border-top:2px solid #000;border-bottom:2px solid #000;padding:8px 0;margin-bottom:12px;}
|
|
607
616
|
.header .logo{max-width:200px;max-height:64px;margin:4px auto;display:block;object-fit:contain;}
|
|
608
617
|
.header h2{margin:4px 0 0;}
|
|
609
|
-
.header h2.name-2x{font-size:28px;font-weight:
|
|
610
|
-
.header h2.name-1x-bold{font-size:16px;font-weight:
|
|
611
|
-
.header h2.name-1x{font-size:14px;}
|
|
612
|
-
.header .address{font-size:11px;color:#
|
|
618
|
+
.header h2.name-2x{font-size:28px;font-weight:800;}
|
|
619
|
+
.header h2.name-1x-bold{font-size:16px;font-weight:800;}
|
|
620
|
+
.header h2.name-1x{font-size:14px;font-weight:700;}
|
|
621
|
+
.header .address{font-size:11px;color:#000;font-weight:600;margin:2px 0;}
|
|
613
622
|
.callout{text-align:center;margin:16px 0;}
|
|
614
|
-
.callout .number{font-size:36px;font-weight:
|
|
615
|
-
.callout .label{font-size:10px;color:#
|
|
623
|
+
.callout .number{font-size:36px;font-weight:800;letter-spacing:4px;margin:0;}
|
|
624
|
+
.callout .label{font-size:10px;color:#000;font-weight:700;margin:0;}
|
|
616
625
|
.order-info{font-size:12px;margin:8px 0;}
|
|
617
626
|
table{width:100%;font-size:12px;border-collapse:collapse;table-layout:fixed;}
|
|
618
627
|
td{padding:2px 0;vertical-align:top;overflow-wrap:anywhere;}
|
|
619
628
|
.item-name{width:17ch;}
|
|
620
629
|
.item-qty{width:3ch;text-align:right;}
|
|
621
630
|
.item-price{width:10ch;text-align:right;}
|
|
622
|
-
.addon-row td{font-size:11px;color:#
|
|
631
|
+
.addon-row td{font-size:11px;color:#000;font-weight:600;padding-left:12px;}
|
|
623
632
|
.addon-row td.addon-price{text-align:right;}
|
|
624
|
-
.variant-row td{font-size:11px;color:#
|
|
633
|
+
.variant-row td{font-size:11px;color:#000;font-weight:600;padding-left:8px;}
|
|
625
634
|
.totals{margin-top:8px;}
|
|
626
635
|
.totals td.label{text-align:left;width:70%;}
|
|
627
636
|
.totals td.amount{text-align:right;width:30%;}
|
|
628
637
|
.total-row td{padding-top:12px;}
|
|
629
|
-
.total-row{font-weight:
|
|
630
|
-
.footer{text-align:center;margin-top:16px;padding-top:8px;font-size:12px;color:#
|
|
631
|
-
@media print{body{max-width:80mm;padding:0;}}
|
|
638
|
+
.total-row{font-weight:800;font-size:15px;border-top:2px solid #000;border-bottom:2px solid #000;padding:4px 0;}
|
|
639
|
+
.footer{text-align:center;margin-top:16px;padding-top:8px;font-size:12px;color:#000;font-weight:600;}
|
|
640
|
+
@media print{body{max-width:80mm;padding:0;color:#000;}}
|
|
632
641
|
</style></head>
|
|
633
642
|
<body>
|
|
634
643
|
<div class="header">
|
package/package.json
CHANGED