Repository navigation
fix(print): improve 58mm browser print & text size - #1493
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoImprove thermal browser print legibility and text-size scaling
AI Description
Diagram
High-Level Assessment
Files changed (36)
|
Code Review by Qodo
1. The live test can delete an existing printer
|
58a9adc to
dfec750
Compare
Enforce pure #000 text and borders, @page paper dimensions, stronger stroke weights, and printer text_size scaling across 58mm/80mm Browser Print receipts, KOTs, and order slips, include textSize on printer API and WebUSB capabilities, and clarify ESCPOS Print Method copy across all 24 locales. Fixes #1482
…format changed files
dfec750 to
71d4d8d
Compare
Fixes #1482
Intent
Implement the fix for 58mm/80mm thermal printing legibility (e.g. Xprinter XP-58 SIR where merchants report small, faint item/amount text and dotted borders even after setting Text Size to Extra Large):
thermal58andthermal80Browser Print CSS infrontend/src/lib/printer/web-print.ts(and checkkot-web-print.ts/order-slip-web-print.ts):#000for all text and borders on thermal paper sizes (override#c00,#ccc,#eee,#333,#555,#666,#888) so 203 DPI GDI thermal drivers never halftone-dither text or borders.600/700), and include@pagemargin rules and safe printable width so Browser Print is crisp and readable on 58mm (48mm printable head) and 80mm thermal printers.text_size(normal|large|extra_large) inweb-print.ts(andkot-web-print.ts/order-slip-web-print.ts) as well as inmain/routes/printers.ts(printerShape(printer).capabilities.textSize) andfrontend/src/hooks/usePrinter.ts(WebUSB and Browser Print).Print Methodcopy infrontend/src/lib/i18n/messages/en.json(and the other 23 committed locale files) so desktop users with USB/Network thermal printers know to keepESCPOSselected rather than switching toBrowser Print.What Changed
web-print.ts,kot-web-print.ts,delivery-slip-web-print.ts, andorder-slip-web-print.ts) to use solid#000text and borders,@pagepaper sizing with safe printable widths, heavier font weights (600/700), and scaled typography fornormal,large, andextra_largeprinter text sizes.text_sizeacrossprinterShape()/printerReadinessShape()inmain/routes/printers.ts,usePrinterStore(frontend/src/hooks/usePrinter.ts), WebUSB ESC/POS encoders (configureEncoderTextSizeandlayoutColumnsForTextSizeinshared/print/text-size.ts), and WebUSB raster IPC (main/ipc.tsandmain/printers/thermal.ts).Print Methodoption labels across all 24 locale message files to clarifyESCPOS (USB / Network Thermal Printer)versusBrowser Print (any printer), and added unit, E2E, and documentation coverage.Risk Assessment
✅ Low: The changes are well-bounded to thermal Browser Print legibility (solid #000 colors, @page sizing, and font/weight scaling), end-to-end propagation of per-printer text_size across Browser Print and WebUSB paths while keeping normal output byte-identical, and clarifying Print Method i18n copy across all 24 locales.
Testing
Ran the updated browser receipt visual/computed-style test suite (
npm run test:browser-receipts), printer text size and ESC/POS encoding suite (npm run test:printer-text-size), printer API suite (npm run test:printer-api), 58mm/80mm KOT and legibility regression suite (npm run test:issue-1442), delivery slip suite (npm run test:delivery-slip), receipt column oracle (npm run test:receipt-column-oracle), test script coverage (npm run test:script-coverage), translation integrity checks across all 25 locales (npm run i18n:check), documentation checks (npm run docs:check), and the live Playwright E2E suite (frontend/e2e/qa-settings-receipts-printers.spec.ts), capturing HTML and PNG screenshots in the evidence directory; all checks and live scenarios passed.Evidence: Captured HTML from live /orders Browser Print popup for XP-58 SIR at Extra Large text size
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npx playwright test e2e/qa-settings-receipts-printers.spec.tsnpm run test:printer-text-size,npm run test:printer-api,npm run test:issue-1442,npm run test:delivery-slip, andnpm run test:receipt-column-oraclenpx playwright test e2e/qa-settings-receipts-printers.spec.ts, andnpm run i18n:checknpx playwright test e2e/qa-settings-receipts-printers.spec.ts,npm run test:printer-api, andnpm run test:browser-receiptsEVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM REQUIRE_VISUAL_EVIDENCE=1 npm run test:browser-receiptsnpm run test:printer-text-sizenpm run test:printer-apinpm run test:issue-1442npm run test:delivery-slipnpm run test:receipt-column-oraclenpm run i18n:checknpm run docs:checknpm run build && npm run build:frontend && cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --config=playwright.config.ts --project=chromium✅ No issues found.
EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM REQUIRE_VISUAL_EVIDENCE=1 npm run test:browser-receiptsnpm run test:printer-text-sizenpm run test:printer-apinpm run test:issue-1442npm run test:delivery-slipnpm run test:receipt-column-oraclenpm run test:script-coveragenpm run i18n:checknpm run docs:checkcd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M6TAY2BFWQ45QSH9JST9VBPM npx playwright test e2e/qa-settings-receipts-printers.spec.ts --project=chromiumgit diff --check 461c862abf5102be0fd2585b1c6dd2277cfb7d39✅ **Document** - passed
✅ No issues found.
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.