BlueGit

timfa posprint

Merge origin/master for 0.1.2 release.

Co-authored-by: Cursor <cursoragent@cursor.com>

timfa Tim Falken · pushed by timfa

Authored 2026-07-16 · 4 months ago

Hash
2dc6f51feb867265743020d525f0bbf183c42dae
24 files changed +2469 −1753
.gitattributes added +6 −0
@@ -0,0 +1,6 @@
1 *.sh text eol=lf
2 *.ps1 text eol=crlf
3 PKGBUILD text eol=lf
4 *.desktop text eol=lf
5 *.xml text eol=lf
6 *.md text eol=lf
@@ -0,0 +1,6 @@
1*.sh text eol=lf
2*.ps1 text eol=crlf
3PKGBUILD text eol=lf
4*.desktop text eol=lf
5*.xml text eol=lf
6*.md text eol=lf
.gitlab-ci.yml +27 −15
@@ -1,4 +1,4 @@
1 # posprint — GitLab CI/CD
1 # posprint — GitLab CI/CD (GitLab.com SaaS runners)
2 2 # Builds and tests on every push; publishes Windows, Debian, and Arch releases on tags.
3 3
4 4 stages:
@@ -10,28 +10,41 @@ variables:
10 10 CARGO_TERM_COLOR: always
11 11 RUST_BACKTRACE: "1"
12 12
13 # Linux Docker jobs: untagged → saas-linux-small-amd64 by default.
13 14 .default_rust:
14 image: rust:1.85-bookworm
15 image: rust:1.96-bookworm
15 16 before_script:
16 17 - rustc --version
17 18 - cargo --version
18 19
20 # Windows SaaS runner (PowerShell). Rust is not preinstalled — install via rustup.
21 .windows_saas:
22 tags:
23 - saas-windows-medium-amd64
24 before_script:
25 - |
26 if (-not (Get-Command rustc -ErrorAction SilentlyContinue)) {
27 Write-Host "Installing Rust via rustup..."
28 Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
29 .\rustup-init.exe -y --default-toolchain stable --profile minimal
30 Remove-Item rustup-init.exe
31 }
32 $env:Path = "$env:USERPROFILE\.cargo\bin;$env:Path"
33 rustc --version
34 cargo --version
35
19 36 test:linux:
20 37 extends: .default_rust
21 38 stage: test
22 39 script:
23 40 - apt-get update -qq
24 41 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
25 libxkbcommon-dev libssl-dev pkg-config
42 libxkbcommon-dev libssl-dev libudev-dev pkg-config
26 43 - cargo test --verbose
27 44
28 45 test:windows:
46 extends: .windows_saas
29 47 stage: test
30 tags:
31 - windows
32 - shell
33 before_script:
34 - rustup show
35 48 script:
36 49 - cargo test --verbose
37 50
@@ -43,7 +56,7 @@ build:linux-deb:
43 56 before_script:
44 57 - apt-get update -qq
45 58 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
46 libxkbcommon-dev libssl-dev pkg-config dpkg-dev
59 libxkbcommon-dev libssl-dev libudev-dev pkg-config dpkg-dev
47 60 - cargo install cargo-deb --locked
48 61 script:
49 62 - cargo deb
@@ -62,8 +75,9 @@ build:linux-arch:
62 75 - if: $CI_COMMIT_TAG
63 76 script:
64 77 - pacman -Syu --noconfirm
65 - pacman -S --noconfirm --needed rust pkgconf openssl libxkbcommon libxcb dbus-libs
78 - pacman -S --noconfirm --needed rust pkgconf openssl libxkbcommon libxcb dbus
66 79 wayland libx11 fontconfig freetype2 libglvnd git rsync
80 - rustc --version
67 81 - export PKGVER="${CI_COMMIT_TAG#v}"
68 82 - sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
69 83 - useradd -m builduser
@@ -78,16 +92,14 @@ build:linux-arch:
78 92 expire_in: 1 year
79 93
80 94 build:windows:
95 extends: .windows_saas
81 96 stage: build
82 tags:
83 - windows
84 - shell
85 97 rules:
86 98 - if: $CI_COMMIT_TAG
87 99 script:
88 100 - cargo build --release
89 - mkdir dist
90 - cp target/release/posprint.exe dist/
101 - New-Item -ItemType Directory -Force -Path dist | Out-Null
102 - Copy-Item target\release\posprint.exe dist\
91 103 artifacts:
92 104 name: "posprint-windows-$CI_COMMIT_TAG"
93 105 paths:
@@ -1,4 +1,4 @@
1# posprint — GitLab CI/CD
1# posprint — GitLab CI/CD (GitLab.com SaaS runners)
2# Builds and tests on every push; publishes Windows, Debian, and Arch releases on tags.
2# Builds and tests on every push; publishes Windows, Debian, and Arch releases on tags.
3
3
4stages:
4stages:
@@ -10,28 +10,41 @@ variables:
10 CARGO_TERM_COLOR: always
10 CARGO_TERM_COLOR: always
11 RUST_BACKTRACE: "1"
11 RUST_BACKTRACE: "1"
12
12
13# Linux Docker jobs: untagged → saas-linux-small-amd64 by default.
13.default_rust:
14.default_rust:
14 image: rust:1.85-bookworm
15 image: rust:1.96-bookworm
15 before_script:
16 before_script:
16 - rustc --version
17 - rustc --version
17 - cargo --version
18 - cargo --version
18
19
20# Windows SaaS runner (PowerShell). Rust is not preinstalled — install via rustup.
21.windows_saas:
22 tags:
23 - saas-windows-medium-amd64
24 before_script:
25 - |
26 if (-not (Get-Command rustc -ErrorAction SilentlyContinue)) {
27 Write-Host "Installing Rust via rustup..."
28 Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
29 .\rustup-init.exe -y --default-toolchain stable --profile minimal
30 Remove-Item rustup-init.exe
31 }
32 $env:Path = "$env:USERPROFILE\.cargo\bin;$env:Path"
33 rustc --version
34 cargo --version
35
19test:linux:
36test:linux:
20 extends: .default_rust
37 extends: .default_rust
21 stage: test
38 stage: test
22 script:
39 script:
23 - apt-get update -qq
40 - apt-get update -qq
24 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
41 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
25 libxkbcommon-dev libssl-dev pkg-config
42 libxkbcommon-dev libssl-dev libudev-dev pkg-config
26 - cargo test --verbose
43 - cargo test --verbose
27
44
28test:windows:
45test:windows:
46 extends: .windows_saas
29 stage: test
47 stage: test
30 tags:
31 - windows
32 - shell
33 before_script:
34 - rustup show
35 script:
48 script:
36 - cargo test --verbose
49 - cargo test --verbose
37
50
@@ -43,7 +56,7 @@ build:linux-deb:
43 before_script:
56 before_script:
44 - apt-get update -qq
57 - apt-get update -qq
45 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
58 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
46 libxkbcommon-dev libssl-dev pkg-config dpkg-dev
59 libxkbcommon-dev libssl-dev libudev-dev pkg-config dpkg-dev
47 - cargo install cargo-deb --locked
60 - cargo install cargo-deb --locked
48 script:
61 script:
49 - cargo deb
62 - cargo deb
@@ -62,8 +75,9 @@ build:linux-arch:
62 - if: $CI_COMMIT_TAG
75 - if: $CI_COMMIT_TAG
63 script:
76 script:
64 - pacman -Syu --noconfirm
77 - pacman -Syu --noconfirm
65 - pacman -S --noconfirm --needed rust pkgconf openssl libxkbcommon libxcb dbus-libs
78 - pacman -S --noconfirm --needed rust pkgconf openssl libxkbcommon libxcb dbus
66 wayland libx11 fontconfig freetype2 libglvnd git rsync
79 wayland libx11 fontconfig freetype2 libglvnd git rsync
80 - rustc --version
67 - export PKGVER="${CI_COMMIT_TAG#v}"
81 - export PKGVER="${CI_COMMIT_TAG#v}"
68 - sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
82 - sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
69 - useradd -m builduser
83 - useradd -m builduser
@@ -78,16 +92,14 @@ build:linux-arch:
78 expire_in: 1 year
92 expire_in: 1 year
79
93
80build:windows:
94build:windows:
95 extends: .windows_saas
81 stage: build
96 stage: build
82 tags:
83 - windows
84 - shell
85 rules:
97 rules:
86 - if: $CI_COMMIT_TAG
98 - if: $CI_COMMIT_TAG
87 script:
99 script:
88 - cargo build --release
100 - cargo build --release
89 - mkdir dist
101 - New-Item -ItemType Directory -Force -Path dist | Out-Null
90 - cp target/release/posprint.exe dist/
102 - Copy-Item target\release\posprint.exe dist\
91 artifacts:
103 artifacts:
92 name: "posprint-windows-$CI_COMMIT_TAG"
104 name: "posprint-windows-$CI_COMMIT_TAG"
93 paths:
105 paths:
Cargo.lock +562 −11
@@ -31,6 +31,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31 31 checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
32 32 dependencies = [
33 33 "cfg-if",
34 "getrandom 0.3.4",
34 35 "once_cell",
35 36 "version_check",
36 37 "zerocopy",
@@ -68,7 +69,7 @@ dependencies = [
68 69 "log",
69 70 "ndk",
70 71 "ndk-context",
71 "ndk-sys",
72 "ndk-sys 0.6.0+11769913",
72 73 "num_enum",
73 74 "thiserror 2.0.18",
74 75 ]
@@ -187,6 +188,12 @@ version = "0.7.8"
187 188 source = "registry+https://github.com/rust-lang/crates.io-index"
188 189 checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
189 190
191 [[package]]
192 name = "as-raw-xcb-connection"
193 version = "1.0.1"
194 source = "registry+https://github.com/rust-lang/crates.io-index"
195 checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
196
190 197 [[package]]
191 198 name = "as-slice"
192 199 version = "0.2.1"
@@ -196,6 +203,15 @@ dependencies = [
196 203 "stable_deref_trait",
197 204 ]
198 205
206 [[package]]
207 name = "ash"
208 version = "0.38.0+1.3.281"
209 source = "registry+https://github.com/rust-lang/crates.io-index"
210 checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
211 dependencies = [
212 "libloading",
213 ]
214
199 215 [[package]]
200 216 name = "ashpd"
201 217 version = "0.11.1"
@@ -435,6 +451,21 @@ dependencies = [
435 451 "image",
436 452 ]
437 453
454 [[package]]
455 name = "bit-set"
456 version = "0.8.0"
457 source = "registry+https://github.com/rust-lang/crates.io-index"
458 checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
459 dependencies = [
460 "bit-vec",
461 ]
462
463 [[package]]
464 name = "bit-vec"
465 version = "0.8.0"
466 source = "registry+https://github.com/rust-lang/crates.io-index"
467 checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
468
438 469 [[package]]
439 470 name = "bit_field"
440 471 version = "0.10.3"
@@ -452,6 +483,9 @@ name = "bitflags"
452 483 version = "2.13.0"
453 484 source = "registry+https://github.com/rust-lang/crates.io-index"
454 485 checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
486 dependencies = [
487 "serde_core",
488 ]
455 489
456 490 [[package]]
457 491 name = "bitstream-io"
@@ -462,6 +496,12 @@ dependencies = [
462 496 "no_std_io2",
463 497 ]
464 498
499 [[package]]
500 name = "block"
501 version = "0.1.6"
502 source = "registry+https://github.com/rust-lang/crates.io-index"
503 checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
504
465 505 [[package]]
466 506 name = "block2"
467 507 version = "0.5.1"
@@ -570,6 +610,18 @@ dependencies = [
570 610 "tracing",
571 611 ]
572 612
613 [[package]]
614 name = "calloop-wayland-source"
615 version = "0.3.0"
616 source = "registry+https://github.com/rust-lang/crates.io-index"
617 checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
618 dependencies = [
619 "calloop 0.13.0",
620 "rustix 0.38.44",
621 "wayland-backend",
622 "wayland-client",
623 ]
624
573 625 [[package]]
574 626 name = "calloop-wayland-source"
575 627 version = "0.4.1"
@@ -675,6 +727,16 @@ dependencies = [
675 727 "error-code",
676 728 ]
677 729
730 [[package]]
731 name = "codespan-reporting"
732 version = "0.11.1"
733 source = "registry+https://github.com/rust-lang/crates.io-index"
734 checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
735 dependencies = [
736 "termcolor",
737 "unicode-width 0.1.14",
738 ]
739
678 740 [[package]]
679 741 name = "color_quant"
680 742 version = "1.1.0"
@@ -881,6 +943,7 @@ dependencies = [
881 943 "bytemuck",
882 944 "document-features",
883 945 "egui",
946 "egui-wgpu",
884 947 "egui-winit",
885 948 "egui_glow",
886 949 "glow",
@@ -921,6 +984,26 @@ dependencies = [
921 984 "profiling",
922 985 ]
923 986
987 [[package]]
988 name = "egui-wgpu"
989 version = "0.31.1"
990 source = "registry+https://github.com/rust-lang/crates.io-index"
991 checksum = "d319dfef570f699b6e9114e235e862a2ddcf75f0d1a061de9e1328d92146d820"
992 dependencies = [
993 "ahash",
994 "bytemuck",
995 "document-features",
996 "egui",
997 "epaint",
998 "log",
999 "profiling",
1000 "thiserror 1.0.69",
1001 "type-map",
1002 "web-time",
1003 "wgpu",
1004 "winit",
1005 ]
1006
924 1007 [[package]]
925 1008 name = "egui-winit"
926 1009 version = "0.31.1"
@@ -955,6 +1038,7 @@ dependencies = [
955 1038 "profiling",
956 1039 "wasm-bindgen",
957 1040 "web-sys",
1041 "winit",
958 1042 ]
959 1043
960 1044 [[package]]
@@ -1140,6 +1224,12 @@ dependencies = [
1140 1224 "miniz_oxide",
1141 1225 ]
1142 1226
1227 [[package]]
1228 name = "foldhash"
1229 version = "0.1.5"
1230 source = "registry+https://github.com/rust-lang/crates.io-index"
1231 checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
1232
1143 1233 [[package]]
1144 1234 name = "foreign-types"
1145 1235 version = "0.5.0"
@@ -1258,7 +1348,7 @@ version = "0.2.24"
1258 1348 source = "registry+https://github.com/rust-lang/crates.io-index"
1259 1349 checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df"
1260 1350 dependencies = [
1261 "unicode-width",
1351 "unicode-width 0.2.2",
1262 1352 ]
1263 1353
1264 1354 [[package]]
@@ -1328,6 +1418,7 @@ dependencies = [
1328 1418 "cgl",
1329 1419 "dispatch2",
1330 1420 "glutin_egl_sys",
1421 "glutin_glx_sys",
1331 1422 "glutin_wgl_sys",
1332 1423 "libloading",
1333 1424 "objc2 0.6.4",
@@ -1336,7 +1427,9 @@ dependencies = [
1336 1427 "objc2-foundation 0.3.2",
1337 1428 "once_cell",
1338 1429 "raw-window-handle",
1430 "wayland-sys",
1339 1431 "windows-sys 0.52.0",
1432 "x11-dl",
1340 1433 ]
1341 1434
1342 1435 [[package]]
@@ -1361,6 +1454,16 @@ dependencies = [
1361 1454 "windows-sys 0.52.0",
1362 1455 ]
1363 1456
1457 [[package]]
1458 name = "glutin_glx_sys"
1459 version = "0.6.1"
1460 source = "registry+https://github.com/rust-lang/crates.io-index"
1461 checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185"
1462 dependencies = [
1463 "gl_generator",
1464 "x11-dl",
1465 ]
1466
1364 1467 [[package]]
1365 1468 name = "glutin_wgl_sys"
1366 1469 version = "0.6.1"
@@ -1370,6 +1473,45 @@ dependencies = [
1370 1473 "gl_generator",
1371 1474 ]
1372 1475
1476 [[package]]
1477 name = "gpu-alloc"
1478 version = "0.6.2"
1479 source = "registry+https://github.com/rust-lang/crates.io-index"
1480 checksum = "45cf04b2726f02df5508c6de726acdc90cdf97ac771a9a0ffd8ba10a6e696bf9"
1481 dependencies = [
1482 "bitflags 2.13.0",
1483 "gpu-alloc-types",
1484 ]
1485
1486 [[package]]
1487 name = "gpu-alloc-types"
1488 version = "0.3.1"
1489 source = "registry+https://github.com/rust-lang/crates.io-index"
1490 checksum = "b2bbed164dd10ed526c2e4fe3e721ca4a71c61730e5aafac6844b417b3227058"
1491 dependencies = [
1492 "bitflags 2.13.0",
1493 ]
1494
1495 [[package]]
1496 name = "gpu-descriptor"
1497 version = "0.3.2"
1498 source = "registry+https://github.com/rust-lang/crates.io-index"
1499 checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
1500 dependencies = [
1501 "bitflags 2.13.0",
1502 "gpu-descriptor-types",
1503 "hashbrown 0.15.5",
1504 ]
1505
1506 [[package]]
1507 name = "gpu-descriptor-types"
1508 version = "0.2.0"
1509 source = "registry+https://github.com/rust-lang/crates.io-index"
1510 checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
1511 dependencies = [
1512 "bitflags 2.13.0",
1513 ]
1514
1373 1515 [[package]]
1374 1516 name = "half"
1375 1517 version = "2.7.1"
@@ -1381,6 +1523,15 @@ dependencies = [
1381 1523 "zerocopy",
1382 1524 ]
1383 1525
1526 [[package]]
1527 name = "hashbrown"
1528 version = "0.15.5"
1529 source = "registry+https://github.com/rust-lang/crates.io-index"
1530 checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
1531 dependencies = [
1532 "foldhash",
1533 ]
1534
1384 1535 [[package]]
1385 1536 name = "hashbrown"
1386 1537 version = "0.17.1"
@@ -1405,6 +1556,12 @@ version = "0.4.3"
1405 1556 source = "registry+https://github.com/rust-lang/crates.io-index"
1406 1557 checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
1407 1558
1559 [[package]]
1560 name = "hexf-parse"
1561 version = "0.2.1"
1562 source = "registry+https://github.com/rust-lang/crates.io-index"
1563 checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
1564
1408 1565 [[package]]
1409 1566 name = "iana-time-zone"
1410 1567 version = "0.1.65"
@@ -1417,7 +1574,7 @@ dependencies = [
1417 1574 "js-sys",
1418 1575 "log",
1419 1576 "wasm-bindgen",
1420 "windows-core",
1577 "windows-core 0.62.2",
1421 1578 ]
1422 1579
1423 1580 [[package]]
@@ -1589,7 +1746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1589 1746 checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
1590 1747 dependencies = [
1591 1748 "equivalent",
1592 "hashbrown",
1749 "hashbrown 0.17.1",
1593 1750 ]
1594 1751
1595 1752 [[package]]
@@ -1713,6 +1870,17 @@ dependencies = [
1713 1870 "wasm-bindgen",
1714 1871 ]
1715 1872
1873 [[package]]
1874 name = "khronos-egl"
1875 version = "6.0.0"
1876 source = "registry+https://github.com/rust-lang/crates.io-index"
1877 checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
1878 dependencies = [
1879 "libc",
1880 "libloading",
1881 "pkg-config",
1882 ]
1883
1716 1884 [[package]]
1717 1885 name = "khronos_api"
1718 1886 version = "3.1.0"
@@ -1858,6 +2026,15 @@ dependencies = [
1858 2026 "libc",
1859 2027 ]
1860 2028
2029 [[package]]
2030 name = "malloc_buf"
2031 version = "0.0.6"
2032 source = "registry+https://github.com/rust-lang/crates.io-index"
2033 checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
2034 dependencies = [
2035 "libc",
2036 ]
2037
1861 2038 [[package]]
1862 2039 name = "maybe-rayon"
1863 2040 version = "0.1.1"
@@ -1892,6 +2069,21 @@ dependencies = [
1892 2069 "autocfg",
1893 2070 ]
1894 2071
2072 [[package]]
2073 name = "metal"
2074 version = "0.31.0"
2075 source = "registry+https://github.com/rust-lang/crates.io-index"
2076 checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e"
2077 dependencies = [
2078 "bitflags 2.13.0",
2079 "block",
2080 "core-graphics-types",
2081 "foreign-types",
2082 "log",
2083 "objc",
2084 "paste",
2085 ]
2086
1895 2087 [[package]]
1896 2088 name = "miniz_oxide"
1897 2089 version = "0.8.9"
@@ -1912,6 +2104,28 @@ dependencies = [
1912 2104 "pxfm",
1913 2105 ]
1914 2106
2107 [[package]]
2108 name = "naga"
2109 version = "24.0.0"
2110 source = "registry+https://github.com/rust-lang/crates.io-index"
2111 checksum = "e380993072e52eef724eddfcde0ed013b0c023c3f0417336ed041aa9f076994e"
2112 dependencies = [
2113 "arrayvec",
2114 "bit-set",
2115 "bitflags 2.13.0",
2116 "cfg_aliases",
2117 "codespan-reporting",
2118 "hexf-parse",
2119 "indexmap",
2120 "log",
2121 "rustc-hash 1.1.0",
2122 "spirv",
2123 "strum",
2124 "termcolor",
2125 "thiserror 2.0.18",
2126 "unicode-xid",
2127 ]
2128
1915 2129 [[package]]
1916 2130 name = "ndk"
1917 2131 version = "0.9.0"
@@ -1921,7 +2135,7 @@ dependencies = [
1921 2135 "bitflags 2.13.0",
1922 2136 "jni-sys 0.3.1",
1923 2137 "log",
1924 "ndk-sys",
2138 "ndk-sys 0.6.0+11769913",
1925 2139 "num_enum",
1926 2140 "raw-window-handle",
1927 2141 "thiserror 1.0.69",
@@ -1933,6 +2147,15 @@ version = "0.1.1"
1933 2147 source = "registry+https://github.com/rust-lang/crates.io-index"
1934 2148 checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
1935 2149
2150 [[package]]
2151 name = "ndk-sys"
2152 version = "0.5.0+25.2.9519653"
2153 source = "registry+https://github.com/rust-lang/crates.io-index"
2154 checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691"
2155 dependencies = [
2156 "jni-sys 0.3.1",
2157 ]
2158
1936 2159 [[package]]
1937 2160 name = "ndk-sys"
1938 2161 version = "0.6.0+11769913"
@@ -2071,6 +2294,15 @@ dependencies = [
2071 2294 "syn",
2072 2295 ]
2073 2296
2297 [[package]]
2298 name = "objc"
2299 version = "0.2.7"
2300 source = "registry+https://github.com/rust-lang/crates.io-index"
2301 checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
2302 dependencies = [
2303 "malloc_buf",
2304 ]
2305
2074 2306 [[package]]
2075 2307 name = "objc-sys"
2076 2308 version = "0.3.5"
@@ -2365,6 +2597,15 @@ dependencies = [
2365 2597 "libredox",
2366 2598 ]
2367 2599
2600 [[package]]
2601 name = "ordered-float"
2602 version = "4.6.0"
2603 source = "registry+https://github.com/rust-lang/crates.io-index"
2604 checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951"
2605 dependencies = [
2606 "num-traits",
2607 ]
2608
2368 2609 [[package]]
2369 2610 name = "ordered-stream"
2370 2611 version = "0.2.0"
@@ -2853,6 +3094,12 @@ dependencies = [
2853 3094 "bitflags 2.13.0",
2854 3095 ]
2855 3096
3097 [[package]]
3098 name = "renderdoc-sys"
3099 version = "1.1.0"
3100 source = "registry+https://github.com/rust-lang/crates.io-index"
3101 checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
3102
2856 3103 [[package]]
2857 3104 name = "rfd"
2858 3105 version = "0.15.4"
@@ -2893,6 +3140,18 @@ dependencies = [
2893 3140 "libusb1-sys",
2894 3141 ]
2895 3142
3143 [[package]]
3144 name = "rustc-hash"
3145 version = "1.1.0"
3146 source = "registry+https://github.com/rust-lang/crates.io-index"
3147 checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
3148
3149 [[package]]
3150 name = "rustc-hash"
3151 version = "2.1.3"
3152 source = "registry+https://github.com/rust-lang/crates.io-index"
3153 checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
3154
2896 3155 [[package]]
2897 3156 name = "rustc_version"
2898 3157 version = "0.4.1"
@@ -3102,6 +3361,31 @@ version = "1.15.2"
3102 3361 source = "registry+https://github.com/rust-lang/crates.io-index"
3103 3362 checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
3104 3363
3364 [[package]]
3365 name = "smithay-client-toolkit"
3366 version = "0.19.2"
3367 source = "registry+https://github.com/rust-lang/crates.io-index"
3368 checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
3369 dependencies = [
3370 "bitflags 2.13.0",
3371 "calloop 0.13.0",
3372 "calloop-wayland-source 0.3.0",
3373 "cursor-icon",
3374 "libc",
3375 "log",
3376 "memmap2",
3377 "rustix 0.38.44",
3378 "thiserror 1.0.69",
3379 "wayland-backend",
3380 "wayland-client",
3381 "wayland-csd-frame",
3382 "wayland-cursor",
3383 "wayland-protocols",
3384 "wayland-protocols-wlr",
3385 "wayland-scanner",
3386 "xkeysym",
3387 ]
3388
3105 3389 [[package]]
3106 3390 name = "smithay-client-toolkit"
3107 3391 version = "0.20.0"
@@ -3110,7 +3394,7 @@ checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0"
3110 3394 dependencies = [
3111 3395 "bitflags 2.13.0",
3112 3396 "calloop 0.14.4",
3113 "calloop-wayland-source",
3397 "calloop-wayland-source 0.4.1",
3114 3398 "cursor-icon",
3115 3399 "libc",
3116 3400 "log",
@@ -3136,7 +3420,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
3136 3420 checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226"
3137 3421 dependencies = [
3138 3422 "libc",
3139 "smithay-client-toolkit",
3423 "smithay-client-toolkit 0.20.0",
3140 3424 "wayland-backend",
3141 3425 ]
3142 3426
@@ -3149,6 +3433,15 @@ dependencies = [
3149 3433 "serde",
3150 3434 ]
3151 3435
3436 [[package]]
3437 name = "spirv"
3438 version = "0.3.0+sdk-1.3.268.0"
3439 source = "registry+https://github.com/rust-lang/crates.io-index"
3440 checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
3441 dependencies = [
3442 "bitflags 2.13.0",
3443 ]
3444
3152 3445 [[package]]
3153 3446 name = "stable_deref_trait"
3154 3447 version = "1.2.1"
@@ -3167,6 +3460,28 @@ version = "0.11.1"
3167 3460 source = "registry+https://github.com/rust-lang/crates.io-index"
3168 3461 checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
3169 3462
3463 [[package]]
3464 name = "strum"
3465 version = "0.26.3"
3466 source = "registry+https://github.com/rust-lang/crates.io-index"
3467 checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
3468 dependencies = [
3469 "strum_macros",
3470 ]
3471
3472 [[package]]
3473 name = "strum_macros"
3474 version = "0.26.4"
3475 source = "registry+https://github.com/rust-lang/crates.io-index"
3476 checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
3477 dependencies = [
3478 "heck",
3479 "proc-macro2",
3480 "quote",
3481 "rustversion",
3482 "syn",
3483 ]
3484
3170 3485 [[package]]
3171 3486 name = "syn"
3172 3487 version = "2.0.119"
@@ -3202,6 +3517,15 @@ dependencies = [
3202 3517 "windows-sys 0.61.2",
3203 3518 ]
3204 3519
3520 [[package]]
3521 name = "termcolor"
3522 version = "1.4.1"
3523 source = "registry+https://github.com/rust-lang/crates.io-index"
3524 checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
3525 dependencies = [
3526 "winapi-util",
3527 ]
3528
3205 3529 [[package]]
3206 3530 name = "thiserror"
3207 3531 version = "1.0.69"
@@ -3343,6 +3667,15 @@ version = "0.25.1"
3343 3667 source = "registry+https://github.com/rust-lang/crates.io-index"
3344 3668 checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
3345 3669
3670 [[package]]
3671 name = "type-map"
3672 version = "0.5.1"
3673 source = "registry+https://github.com/rust-lang/crates.io-index"
3674 checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90"
3675 dependencies = [
3676 "rustc-hash 2.1.3",
3677 ]
3678
3346 3679 [[package]]
3347 3680 name = "uds_windows"
3348 3681 version = "1.2.1"
@@ -3381,12 +3714,24 @@ version = "1.13.3"
3381 3714 source = "registry+https://github.com/rust-lang/crates.io-index"
3382 3715 checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
3383 3716
3717 [[package]]
3718 name = "unicode-width"
3719 version = "0.1.14"
3720 source = "registry+https://github.com/rust-lang/crates.io-index"
3721 checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
3722
3384 3723 [[package]]
3385 3724 name = "unicode-width"
3386 3725 version = "0.2.2"
3387 3726 source = "registry+https://github.com/rust-lang/crates.io-index"
3388 3727 checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
3389 3728
3729 [[package]]
3730 name = "unicode-xid"
3731 version = "0.2.6"
3732 source = "registry+https://github.com/rust-lang/crates.io-index"
3733 checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
3734
3390 3735 [[package]]
3391 3736 name = "url"
3392 3737 version = "2.5.8"
@@ -3612,6 +3957,19 @@ dependencies = [
3612 3957 "wayland-scanner",
3613 3958 ]
3614 3959
3960 [[package]]
3961 name = "wayland-protocols-plasma"
3962 version = "0.3.12"
3963 source = "registry+https://github.com/rust-lang/crates.io-index"
3964 checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91"
3965 dependencies = [
3966 "bitflags 2.13.0",
3967 "wayland-backend",
3968 "wayland-client",
3969 "wayland-protocols",
3970 "wayland-scanner",
3971 ]
3972
3615 3973 [[package]]
3616 3974 name = "wayland-protocols-wlr"
3617 3975 version = "0.3.12"
@@ -3690,6 +4048,109 @@ version = "0.1.12"
3690 4048 source = "registry+https://github.com/rust-lang/crates.io-index"
3691 4049 checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
3692 4050
4051 [[package]]
4052 name = "wgpu"
4053 version = "24.0.5"
4054 source = "registry+https://github.com/rust-lang/crates.io-index"
4055 checksum = "6b0b3436f0729f6cdf2e6e9201f3d39dc95813fad61d826c1ed07918b4539353"
4056 dependencies = [
4057 "arrayvec",
4058 "bitflags 2.13.0",
4059 "cfg_aliases",
4060 "document-features",
4061 "js-sys",
4062 "log",
4063 "parking_lot",
4064 "profiling",
4065 "raw-window-handle",
4066 "smallvec",
4067 "static_assertions",
4068 "wasm-bindgen",
4069 "wasm-bindgen-futures",
4070 "web-sys",
4071 "wgpu-core",
4072 "wgpu-hal",
4073 "wgpu-types",
4074 ]
4075
4076 [[package]]
4077 name = "wgpu-core"
4078 version = "24.0.5"
4079 source = "registry+https://github.com/rust-lang/crates.io-index"
4080 checksum = "7f0aa306497a238d169b9dc70659105b4a096859a34894544ca81719242e1499"
4081 dependencies = [
4082 "arrayvec",
4083 "bit-vec",
4084 "bitflags 2.13.0",
4085 "cfg_aliases",
4086 "document-features",
4087 "indexmap",
4088 "log",
4089 "naga",
4090 "once_cell",
4091 "parking_lot",
4092 "profiling",
4093 "raw-window-handle",
4094 "rustc-hash 1.1.0",
4095 "smallvec",
4096 "thiserror 2.0.18",
4097 "wgpu-hal",
4098 "wgpu-types",
4099 ]
4100
4101 [[package]]
4102 name = "wgpu-hal"
4103 version = "24.0.4"
4104 source = "registry+https://github.com/rust-lang/crates.io-index"
4105 checksum = "f112f464674ca69f3533248508ee30cb84c67cf06c25ff6800685f5e0294e259"
4106 dependencies = [
4107 "android_system_properties",
4108 "arrayvec",
4109 "ash",
4110 "bitflags 2.13.0",
4111 "bytemuck",
4112 "cfg_aliases",
4113 "core-graphics-types",
4114 "glow",
4115 "glutin_wgl_sys",
4116 "gpu-alloc",
4117 "gpu-descriptor",
4118 "js-sys",
4119 "khronos-egl",
4120 "libc",
4121 "libloading",
4122 "log",
4123 "metal",
4124 "naga",
4125 "ndk-sys 0.5.0+25.2.9519653",
4126 "objc",
4127 "once_cell",
4128 "ordered-float",
4129 "parking_lot",
4130 "profiling",
4131 "raw-window-handle",
4132 "renderdoc-sys",
4133 "rustc-hash 1.1.0",
4134 "smallvec",
4135 "thiserror 2.0.18",
4136 "wasm-bindgen",
4137 "web-sys",
4138 "wgpu-types",
4139 "windows",
4140 ]
4141
4142 [[package]]
4143 name = "wgpu-types"
4144 version = "24.0.0"
4145 source = "registry+https://github.com/rust-lang/crates.io-index"
4146 checksum = "50ac044c0e76c03a0378e7786ac505d010a873665e2d51383dcff8dd227dc69c"
4147 dependencies = [
4148 "bitflags 2.13.0",
4149 "js-sys",
4150 "log",
4151 "web-sys",
4152 ]
4153
3693 4154 [[package]]
3694 4155 name = "winapi"
3695 4156 version = "0.3.9"
@@ -3721,17 +4182,51 @@ version = "0.4.0"
3721 4182 source = "registry+https://github.com/rust-lang/crates.io-index"
3722 4183 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
3723 4184
4185 [[package]]
4186 name = "windows"
4187 version = "0.58.0"
4188 source = "registry+https://github.com/rust-lang/crates.io-index"
4189 checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
4190 dependencies = [
4191 "windows-core 0.58.0",
4192 "windows-targets 0.52.6",
4193 ]
4194
4195 [[package]]
4196 name = "windows-core"
4197 version = "0.58.0"
4198 source = "registry+https://github.com/rust-lang/crates.io-index"
4199 checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
4200 dependencies = [
4201 "windows-implement 0.58.0",
4202 "windows-interface 0.58.0",
4203 "windows-result 0.2.0",
4204 "windows-strings 0.1.0",
4205 "windows-targets 0.52.6",
4206 ]
4207
3724 4208 [[package]]
3725 4209 name = "windows-core"
3726 4210 version = "0.62.2"
3727 4211 source = "registry+https://github.com/rust-lang/crates.io-index"
3728 4212 checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
3729 4213 dependencies = [
3730 "windows-implement",
3731 "windows-interface",
4214 "windows-implement 0.60.2",
4215 "windows-interface 0.59.3",
3732 4216 "windows-link",
3733 "windows-result",
3734 "windows-strings",
4217 "windows-result 0.4.1",
4218 "windows-strings 0.5.1",
4219 ]
4220
4221 [[package]]
4222 name = "windows-implement"
4223 version = "0.58.0"
4224 source = "registry+https://github.com/rust-lang/crates.io-index"
4225 checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
4226 dependencies = [
4227 "proc-macro2",
4228 "quote",
4229 "syn",
3735 4230 ]
3736 4231
3737 4232 [[package]]
@@ -3745,6 +4240,17 @@ dependencies = [
3745 4240 "syn",
3746 4241 ]
3747 4242
4243 [[package]]
4244 name = "windows-interface"
4245 version = "0.58.0"
4246 source = "registry+https://github.com/rust-lang/crates.io-index"
4247 checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
4248 dependencies = [
4249 "proc-macro2",
4250 "quote",
4251 "syn",
4252 ]
4253
3748 4254 [[package]]
3749 4255 name = "windows-interface"
3750 4256 version = "0.59.3"
@@ -3762,6 +4268,15 @@ version = "0.2.1"
3762 4268 source = "registry+https://github.com/rust-lang/crates.io-index"
3763 4269 checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
3764 4270
4271 [[package]]
4272 name = "windows-result"
4273 version = "0.2.0"
4274 source = "registry+https://github.com/rust-lang/crates.io-index"
4275 checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
4276 dependencies = [
4277 "windows-targets 0.52.6",
4278 ]
4279
3765 4280 [[package]]
3766 4281 name = "windows-result"
3767 4282 version = "0.4.1"
@@ -3771,6 +4286,16 @@ dependencies = [
3771 4286 "windows-link",
3772 4287 ]
3773 4288
4289 [[package]]
4290 name = "windows-strings"
4291 version = "0.1.0"
4292 source = "registry+https://github.com/rust-lang/crates.io-index"
4293 checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
4294 dependencies = [
4295 "windows-result 0.2.0",
4296 "windows-targets 0.52.6",
4297 ]
4298
3774 4299 [[package]]
3775 4300 name = "windows-strings"
3776 4301 version = "0.5.1"
@@ -3951,10 +4476,12 @@ version = "0.30.13"
3951 4476 source = "registry+https://github.com/rust-lang/crates.io-index"
3952 4477 checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d"
3953 4478 dependencies = [
4479 "ahash",
3954 4480 "android-activity",
3955 4481 "atomic-waker",
3956 4482 "bitflags 2.13.0",
3957 4483 "block2 0.5.1",
4484 "bytemuck",
3958 4485 "calloop 0.13.0",
3959 4486 "cfg_aliases",
3960 4487 "concurrent-queue",
@@ -3964,24 +4491,33 @@ dependencies = [
3964 4491 "dpi",
3965 4492 "js-sys",
3966 4493 "libc",
4494 "memmap2",
3967 4495 "ndk",
3968 4496 "objc2 0.5.2",
3969 4497 "objc2-app-kit 0.2.2",
3970 4498 "objc2-foundation 0.2.2",
3971 4499 "objc2-ui-kit",
3972 4500 "orbclient",
4501 "percent-encoding",
3973 4502 "pin-project",
3974 4503 "raw-window-handle",
3975 4504 "redox_syscall 0.4.1",
3976 4505 "rustix 0.38.44",
4506 "smithay-client-toolkit 0.19.2",
3977 4507 "smol_str",
3978 4508 "tracing",
3979 4509 "unicode-segmentation",
3980 4510 "wasm-bindgen",
3981 4511 "wasm-bindgen-futures",
4512 "wayland-backend",
4513 "wayland-client",
4514 "wayland-protocols",
4515 "wayland-protocols-plasma",
3982 4516 "web-sys",
3983 4517 "web-time",
3984 4518 "windows-sys 0.52.0",
4519 "x11-dl",
4520 "x11rb",
3985 4521 "xkbcommon-dl",
3986 4522 ]
3987 4523
@@ -4025,13 +4561,28 @@ version = "0.6.3"
4025 4561 source = "registry+https://github.com/rust-lang/crates.io-index"
4026 4562 checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
4027 4563
4564 [[package]]
4565 name = "x11-dl"
4566 version = "2.21.0"
4567 source = "registry+https://github.com/rust-lang/crates.io-index"
4568 checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f"
4569 dependencies = [
4570 "libc",
4571 "once_cell",
4572 "pkg-config",
4573 ]
4574
4028 4575 [[package]]
4029 4576 name = "x11rb"
4030 4577 version = "0.13.2"
4031 4578 source = "registry+https://github.com/rust-lang/crates.io-index"
4032 4579 checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
4033 4580 dependencies = [
4581 "as-raw-xcb-connection",
4034 4582 "gethostname",
4583 "libc",
4584 "libloading",
4585 "once_cell",
4035 4586 "rustix 1.1.4",
4036 4587 "x11rb-protocol",
4037 4588 ]
@@ -31,6 +31,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
31checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
32dependencies = [
32dependencies = [
33 "cfg-if",
33 "cfg-if",
34 "getrandom 0.3.4",
34 "once_cell",
35 "once_cell",
35 "version_check",
36 "version_check",
36 "zerocopy",
37 "zerocopy",
@@ -68,7 +69,7 @@ dependencies = [
68 "log",
69 "log",
69 "ndk",
70 "ndk",
70 "ndk-context",
71 "ndk-context",
71 "ndk-sys",
72 "ndk-sys 0.6.0+11769913",
72 "num_enum",
73 "num_enum",
73 "thiserror 2.0.18",
74 "thiserror 2.0.18",
74]
75]
@@ -187,6 +188,12 @@ version = "0.7.8"
187source = "registry+https://github.com/rust-lang/crates.io-index"
188source = "registry+https://github.com/rust-lang/crates.io-index"
188checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
189checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
189
190
191[[package]]
192name = "as-raw-xcb-connection"
193version = "1.0.1"
194source = "registry+https://github.com/rust-lang/crates.io-index"
195checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
196
190[[package]]
197[[package]]
191name = "as-slice"
198name = "as-slice"
192version = "0.2.1"
199version = "0.2.1"
@@ -196,6 +203,15 @@ dependencies = [
196 "stable_deref_trait",
203 "stable_deref_trait",
197]
204]
198
205
206[[package]]
207name = "ash"
208version = "0.38.0+1.3.281"
209source = "registry+https://github.com/rust-lang/crates.io-index"
210checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"
211dependencies = [
212 "libloading",
213]
214
199[[package]]
215[[package]]
200name = "ashpd"
216name = "ashpd"
201version = "0.11.1"
217version = "0.11.1"
@@ -435,6 +451,21 @@ dependencies = [
435 "image",
451 "image",
436]
452]
437
453
454[[package]]
455name = "bit-set"
456version = "0.8.0"
457source = "registry+https://github.com/rust-lang/crates.io-index"
458checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
459dependencies = [
460 "bit-vec",
461]
462
463[[package]]
464name = "bit-vec"
465version = "0.8.0"
466source = "registry+https://github.com/rust-lang/crates.io-index"
467checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
468
438[[package]]
469[[package]]
439name = "bit_field"
470name = "bit_field"
440version = "0.10.3"
471version = "0.10.3"
@@ -452,6 +483,9 @@ name = "bitflags"
452version = "2.13.0"
483version = "2.13.0"
453source = "registry+https://github.com/rust-lang/crates.io-index"
484source = "registry+https://github.com/rust-lang/crates.io-index"
454checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
485checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
486dependencies = [
487 "serde_core",
488]
455
489
456[[package]]
490[[package]]
457name = "bitstream-io"
491name = "bitstream-io"
@@ -462,6 +496,12 @@ dependencies = [
462 "no_std_io2",
496 "no_std_io2",
463]
497]
464
498
499[[package]]
500name = "block"
501version = "0.1.6"
502source = "registry+https://github.com/rust-lang/crates.io-index"
503checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
504
465[[package]]
505[[package]]
466name = "block2"
506name = "block2"
467version = "0.5.1"
507version = "0.5.1"
@@ -570,6 +610,18 @@ dependencies = [
570 "tracing",
610 "tracing",
571]
611]
572
612
613[[package]]
614name = "calloop-wayland-source"
615version = "0.3.0"
616source = "registry+https://github.com/rust-lang/crates.io-index"
617checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
618dependencies = [
619 "calloop 0.13.0",
620 "rustix 0.38.44",
621 "wayland-backend",
622 "wayland-client",
623]
624
573[[package]]
625[[package]]
574name = "calloop-wayland-source"
626name = "calloop-wayland-source"
575version = "0.4.1"
627version = "0.4.1"
@@ -675,6 +727,16 @@ dependencies = [
675 "error-code",
727 "error-code",
676]
728]
677
729
730[[package]]
731name = "codespan-reporting"
732version = "0.11.1"
733source = "registry+https://github.com/rust-lang/crates.io-index"
734checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
735dependencies = [
736 "termcolor",
737 "unicode-width 0.1.14",
738]
739
678[[package]]
740[[package]]
679name = "color_quant"
741name = "color_quant"
680version = "1.1.0"
742version = "1.1.0"
@@ -881,6 +943,7 @@ dependencies = [
881 "bytemuck",
943 "bytemuck",
882 "document-features",
944 "document-features",
883 "egui",
945 "egui",
946 "egui-wgpu",
884 "egui-winit",
947 "egui-winit",
885 "egui_glow",
948 "egui_glow",
886 "glow",
949 "glow",
@@ -921,6 +984,26 @@ dependencies = [
921 "profiling",
984 "profiling",
922]
985]
923
986
987[[package]]
988name = "egui-wgpu"
989version = "0.31.1"
990source = "registry+https://github.com/rust-lang/crates.io-index"
991checksum = "d319dfef570f699b6e9114e235e862a2ddcf75f0d1a061de9e1328d92146d820"
992dependencies = [
993 "ahash",
994 "bytemuck",
995 "document-features",
996 "egui",
997 "epaint",
998 "log",
999 "profiling",
1000 "thiserror 1.0.69",
1001 "type-map",
1002 "web-time",
1003 "wgpu",
1004 "winit",
1005]
1006
924[[package]]
1007[[package]]
925name = "egui-winit"
1008name = "egui-winit"
926version = "0.31.1"
1009version = "0.31.1"
@@ -955,6 +1038,7 @@ dependencies = [
955 "profiling",
1038 "profiling",
956 "wasm-bindgen",
1039 "wasm-bindgen",
957 "web-sys",
1040 "web-sys",
1041 "winit",
958]
1042]
959
1043
960[[package]]
1044[[package]]
@@ -1140,6 +1224,12 @@ dependencies = [
1140 "miniz_oxide",
1224 "miniz_oxide",
1141]
1225]
1142
1226
1227[[package]]
1228name = "foldhash"
1229version = "0.1.5"
1230source = "registry+https://github.com/rust-lang/crates.io-index"
1231checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
1232
1143[[package]]
1233[[package]]
1144name = "foreign-types"
1234name = "foreign-types"
1145version = "0.5.0"
1235version = "0.5.0"
@@ -1258,7 +1348,7 @@ version = "0.2.24"
1258source = "registry+https://github.com/rust-lang/crates.io-index"
1348source = "registry+https://github.com/rust-lang/crates.io-index"
1259checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df"
1349checksum = "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df"
1260dependencies = [
1350dependencies = [
1261 "unicode-width",
1351 "unicode-width 0.2.2",
1262]
1352]
1263
1353
1264[[package]]
1354[[package]]
@@ -1328,6 +1418,7 @@ dependencies = [
1328 "cgl",
1418 "cgl",
1329 "dispatch2",
1419 "dispatch2",
1330 "glutin_egl_sys",
1420 "glutin_egl_sys",
1421 "glutin_glx_sys",
1331 "glutin_wgl_sys",
1422 "glutin_wgl_sys",
1332 "libloading",
1423 "libloading",
1333 "objc2 0.6.4",
1424 "objc2 0.6.4",
@@ -1336,7 +1427,9 @@ dependencies = [
1336 "objc2-foundation 0.3.2",
1427 "objc2-foundation 0.3.2",
1337 "once_cell",
1428 "once_cell",
1338 "raw-window-handle",
1429 "raw-window-handle",
1430 "wayland-sys",
1339 "windows-sys 0.52.0",
1431 "windows-sys 0.52.0",
1432 "x11-dl",
1340]
1433]
1341
1434
1342[[package]]
1435[[package]]
@@ -1361,6 +1454,16 @@ dependencies = [
1361 "windows-sys 0.52.0",
1454 "windows-sys 0.52.0",
1362]
1455]
1363
1456
1457[[package]]
1458name = "glutin_glx_sys"
1459version = "0.6.1"
1460source = "registry+https://github.com/rust-lang/crates.io-index"
1461checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185"
1462dependencies = [
1463 "gl_generator",
1464 "x11-dl",
1465]
1466
1364[[package]]
1467[[package]]
1365name = "glutin_wgl_sys"
1468name = "glutin_wgl_sys"
1366version = "0.6.1"
1469version = "0.6.1"
@@ -1370,6 +1473,45 @@ dependencies = [
1370 "gl_generator",
1473 "gl_generator",
1371]
1474]
1372
1475
1476[[package]]
1477name = "gpu-alloc"
1478version = "0.6.2"
1479source = "registry+https://github.com/rust-lang/crates.io-index"
1480checksum = "45cf04b2726f02df5508c6de726acdc90cdf97ac771a9a0ffd8ba10a6e696bf9"
1481dependencies = [
1482 "bitflags 2.13.0",
1483 "gpu-alloc-types",
1484]
1485
1486[[package]]
1487name = "gpu-alloc-types"
1488version = "0.3.1"
1489source = "registry+https://github.com/rust-lang/crates.io-index"
1490checksum = "b2bbed164dd10ed526c2e4fe3e721ca4a71c61730e5aafac6844b417b3227058"
1491dependencies = [
1492 "bitflags 2.13.0",
1493]
1494
1495[[package]]
1496name = "gpu-descriptor"
1497version = "0.3.2"
1498source = "registry+https://github.com/rust-lang/crates.io-index"
1499checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca"
1500dependencies = [
1501 "bitflags 2.13.0",
1502 "gpu-descriptor-types",
1503 "hashbrown 0.15.5",
1504]
1505
1506[[package]]
1507name = "gpu-descriptor-types"
1508version = "0.2.0"
1509source = "registry+https://github.com/rust-lang/crates.io-index"
1510checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91"
1511dependencies = [
1512 "bitflags 2.13.0",
1513]
1514
1373[[package]]
1515[[package]]
1374name = "half"
1516name = "half"
1375version = "2.7.1"
1517version = "2.7.1"
@@ -1381,6 +1523,15 @@ dependencies = [
1381 "zerocopy",
1523 "zerocopy",
1382]
1524]
1383
1525
1526[[package]]
1527name = "hashbrown"
1528version = "0.15.5"
1529source = "registry+https://github.com/rust-lang/crates.io-index"
1530checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
1531dependencies = [
1532 "foldhash",
1533]
1534
1384[[package]]
1535[[package]]
1385name = "hashbrown"
1536name = "hashbrown"
1386version = "0.17.1"
1537version = "0.17.1"
@@ -1405,6 +1556,12 @@ version = "0.4.3"
1405source = "registry+https://github.com/rust-lang/crates.io-index"
1556source = "registry+https://github.com/rust-lang/crates.io-index"
1406checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
1557checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
1407
1558
1559[[package]]
1560name = "hexf-parse"
1561version = "0.2.1"
1562source = "registry+https://github.com/rust-lang/crates.io-index"
1563checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
1564
1408[[package]]
1565[[package]]
1409name = "iana-time-zone"
1566name = "iana-time-zone"
1410version = "0.1.65"
1567version = "0.1.65"
@@ -1417,7 +1574,7 @@ dependencies = [
1417 "js-sys",
1574 "js-sys",
1418 "log",
1575 "log",
1419 "wasm-bindgen",
1576 "wasm-bindgen",
1420 "windows-core",
1577 "windows-core 0.62.2",
1421]
1578]
1422
1579
1423[[package]]
1580[[package]]
@@ -1589,7 +1746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1589checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
1746checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
1590dependencies = [
1747dependencies = [
1591 "equivalent",
1748 "equivalent",
1592 "hashbrown",
1749 "hashbrown 0.17.1",
1593]
1750]
1594
1751
1595[[package]]
1752[[package]]
@@ -1713,6 +1870,17 @@ dependencies = [
1713 "wasm-bindgen",
1870 "wasm-bindgen",
1714]
1871]
1715
1872
1873[[package]]
1874name = "khronos-egl"
1875version = "6.0.0"
1876source = "registry+https://github.com/rust-lang/crates.io-index"
1877checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
1878dependencies = [
1879 "libc",
1880 "libloading",
1881 "pkg-config",
1882]
1883
1716[[package]]
1884[[package]]
1717name = "khronos_api"
1885name = "khronos_api"
1718version = "3.1.0"
1886version = "3.1.0"
@@ -1858,6 +2026,15 @@ dependencies = [
1858 "libc",
2026 "libc",
1859]
2027]
1860
2028
2029[[package]]
2030name = "malloc_buf"
2031version = "0.0.6"
2032source = "registry+https://github.com/rust-lang/crates.io-index"
2033checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
2034dependencies = [
2035 "libc",
2036]
2037
1861[[package]]
2038[[package]]
1862name = "maybe-rayon"
2039name = "maybe-rayon"
1863version = "0.1.1"
2040version = "0.1.1"
@@ -1892,6 +2069,21 @@ dependencies = [
1892 "autocfg",
2069 "autocfg",
1893]
2070]
1894
2071
2072[[package]]
2073name = "metal"
2074version = "0.31.0"
2075source = "registry+https://github.com/rust-lang/crates.io-index"
2076checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e"
2077dependencies = [
2078 "bitflags 2.13.0",
2079 "block",
2080 "core-graphics-types",
2081 "foreign-types",
2082 "log",
2083 "objc",
2084 "paste",
2085]
2086
1895[[package]]
2087[[package]]
1896name = "miniz_oxide"
2088name = "miniz_oxide"
1897version = "0.8.9"
2089version = "0.8.9"
@@ -1912,6 +2104,28 @@ dependencies = [
1912 "pxfm",
2104 "pxfm",
1913]
2105]
1914
2106
2107[[package]]
2108name = "naga"
2109version = "24.0.0"
2110source = "registry+https://github.com/rust-lang/crates.io-index"
2111checksum = "e380993072e52eef724eddfcde0ed013b0c023c3f0417336ed041aa9f076994e"
2112dependencies = [
2113 "arrayvec",
2114 "bit-set",
2115 "bitflags 2.13.0",
2116 "cfg_aliases",
2117 "codespan-reporting",
2118 "hexf-parse",
2119 "indexmap",
2120 "log",
2121 "rustc-hash 1.1.0",
2122 "spirv",
2123 "strum",
2124 "termcolor",
2125 "thiserror 2.0.18",
2126 "unicode-xid",
2127]
2128
1915[[package]]
2129[[package]]
1916name = "ndk"
2130name = "ndk"
1917version = "0.9.0"
2131version = "0.9.0"
@@ -1921,7 +2135,7 @@ dependencies = [
1921 "bitflags 2.13.0",
2135 "bitflags 2.13.0",
1922 "jni-sys 0.3.1",
2136 "jni-sys 0.3.1",
1923 "log",
2137 "log",
1924 "ndk-sys",
2138 "ndk-sys 0.6.0+11769913",
1925 "num_enum",
2139 "num_enum",
1926 "raw-window-handle",
2140 "raw-window-handle",
1927 "thiserror 1.0.69",
2141 "thiserror 1.0.69",
@@ -1933,6 +2147,15 @@ version = "0.1.1"
1933source = "registry+https://github.com/rust-lang/crates.io-index"
2147source = "registry+https://github.com/rust-lang/crates.io-index"
1934checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
2148checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
1935
2149
2150[[package]]
2151name = "ndk-sys"
2152version = "0.5.0+25.2.9519653"
2153source = "registry+https://github.com/rust-lang/crates.io-index"
2154checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691"
2155dependencies = [
2156 "jni-sys 0.3.1",
2157]
2158
1936[[package]]
2159[[package]]
1937name = "ndk-sys"
2160name = "ndk-sys"
1938version = "0.6.0+11769913"
2161version = "0.6.0+11769913"
@@ -2071,6 +2294,15 @@ dependencies = [
2071 "syn",
2294 "syn",
2072]
2295]
2073
2296
2297[[package]]
2298name = "objc"
2299version = "0.2.7"
2300source = "registry+https://github.com/rust-lang/crates.io-index"
2301checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
2302dependencies = [
2303 "malloc_buf",
2304]
2305
2074[[package]]
2306[[package]]
2075name = "objc-sys"
2307name = "objc-sys"
2076version = "0.3.5"
2308version = "0.3.5"
@@ -2365,6 +2597,15 @@ dependencies = [
2365 "libredox",
2597 "libredox",
2366]
2598]
2367
2599
2600[[package]]
2601name = "ordered-float"
2602version = "4.6.0"
2603source = "registry+https://github.com/rust-lang/crates.io-index"
2604checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951"
2605dependencies = [
2606 "num-traits",
2607]
2608
2368[[package]]
2609[[package]]
2369name = "ordered-stream"
2610name = "ordered-stream"
2370version = "0.2.0"
2611version = "0.2.0"
@@ -2853,6 +3094,12 @@ dependencies = [
2853 "bitflags 2.13.0",
3094 "bitflags 2.13.0",
2854]
3095]
2855
3096
3097[[package]]
3098name = "renderdoc-sys"
3099version = "1.1.0"
3100source = "registry+https://github.com/rust-lang/crates.io-index"
3101checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
3102
2856[[package]]
3103[[package]]
2857name = "rfd"
3104name = "rfd"
2858version = "0.15.4"
3105version = "0.15.4"
@@ -2893,6 +3140,18 @@ dependencies = [
2893 "libusb1-sys",
3140 "libusb1-sys",
2894]
3141]
2895
3142
3143[[package]]
3144name = "rustc-hash"
3145version = "1.1.0"
3146source = "registry+https://github.com/rust-lang/crates.io-index"
3147checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
3148
3149[[package]]
3150name = "rustc-hash"
3151version = "2.1.3"
3152source = "registry+https://github.com/rust-lang/crates.io-index"
3153checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
3154
2896[[package]]
3155[[package]]
2897name = "rustc_version"
3156name = "rustc_version"
2898version = "0.4.1"
3157version = "0.4.1"
@@ -3102,6 +3361,31 @@ version = "1.15.2"
3102source = "registry+https://github.com/rust-lang/crates.io-index"
3361source = "registry+https://github.com/rust-lang/crates.io-index"
3103checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
3362checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
3104
3363
3364[[package]]
3365name = "smithay-client-toolkit"
3366version = "0.19.2"
3367source = "registry+https://github.com/rust-lang/crates.io-index"
3368checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
3369dependencies = [
3370 "bitflags 2.13.0",
3371 "calloop 0.13.0",
3372 "calloop-wayland-source 0.3.0",
3373 "cursor-icon",
3374 "libc",
3375 "log",
3376 "memmap2",
3377 "rustix 0.38.44",
3378 "thiserror 1.0.69",
3379 "wayland-backend",
3380 "wayland-client",
3381 "wayland-csd-frame",
3382 "wayland-cursor",
3383 "wayland-protocols",
3384 "wayland-protocols-wlr",
3385 "wayland-scanner",
3386 "xkeysym",
3387]
3388
3105[[package]]
3389[[package]]
3106name = "smithay-client-toolkit"
3390name = "smithay-client-toolkit"
3107version = "0.20.0"
3391version = "0.20.0"
@@ -3110,7 +3394,7 @@ checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0"
3110dependencies = [
3394dependencies = [
3111 "bitflags 2.13.0",
3395 "bitflags 2.13.0",
3112 "calloop 0.14.4",
3396 "calloop 0.14.4",
3113 "calloop-wayland-source",
3397 "calloop-wayland-source 0.4.1",
3114 "cursor-icon",
3398 "cursor-icon",
3115 "libc",
3399 "libc",
3116 "log",
3400 "log",
@@ -3136,7 +3420,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
3136checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226"
3420checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226"
3137dependencies = [
3421dependencies = [
3138 "libc",
3422 "libc",
3139 "smithay-client-toolkit",
3423 "smithay-client-toolkit 0.20.0",
3140 "wayland-backend",
3424 "wayland-backend",
3141]
3425]
3142
3426
@@ -3149,6 +3433,15 @@ dependencies = [
3149 "serde",
3433 "serde",
3150]
3434]
3151
3435
3436[[package]]
3437name = "spirv"
3438version = "0.3.0+sdk-1.3.268.0"
3439source = "registry+https://github.com/rust-lang/crates.io-index"
3440checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"
3441dependencies = [
3442 "bitflags 2.13.0",
3443]
3444
3152[[package]]
3445[[package]]
3153name = "stable_deref_trait"
3446name = "stable_deref_trait"
3154version = "1.2.1"
3447version = "1.2.1"
@@ -3167,6 +3460,28 @@ version = "0.11.1"
3167source = "registry+https://github.com/rust-lang/crates.io-index"
3460source = "registry+https://github.com/rust-lang/crates.io-index"
3168checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
3461checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
3169
3462
3463[[package]]
3464name = "strum"
3465version = "0.26.3"
3466source = "registry+https://github.com/rust-lang/crates.io-index"
3467checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
3468dependencies = [
3469 "strum_macros",
3470]
3471
3472[[package]]
3473name = "strum_macros"
3474version = "0.26.4"
3475source = "registry+https://github.com/rust-lang/crates.io-index"
3476checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
3477dependencies = [
3478 "heck",
3479 "proc-macro2",
3480 "quote",
3481 "rustversion",
3482 "syn",
3483]
3484
3170[[package]]
3485[[package]]
3171name = "syn"
3486name = "syn"
3172version = "2.0.119"
3487version = "2.0.119"
@@ -3202,6 +3517,15 @@ dependencies = [
3202 "windows-sys 0.61.2",
3517 "windows-sys 0.61.2",
3203]
3518]
3204
3519
3520[[package]]
3521name = "termcolor"
3522version = "1.4.1"
3523source = "registry+https://github.com/rust-lang/crates.io-index"
3524checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
3525dependencies = [
3526 "winapi-util",
3527]
3528
3205[[package]]
3529[[package]]
3206name = "thiserror"
3530name = "thiserror"
3207version = "1.0.69"
3531version = "1.0.69"
@@ -3343,6 +3667,15 @@ version = "0.25.1"
3343source = "registry+https://github.com/rust-lang/crates.io-index"
3667source = "registry+https://github.com/rust-lang/crates.io-index"
3344checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
3668checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
3345
3669
3670[[package]]
3671name = "type-map"
3672version = "0.5.1"
3673source = "registry+https://github.com/rust-lang/crates.io-index"
3674checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90"
3675dependencies = [
3676 "rustc-hash 2.1.3",
3677]
3678
3346[[package]]
3679[[package]]
3347name = "uds_windows"
3680name = "uds_windows"
3348version = "1.2.1"
3681version = "1.2.1"
@@ -3381,12 +3714,24 @@ version = "1.13.3"
3381source = "registry+https://github.com/rust-lang/crates.io-index"
3714source = "registry+https://github.com/rust-lang/crates.io-index"
3382checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
3715checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
3383
3716
3717[[package]]
3718name = "unicode-width"
3719version = "0.1.14"
3720source = "registry+https://github.com/rust-lang/crates.io-index"
3721checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
3722
3384[[package]]
3723[[package]]
3385name = "unicode-width"
3724name = "unicode-width"
3386version = "0.2.2"
3725version = "0.2.2"
3387source = "registry+https://github.com/rust-lang/crates.io-index"
3726source = "registry+https://github.com/rust-lang/crates.io-index"
3388checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
3727checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
3389
3728
3729[[package]]
3730name = "unicode-xid"
3731version = "0.2.6"
3732source = "registry+https://github.com/rust-lang/crates.io-index"
3733checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
3734
3390[[package]]
3735[[package]]
3391name = "url"
3736name = "url"
3392version = "2.5.8"
3737version = "2.5.8"
@@ -3612,6 +3957,19 @@ dependencies = [
3612 "wayland-scanner",
3957 "wayland-scanner",
3613]
3958]
3614
3959
3960[[package]]
3961name = "wayland-protocols-plasma"
3962version = "0.3.12"
3963source = "registry+https://github.com/rust-lang/crates.io-index"
3964checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91"
3965dependencies = [
3966 "bitflags 2.13.0",
3967 "wayland-backend",
3968 "wayland-client",
3969 "wayland-protocols",
3970 "wayland-scanner",
3971]
3972
3615[[package]]
3973[[package]]
3616name = "wayland-protocols-wlr"
3974name = "wayland-protocols-wlr"
3617version = "0.3.12"
3975version = "0.3.12"
@@ -3690,6 +4048,109 @@ version = "0.1.12"
3690source = "registry+https://github.com/rust-lang/crates.io-index"
4048source = "registry+https://github.com/rust-lang/crates.io-index"
3691checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
4049checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
3692
4050
4051[[package]]
4052name = "wgpu"
4053version = "24.0.5"
4054source = "registry+https://github.com/rust-lang/crates.io-index"
4055checksum = "6b0b3436f0729f6cdf2e6e9201f3d39dc95813fad61d826c1ed07918b4539353"
4056dependencies = [
4057 "arrayvec",
4058 "bitflags 2.13.0",
4059 "cfg_aliases",
4060 "document-features",
4061 "js-sys",
4062 "log",
4063 "parking_lot",
4064 "profiling",
4065 "raw-window-handle",
4066 "smallvec",
4067 "static_assertions",
4068 "wasm-bindgen",
4069 "wasm-bindgen-futures",
4070 "web-sys",
4071 "wgpu-core",
4072 "wgpu-hal",
4073 "wgpu-types",
4074]
4075
4076[[package]]
4077name = "wgpu-core"
4078version = "24.0.5"
4079source = "registry+https://github.com/rust-lang/crates.io-index"
4080checksum = "7f0aa306497a238d169b9dc70659105b4a096859a34894544ca81719242e1499"
4081dependencies = [
4082 "arrayvec",
4083 "bit-vec",
4084 "bitflags 2.13.0",
4085 "cfg_aliases",
4086 "document-features",
4087 "indexmap",
4088 "log",
4089 "naga",
4090 "once_cell",
4091 "parking_lot",
4092 "profiling",
4093 "raw-window-handle",
4094 "rustc-hash 1.1.0",
4095 "smallvec",
4096 "thiserror 2.0.18",
4097 "wgpu-hal",
4098 "wgpu-types",
4099]
4100
4101[[package]]
4102name = "wgpu-hal"
4103version = "24.0.4"
4104source = "registry+https://github.com/rust-lang/crates.io-index"
4105checksum = "f112f464674ca69f3533248508ee30cb84c67cf06c25ff6800685f5e0294e259"
4106dependencies = [
4107 "android_system_properties",
4108 "arrayvec",
4109 "ash",
4110 "bitflags 2.13.0",
4111 "bytemuck",
4112 "cfg_aliases",
4113 "core-graphics-types",
4114 "glow",
4115 "glutin_wgl_sys",
4116 "gpu-alloc",
4117 "gpu-descriptor",
4118 "js-sys",
4119 "khronos-egl",
4120 "libc",
4121 "libloading",
4122 "log",
4123 "metal",
4124 "naga",
4125 "ndk-sys 0.5.0+25.2.9519653",
4126 "objc",
4127 "once_cell",
4128 "ordered-float",
4129 "parking_lot",
4130 "profiling",
4131 "raw-window-handle",
4132 "renderdoc-sys",
4133 "rustc-hash 1.1.0",
4134 "smallvec",
4135 "thiserror 2.0.18",
4136 "wasm-bindgen",
4137 "web-sys",
4138 "wgpu-types",
4139 "windows",
4140]
4141
4142[[package]]
4143name = "wgpu-types"
4144version = "24.0.0"
4145source = "registry+https://github.com/rust-lang/crates.io-index"
4146checksum = "50ac044c0e76c03a0378e7786ac505d010a873665e2d51383dcff8dd227dc69c"
4147dependencies = [
4148 "bitflags 2.13.0",
4149 "js-sys",
4150 "log",
4151 "web-sys",
4152]
4153
3693[[package]]
4154[[package]]
3694name = "winapi"
4155name = "winapi"
3695version = "0.3.9"
4156version = "0.3.9"
@@ -3721,17 +4182,51 @@ version = "0.4.0"
3721source = "registry+https://github.com/rust-lang/crates.io-index"
4182source = "registry+https://github.com/rust-lang/crates.io-index"
3722checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
4183checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
3723
4184
4185[[package]]
4186name = "windows"
4187version = "0.58.0"
4188source = "registry+https://github.com/rust-lang/crates.io-index"
4189checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
4190dependencies = [
4191 "windows-core 0.58.0",
4192 "windows-targets 0.52.6",
4193]
4194
4195[[package]]
4196name = "windows-core"
4197version = "0.58.0"
4198source = "registry+https://github.com/rust-lang/crates.io-index"
4199checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
4200dependencies = [
4201 "windows-implement 0.58.0",
4202 "windows-interface 0.58.0",
4203 "windows-result 0.2.0",
4204 "windows-strings 0.1.0",
4205 "windows-targets 0.52.6",
4206]
4207
3724[[package]]
4208[[package]]
3725name = "windows-core"
4209name = "windows-core"
3726version = "0.62.2"
4210version = "0.62.2"
3727source = "registry+https://github.com/rust-lang/crates.io-index"
4211source = "registry+https://github.com/rust-lang/crates.io-index"
3728checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
4212checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
3729dependencies = [
4213dependencies = [
3730 "windows-implement",
4214 "windows-implement 0.60.2",
3731 "windows-interface",
4215 "windows-interface 0.59.3",
3732 "windows-link",
4216 "windows-link",
3733 "windows-result",
4217 "windows-result 0.4.1",
3734 "windows-strings",
4218 "windows-strings 0.5.1",
4219]
4220
4221[[package]]
4222name = "windows-implement"
4223version = "0.58.0"
4224source = "registry+https://github.com/rust-lang/crates.io-index"
4225checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
4226dependencies = [
4227 "proc-macro2",
4228 "quote",
4229 "syn",
3735]
4230]
3736
4231
3737[[package]]
4232[[package]]
@@ -3745,6 +4240,17 @@ dependencies = [
3745 "syn",
4240 "syn",
3746]
4241]
3747
4242
4243[[package]]
4244name = "windows-interface"
4245version = "0.58.0"
4246source = "registry+https://github.com/rust-lang/crates.io-index"
4247checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
4248dependencies = [
4249 "proc-macro2",
4250 "quote",
4251 "syn",
4252]
4253
3748[[package]]
4254[[package]]
3749name = "windows-interface"
4255name = "windows-interface"
3750version = "0.59.3"
4256version = "0.59.3"
@@ -3762,6 +4268,15 @@ version = "0.2.1"
3762source = "registry+https://github.com/rust-lang/crates.io-index"
4268source = "registry+https://github.com/rust-lang/crates.io-index"
3763checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
4269checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
3764
4270
4271[[package]]
4272name = "windows-result"
4273version = "0.2.0"
4274source = "registry+https://github.com/rust-lang/crates.io-index"
4275checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
4276dependencies = [
4277 "windows-targets 0.52.6",
4278]
4279
3765[[package]]
4280[[package]]
3766name = "windows-result"
4281name = "windows-result"
3767version = "0.4.1"
4282version = "0.4.1"
@@ -3771,6 +4286,16 @@ dependencies = [
3771 "windows-link",
4286 "windows-link",
3772]
4287]
3773
4288
4289[[package]]
4290name = "windows-strings"
4291version = "0.1.0"
4292source = "registry+https://github.com/rust-lang/crates.io-index"
4293checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
4294dependencies = [
4295 "windows-result 0.2.0",
4296 "windows-targets 0.52.6",
4297]
4298
3774[[package]]
4299[[package]]
3775name = "windows-strings"
4300name = "windows-strings"
3776version = "0.5.1"
4301version = "0.5.1"
@@ -3951,10 +4476,12 @@ version = "0.30.13"
3951source = "registry+https://github.com/rust-lang/crates.io-index"
4476source = "registry+https://github.com/rust-lang/crates.io-index"
3952checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d"
4477checksum = "a6755fa58a9f8350bd1e472d4c3fcc25f824ec358933bba33306d0b63df5978d"
3953dependencies = [
4478dependencies = [
4479 "ahash",
3954 "android-activity",
4480 "android-activity",
3955 "atomic-waker",
4481 "atomic-waker",
3956 "bitflags 2.13.0",
4482 "bitflags 2.13.0",
3957 "block2 0.5.1",
4483 "block2 0.5.1",
4484 "bytemuck",
3958 "calloop 0.13.0",
4485 "calloop 0.13.0",
3959 "cfg_aliases",
4486 "cfg_aliases",
3960 "concurrent-queue",
4487 "concurrent-queue",
@@ -3964,24 +4491,33 @@ dependencies = [
3964 "dpi",
4491 "dpi",
3965 "js-sys",
4492 "js-sys",
3966 "libc",
4493 "libc",
4494 "memmap2",
3967 "ndk",
4495 "ndk",
3968 "objc2 0.5.2",
4496 "objc2 0.5.2",
3969 "objc2-app-kit 0.2.2",
4497 "objc2-app-kit 0.2.2",
3970 "objc2-foundation 0.2.2",
4498 "objc2-foundation 0.2.2",
3971 "objc2-ui-kit",
4499 "objc2-ui-kit",
3972 "orbclient",
4500 "orbclient",
4501 "percent-encoding",
3973 "pin-project",
4502 "pin-project",
3974 "raw-window-handle",
4503 "raw-window-handle",
3975 "redox_syscall 0.4.1",
4504 "redox_syscall 0.4.1",
3976 "rustix 0.38.44",
4505 "rustix 0.38.44",
4506 "smithay-client-toolkit 0.19.2",
3977 "smol_str",
4507 "smol_str",
3978 "tracing",
4508 "tracing",
3979 "unicode-segmentation",
4509 "unicode-segmentation",
3980 "wasm-bindgen",
4510 "wasm-bindgen",
3981 "wasm-bindgen-futures",
4511 "wasm-bindgen-futures",
4512 "wayland-backend",
4513 "wayland-client",
4514 "wayland-protocols",
4515 "wayland-protocols-plasma",
3982 "web-sys",
4516 "web-sys",
3983 "web-time",
4517 "web-time",
3984 "windows-sys 0.52.0",
4518 "windows-sys 0.52.0",
4519 "x11-dl",
4520 "x11rb",
3985 "xkbcommon-dl",
4521 "xkbcommon-dl",
3986]
4522]
3987
4523
@@ -4025,13 +4561,28 @@ version = "0.6.3"
4025source = "registry+https://github.com/rust-lang/crates.io-index"
4561source = "registry+https://github.com/rust-lang/crates.io-index"
4026checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
4562checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
4027
4563
4564[[package]]
4565name = "x11-dl"
4566version = "2.21.0"
4567source = "registry+https://github.com/rust-lang/crates.io-index"
4568checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f"
4569dependencies = [
4570 "libc",
4571 "once_cell",
4572 "pkg-config",
4573]
4574
4028[[package]]
4575[[package]]
4029name = "x11rb"
4576name = "x11rb"
4030version = "0.13.2"
4577version = "0.13.2"
4031source = "registry+https://github.com/rust-lang/crates.io-index"
4578source = "registry+https://github.com/rust-lang/crates.io-index"
4032checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
4579checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
4033dependencies = [
4580dependencies = [
4581 "as-raw-xcb-connection",
4034 "gethostname",
4582 "gethostname",
4583 "libc",
4584 "libloading",
4585 "once_cell",
4035 "rustix 1.1.4",
4586 "rustix 1.1.4",
4036 "x11rb-protocol",
4587 "x11rb-protocol",
4037]
4588]
Cargo.toml +2 −1
@@ -2,13 +2,14 @@
2 2 name = "posprint"
3 3 version = "0.1.2"
4 4 edition = "2021"
5 rust-version = "1.88"
5 6 description = "Designer for POS-print documents"
6 7 license = "MIT"
7 8 readme = "README.md"
8 9 build = "build.rs"
9 10
10 11 [dependencies]
11 eframe = { version = "0.31", default-features = false, features = ["default_fonts", "glow"] }
12 eframe = { version = "0.31", default-features = false, features = ["default_fonts", "glow", "x11", "wayland"] }
12 13 serde = { version = "1", features = ["derive"] }
13 14 serde_json = "1"
14 15 serialport = "4"
@@ -2,13 +2,14 @@
2name = "posprint"
2name = "posprint"
3version = "0.1.2"
3version = "0.1.2"
4edition = "2021"
4edition = "2021"
5rust-version = "1.88"
5description = "Designer for POS-print documents"
6description = "Designer for POS-print documents"
6license = "MIT"
7license = "MIT"
7readme = "README.md"
8readme = "README.md"
8build = "build.rs"
9build = "build.rs"
9
10
10[dependencies]
11[dependencies]
11eframe = { version = "0.31", default-features = false, features = ["default_fonts", "glow"] }
12eframe = { version = "0.31", default-features = false, features = ["default_fonts", "glow", "x11", "wayland"] }
12serde = { version = "1", features = ["derive"] }
13serde = { version = "1", features = ["derive"] }
13serde_json = "1"
14serde_json = "1"
14serialport = "4"
15serialport = "4"
README.md +104 −102
@@ -1,102 +1,104 @@
1 # posprint
2
3 Cross-platform designer for POS (point-of-sale) receipt documents. Edit templates in a markdown-like syntax, preview output live, substitute runtime parameters, and print directly to USB serial POS printers via raw ESC/POS bytes.
4
5 **Target platforms:** Windows and Linux (x64).
6
7 ## Status
8
9 **v0.1.0 MVP** — Rust + egui app with editor, preview, help, `.pos` files, parameters, and USB-serial printing.
10
11 ## Build and run
12
13 ```bash
14 cargo test # 31 unit tests
15 cargo run # launch the designer
16 cargo build --release
17 ```
18
19 **Scripts:** `scripts/build-windows.ps1`, `scripts/build-linux.sh`, `scripts/build-arch.sh` (see [docs/BUILD.md](docs/BUILD.md)).
20
21 ### Command-line printing
22
23 ```bash
24 # Windows
25 posprint print receipt.pos -p COM3 --set StoreName="Shop" --set DocumentNumber=42
26
27 # Linux
28 posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="Shop" --set DocumentNumber=42
29 ```
30
31 All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails.
32
33 **Linux:** add your user to the `dialout` group for USB-serial printer access.
34
35 ## Releases (GitLab CI)
36
37 | Platform | Artifact | Install |
38 |----------|----------|---------|
39 | Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
40 | Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` |
41 | Windows | `posprint.exe` | Download from GitLab release job artifacts |
42
43 Tag a version (e.g. `v0.1.0`) to trigger release builds.
44
45 ## Features
46
47 - Markdown-like template editor with live preview
48 - Page width: auto-scale or fixed width (mm)
49 - Save and load `.pos` files
50 - Parameter tokens (`${DocumentNumber}`) with print-time popup and value reuse
51 - Barcodes, QR codes, and images (including parameterized content)
52 - Print to USB-serial POS printers via raw ESC/POS bytes
53 - In-app **Help** tab (from [docs/HELP.md](docs/HELP.md))
54
55 ## Dependencies (minimal)
56
57 | Crate | Why |
58 |-------|-----|
59 | `eframe` / `egui` | Native UI |
60 | `serde` / `serde_json` | `.pos` file format |
61 | `serialport` | USB-serial printer I/O |
62 | `image` | Load PNG/JPEG for `@image` |
63 | `rfd` | Native open/save dialogs |
64 | `barcoders` | Raster barcode rendering |
65 | `qrcode` | Raster QR rendering |
66 | `clap` | CLI `print` subcommand |
67
68 ESC/POS encoding is implemented in-tree.
69
70 ## Design documents
71
72 | Document | Description |
73 |----------|-------------|
74 | [FEASIBILITY.md](docs/FEASIBILITY.md) | Feasibility assessment, complexity estimate, risks |
75 | [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) | Language and framework recommendation |
76 | [HELP.md](docs/HELP.md) | **User reference** (mirrored in-app Help tab) |
77 | [ARCHITECTURE.md](docs/ARCHITECTURE.md) | System architecture and module breakdown |
78 | [DSL-SPEC.md](docs/DSL-SPEC.md) | Document markup language (`.pos` body syntax) |
79 | [FILE-FORMAT.md](docs/FILE-FORMAT.md) | `.pos` file envelope (metadata + body) |
80 | [PRINTING.md](docs/PRINTING.md) | Printer discovery, transport, ESC/POS pipeline |
81 | [BUILD.md](docs/BUILD.md) | Local build scripts and Linux package formats |
82
83 Documentation must stay aligned with the codebase; see `.cursor/rules/documentation.mdc`.
84
85 ## Planned features
86
87 - Bluetooth printer support (deferred)
88
89 ## Quick feasibility summary
90
91 **Verdict: feasible** for a small team or solo developer, with the printing layer as the main engineering risk.
92
93 | Area | Complexity | Notes |
94 |------|------------|-------|
95 | Editor + preview UI | Medium | Well-trodden path |
96 | DSL parser + renderer | Medium | Custom grammar, bounded scope |
97 | Parameters | Low | Straightforward substitution |
98 | Barcodes / QR / images | Low–Medium | Mature libraries exist |
99 | USB / BT printer I/O | **High** | OS differences, device quirks |
100 | **Overall (MVP)** | **Medium–High** | ~6–10 weeks for one experienced dev |
101
102 Stack: **Rust + egui** (single language, minimal dependencies). USB-serial printing only in v1. See [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) and [docs/HELP.md](docs/HELP.md).
1 # posprint
2
3 Cross-platform designer for POS (point-of-sale) receipt documents. Edit templates in a markdown-like syntax, preview output live, substitute runtime parameters, and print directly to USB serial POS printers via raw ESC/POS bytes.
4
5 **Target platforms:** Windows and Linux (x64).
6
7 ## Status
8
9 **v0.1.1** — Rust + egui app with editor, preview, help, `.pos` files, parameters, and USB-serial printing.
10
11 ## Build and run
12
13 Requires **Rust 1.88+** ([rustup](https://rustup.rs/) or `pacman -S rust` on Arch). See [docs/BUILD.md](docs/BUILD.md) for OS libraries and package scripts.
14
15 ```bash
16 cargo test # 31 unit tests
17 cargo run # launch the designer
18 cargo build --release
19 ```
20
21 **Scripts:** `scripts/build-windows.ps1`, `scripts/build-linux.sh`, `scripts/build-arch.sh`
22
23 ### Command-line printing
24
25 ```bash
26 # Windows
27 posprint print receipt.pos -p COM3 --set StoreName="Shop" --set DocumentNumber=42
28
29 # Linux
30 posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="Shop" --set DocumentNumber=42
31 ```
32
33 All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails.
34
35 **Linux:** add your user to the `dialout` group for USB-serial printer access.
36
37 ## Releases (GitLab CI)
38
39 | Platform | Artifact | Install |
40 |----------|----------|---------|
41 | Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
42 | Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` |
43 | Windows | `posprint.exe` | Download from GitLab release job artifacts |
44
45 Tag a version (e.g. `v0.1.0`) to trigger release builds.
46
47 ## Features
48
49 - Markdown-like template editor with live preview
50 - Page width: auto-scale or fixed width (mm)
51 - Save and load `.pos` files
52 - Parameter tokens (`${DocumentNumber}`) with print-time popup and value reuse
53 - Barcodes, QR codes, and images (including parameterized content)
54 - Print to USB-serial POS printers via raw ESC/POS bytes
55 - In-app **Help** tab (from [docs/HELP.md](docs/HELP.md))
56
57 ## Dependencies (minimal)
58
59 | Crate | Why |
60 |-------|-----|
61 | `eframe` / `egui` | Native UI |
62 | `serde` / `serde_json` | `.pos` file format |
63 | `serialport` | USB-serial printer I/O |
64 | `image` | Load PNG/JPEG for `@image` |
65 | `rfd` | Native open/save dialogs |
66 | `barcoders` | Raster barcode rendering |
67 | `qrcode` | Raster QR rendering |
68 | `clap` | CLI `print` subcommand |
69
70 ESC/POS encoding is implemented in-tree.
71
72 ## Design documents
73
74 | Document | Description |
75 |----------|-------------|
76 | [FEASIBILITY.md](docs/FEASIBILITY.md) | Feasibility assessment, complexity estimate, risks |
77 | [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) | Language and framework recommendation |
78 | [HELP.md](docs/HELP.md) | **User reference** (mirrored in-app Help tab) |
79 | [ARCHITECTURE.md](docs/ARCHITECTURE.md) | System architecture and module breakdown |
80 | [DSL-SPEC.md](docs/DSL-SPEC.md) | Document markup language (`.pos` body syntax) |
81 | [FILE-FORMAT.md](docs/FILE-FORMAT.md) | `.pos` file envelope (metadata + body) |
82 | [PRINTING.md](docs/PRINTING.md) | Printer discovery, transport, ESC/POS pipeline |
83 | [BUILD.md](docs/BUILD.md) | Local build scripts and Linux package formats |
84
85 Documentation must stay aligned with the codebase; see `.cursor/rules/documentation.mdc`.
86
87 ## Planned features
88
89 - Bluetooth printer support (deferred)
90
91 ## Quick feasibility summary
92
93 **Verdict: feasible** for a small team or solo developer, with the printing layer as the main engineering risk.
94
95 | Area | Complexity | Notes |
96 |------|------------|-------|
97 | Editor + preview UI | Medium | Well-trodden path |
98 | DSL parser + renderer | Medium | Custom grammar, bounded scope |
99 | Parameters | Low | Straightforward substitution |
100 | Barcodes / QR / images | Low–Medium | Mature libraries exist |
101 | USB / BT printer I/O | **High** | OS differences, device quirks |
102 | **Overall (MVP)** | **Medium–High** | ~6–10 weeks for one experienced dev |
103
104 Stack: **Rust + egui** (single language, minimal dependencies). USB-serial printing only in v1. See [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) and [docs/HELP.md](docs/HELP.md).
@@ -1,102 +1,104 @@
1# posprint
1# posprint
2
2
3Cross-platform designer for POS (point-of-sale) receipt documents. Edit templates in a markdown-like syntax, preview output live, substitute runtime parameters, and print directly to USB serial POS printers via raw ESC/POS bytes.
3Cross-platform designer for POS (point-of-sale) receipt documents. Edit templates in a markdown-like syntax, preview output live, substitute runtime parameters, and print directly to USB serial POS printers via raw ESC/POS bytes.
4
4
5**Target platforms:** Windows and Linux (x64).
5**Target platforms:** Windows and Linux (x64).
6
6
7## Status
7## Status
8
8
9**v0.1.0 MVP** — Rust + egui app with editor, preview, help, `.pos` files, parameters, and USB-serial printing.
9**v0.1.1** — Rust + egui app with editor, preview, help, `.pos` files, parameters, and USB-serial printing.
10
10
11## Build and run
11## Build and run
12
12
13```bash
13Requires **Rust 1.88+** ([rustup](https://rustup.rs/) or `pacman -S rust` on Arch). See [docs/BUILD.md](docs/BUILD.md) for OS libraries and package scripts.
14cargo test # 31 unit tests
14
15cargo run # launch the designer
15```bash
16cargo build --release
16cargo test # 31 unit tests
17```
17cargo run # launch the designer
18
18cargo build --release
19**Scripts:** `scripts/build-windows.ps1`, `scripts/build-linux.sh`, `scripts/build-arch.sh` (see [docs/BUILD.md](docs/BUILD.md)).
19```
20
20
21### Command-line printing
21**Scripts:** `scripts/build-windows.ps1`, `scripts/build-linux.sh`, `scripts/build-arch.sh`
22
22
23```bash
23### Command-line printing
24# Windows
24
25posprint print receipt.pos -p COM3 --set StoreName="Shop" --set DocumentNumber=42
25```bash
26
26# Windows
27# Linux
27posprint print receipt.pos -p COM3 --set StoreName="Shop" --set DocumentNumber=42
28posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="Shop" --set DocumentNumber=42
28
29```
29# Linux
30
30posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="Shop" --set DocumentNumber=42
31All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails.
31```
32
32
33**Linux:** add your user to the `dialout` group for USB-serial printer access.
33All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails.
34
34
35## Releases (GitLab CI)
35**Linux:** add your user to the `dialout` group for USB-serial printer access.
36
36
37| Platform | Artifact | Install |
37## Releases (GitLab CI)
38|----------|----------|---------|
38
39| Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
39| Platform | Artifact | Install |
40| Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` |
40|----------|----------|---------|
41| Windows | `posprint.exe` | Download from GitLab release job artifacts |
41| Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
42
42| Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` |
43Tag a version (e.g. `v0.1.0`) to trigger release builds.
43| Windows | `posprint.exe` | Download from GitLab release job artifacts |
44
44
45## Features
45Tag a version (e.g. `v0.1.0`) to trigger release builds.
46
46
47- Markdown-like template editor with live preview
47## Features
48- Page width: auto-scale or fixed width (mm)
48
49- Save and load `.pos` files
49- Markdown-like template editor with live preview
50- Parameter tokens (`${DocumentNumber}`) with print-time popup and value reuse
50- Page width: auto-scale or fixed width (mm)
51- Barcodes, QR codes, and images (including parameterized content)
51- Save and load `.pos` files
52- Print to USB-serial POS printers via raw ESC/POS bytes
52- Parameter tokens (`${DocumentNumber}`) with print-time popup and value reuse
53- In-app **Help** tab (from [docs/HELP.md](docs/HELP.md))
53- Barcodes, QR codes, and images (including parameterized content)
54
54- Print to USB-serial POS printers via raw ESC/POS bytes
55## Dependencies (minimal)
55- In-app **Help** tab (from [docs/HELP.md](docs/HELP.md))
56
56
57| Crate | Why |
57## Dependencies (minimal)
58|-------|-----|
58
59| `eframe` / `egui` | Native UI |
59| Crate | Why |
60| `serde` / `serde_json` | `.pos` file format |
60|-------|-----|
61| `serialport` | USB-serial printer I/O |
61| `eframe` / `egui` | Native UI |
62| `image` | Load PNG/JPEG for `@image` |
62| `serde` / `serde_json` | `.pos` file format |
63| `rfd` | Native open/save dialogs |
63| `serialport` | USB-serial printer I/O |
64| `barcoders` | Raster barcode rendering |
64| `image` | Load PNG/JPEG for `@image` |
65| `qrcode` | Raster QR rendering |
65| `rfd` | Native open/save dialogs |
66| `clap` | CLI `print` subcommand |
66| `barcoders` | Raster barcode rendering |
67
67| `qrcode` | Raster QR rendering |
68ESC/POS encoding is implemented in-tree.
68| `clap` | CLI `print` subcommand |
69
69
70## Design documents
70ESC/POS encoding is implemented in-tree.
71
71
72| Document | Description |
72## Design documents
73|----------|-------------|
73
74| [FEASIBILITY.md](docs/FEASIBILITY.md) | Feasibility assessment, complexity estimate, risks |
74| Document | Description |
75| [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) | Language and framework recommendation |
75|----------|-------------|
76| [HELP.md](docs/HELP.md) | **User reference** (mirrored in-app Help tab) |
76| [FEASIBILITY.md](docs/FEASIBILITY.md) | Feasibility assessment, complexity estimate, risks |
77| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | System architecture and module breakdown |
77| [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) | Language and framework recommendation |
78| [DSL-SPEC.md](docs/DSL-SPEC.md) | Document markup language (`.pos` body syntax) |
78| [HELP.md](docs/HELP.md) | **User reference** (mirrored in-app Help tab) |
79| [FILE-FORMAT.md](docs/FILE-FORMAT.md) | `.pos` file envelope (metadata + body) |
79| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | System architecture and module breakdown |
80| [PRINTING.md](docs/PRINTING.md) | Printer discovery, transport, ESC/POS pipeline |
80| [DSL-SPEC.md](docs/DSL-SPEC.md) | Document markup language (`.pos` body syntax) |
81| [BUILD.md](docs/BUILD.md) | Local build scripts and Linux package formats |
81| [FILE-FORMAT.md](docs/FILE-FORMAT.md) | `.pos` file envelope (metadata + body) |
82
82| [PRINTING.md](docs/PRINTING.md) | Printer discovery, transport, ESC/POS pipeline |
83Documentation must stay aligned with the codebase; see `.cursor/rules/documentation.mdc`.
83| [BUILD.md](docs/BUILD.md) | Local build scripts and Linux package formats |
84
84
85## Planned features
85Documentation must stay aligned with the codebase; see `.cursor/rules/documentation.mdc`.
86
86
87- Bluetooth printer support (deferred)
87## Planned features
88
88
89## Quick feasibility summary
89- Bluetooth printer support (deferred)
90
90
91**Verdict: feasible** for a small team or solo developer, with the printing layer as the main engineering risk.
91## Quick feasibility summary
92
92
93| Area | Complexity | Notes |
93**Verdict: feasible** for a small team or solo developer, with the printing layer as the main engineering risk.
94|------|------------|-------|
94
95| Editor + preview UI | Medium | Well-trodden path |
95| Area | Complexity | Notes |
96| DSL parser + renderer | Medium | Custom grammar, bounded scope |
96|------|------------|-------|
97| Parameters | Low | Straightforward substitution |
97| Editor + preview UI | Medium | Well-trodden path |
98| Barcodes / QR / images | Low–Medium | Mature libraries exist |
98| DSL parser + renderer | Medium | Custom grammar, bounded scope |
99| USB / BT printer I/O | **High** | OS differences, device quirks |
99| Parameters | Low | Straightforward substitution |
100| **Overall (MVP)** | **Medium–High** | ~6–10 weeks for one experienced dev |
100| Barcodes / QR / images | Low–Medium | Mature libraries exist |
101
101| USB / BT printer I/O | **High** | OS differences, device quirks |
102Stack: **Rust + egui** (single language, minimal dependencies). USB-serial printing only in v1. See [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) and [docs/HELP.md](docs/HELP.md).
102| **Overall (MVP)** | **Medium–High** | ~6–10 weeks for one experienced dev |
103
104Stack: **Rust + egui** (single language, minimal dependencies). USB-serial printing only in v1. See [LANGUAGE-CHOICE.md](docs/LANGUAGE-CHOICE.md) and [docs/HELP.md](docs/HELP.md).
docs/ARCHITECTURE.md +178 −178
@@ -1,178 +1,178 @@
1 # System architecture
2
3 ## Overview
4
5 posprint is a **single Rust binary** using **egui** (eframe). No separate frontend language, no WebView, no IPC layer.
6
7 ```
8 ┌─────────────────────────────────────────┐
9 │ posprint (Rust + egui) │
10 │ - Editor / Preview / Help tabs │
11 │ - DSL parse → AST │
12 │ - Preview layout + in-tree ESC/POS │
13 │ - USB-serial printer discovery/print │
14 │ - `.pos` JSON load/save (serde) │
15 └─────────────────────────────────────────┘
16 ```
17
18 ### Source layout
19
20 ```
21 src/
22 ├── main.rs # eframe entry point
23 ├── app.rs # egui UI (editor, preview, help, print dialog)
24 ├── lib.rs # crate root; exports + HELP_MARKDOWN
25 ├── dsl/ # Parser and AST (mod.rs, parser.rs)
26 ├── params.rs # Parameter collect/substitute
27 ├── escpos.rs # ESC/POS byte encoder (in-tree)
28 ├── preview.rs # Preview model for UI canvas
29 ├── io/mod.rs # .pos file format (PosFile, PosMetadata)
30 └── print/mod.rs # USB-serial discovery, SerialTransport, MockTransport
31 ```
32
33 ### External dependencies (minimal)
34
35 | Crate | Role |
36 |-------|------|
37 | `eframe` / `egui` | Native UI |
38 | `serde` / `serde_json` | `.pos` file format |
39 | `serialport` | USB-serial enumeration and I/O |
40 | `image` | Decode/resize images for `@image` raster print |
41 | `rfd` | Native open/save file dialogs |
42
43 ESC/POS command generation is **not** delegated to a third-party crate.
44
45 ---
46
47 ## UI structure
48
49 | Tab / area | Module | Description |
50 |------------|--------|-------------|
51 | **Editor** | `app.rs` | Multiline `TextEdit` (monospace) for template source |
52 | **Preview** | `app.rs` + `preview.rs` | Canvas render of `PreviewModel`; auto-scale or fixed mm |
53 | **Help** | `app.rs` | Scrollable view of `docs/HELP.md` via `include_str!` |
54 | Toolbar | `app.rs` | New, Open, Save, Save As, Print |
55 | Settings | `app.rs` | Page width (mm), preview mode |
56 | Print dialog | `app.rs` | Parameter fields + USB-serial printer picker |
57
58 Bottom panel switches tabs. Top panel holds actions and settings.
59
60 ---
61
62 ## Data flow
63
64 ### Edit loop (live preview)
65
66 1. User types in the Editor tab.
67 2. Each frame, `parse(&body)` runs; errors show in the toolbar.
68 3. On Preview tab, `render_preview(&doc, &metadata)` builds a `PreviewModel`.
69 4. Canvas draws text lines, rules, and placeholders for barcode/QR/image.
70
71 Preview is **not debounced** — it re-parses when the Preview tab is shown (and parse runs every frame for error display).
72
73 ### Save / load
74
75 1. **Open:** `rfd` file dialog → `PosFile::load_from_path` → populate `body`, `metadata`, `file_path`.
76 2. **Save / Save As:** `PosFile::save_to_path` writes pretty-printed JSON.
77
78 Image paths in `@image` resolve relative to the `.pos` file directory on print.
79
80 ### Print
81
82 1. User clicks **Print** → parse body → `collect_parameter_names(&doc)`.
83 2. Modal shows one field per unique parameter; pre-filled from `last_params` (in-memory).
84 3. User selects a USB-serial port from `list_usb_serial_printers()`.
85 4. `substitute_document` → `EscPosEncoder::encode_document` → `SerialTransport::open` (9600 baud) → `print_bytes`.
86
87 ---
88
89 ## Key types
90
91 Implemented in `dsl/mod.rs`, `io/mod.rs`, `print/mod.rs`:
92
93 ```rust
94 // dsl/
95 struct Document { blocks: Vec<Block> }
96
97 enum Block {
98 Paragraph { align, inlines },
99 Heading { level, inlines },
100 Rule,
101 Feed(u8),
102 Cut,
103 Image { path, width: ImageWidth, align },
104 Barcode { symbology, data, height, align, show_text },
105 Qr { data, size, ecc, align },
106 }
107
108 // io/
109 struct PosFile { version, metadata: PosMetadata, body }
110 struct PosMetadata { title, page_width_mm, preview_mode, chars_per_line, codepage }
111
112 // print/
113 struct PrinterDevice { id, display_name, port_name }
114 trait PrinterTransport { write_all, flush }
115 ```
116
117 ---
118
119 ## Preview vs print fidelity
120
121 | Aspect | Preview | Print |
122 |--------|---------|-------|
123 | Text font | egui monospace/proportional | Printer built-in font |
124 | Line width | From `chars_per_line()` | ESC/POS dot width from `page_width_mm` |
125 | Images | `[image: path]` placeholder | Monochrome raster (GS v 0) |
126 | Barcodes / QR | Text placeholder | Native ESC/POS commands |
127 | Alignment | Canvas positioning | ESC a |
128
129 Both paths share the same **AST**; substitution happens only at print time. Preview shows unresolved `${Param}` tokens as-is.
130
131 ---
132
133 ## State persistence (current)
134
135 | Data | Storage | Notes |
136 |------|---------|-------|
137 | Template + metadata | `.pos` file on disk | User saves explicitly |
138 | Last parameter values | `PosPrintApp.last_params` | In-memory only; lost on quit |
139 | Recent files | — | Not implemented |
140 | Selected printer | — | Not persisted between sessions |
141
142 ---
143
144 ## Testing
145
146 | Layer | Location | Approach |
147 |-------|----------|----------|
148 | DSL parser | `dsl/parser.rs` | Unit tests |
149 | Parameters | `params.rs` | Unit tests |
150 | ESC/POS encoder | `escpos.rs` | Byte structure tests |
151 | Preview | `preview.rs` | Unit tests |
152 | `.pos` I/O | `io/mod.rs` | Round-trip + tempfile tests |
153 | Printer I/O | `print/mod.rs` | `MockTransport`; no hardware in CI |
154 | App | `app.rs` | Default template parse/param tests |
155
156 Run: `cargo test` (20 tests). CI runs this on Linux (Docker) and Windows (shell runner).
157
158 ---
159
160 ## Build and release
161
162 - **CI:** GitLab (`.gitlab-ci.yml`) — `cargo test` on push; release artifacts on tags.
163 - **Linux artifact:** `.deb` via `cargo-deb` (`[package.metadata.deb]` in `Cargo.toml`).
164 - **Windows artifact:** `target/release/posprint.exe`.
165 - **Versioning:** Semver in `Cargo.toml`; `.pos` `version` field for file-format migrations.
166
167 ---
168
169 ## Planned (not implemented)
170
171 - USB printer class (bulk OUT) without serial emulation
172 - Bluetooth SPP
173 - Network printers (TCP 9100)
174 - Baud-rate autodetect / settings UI
175 - Persisted last parameters and recent files
176 - Syntax highlighting in editor
177
178 See [PRINTING.md](PRINTING.md) and [DSL-SPEC.md](DSL-SPEC.md) for protocol and language details.
1 # System architecture
2
3 ## Overview
4
5 posprint is a **single Rust binary** using **egui** (eframe). No separate frontend language, no WebView, no IPC layer.
6
7 ```
8 ┌─────────────────────────────────────────┐
9 │ posprint (Rust + egui) │
10 │ - Editor / Preview / Help tabs │
11 │ - DSL parse → AST │
12 │ - Preview layout + in-tree ESC/POS │
13 │ - USB-serial printer discovery/print │
14 │ - `.pos` JSON load/save (serde) │
15 └─────────────────────────────────────────┘
16 ```
17
18 ### Source layout
19
20 ```
21 src/
22 ├── main.rs # eframe entry point
23 ├── app.rs # egui UI (editor, preview, help, print dialog)
24 ├── lib.rs # crate root; exports + HELP_MARKDOWN
25 ├── dsl/ # Parser and AST (mod.rs, parser.rs)
26 ├── params.rs # Parameter collect/substitute
27 ├── escpos.rs # ESC/POS byte encoder (in-tree)
28 ├── preview.rs # Preview model for UI canvas
29 ├── io/mod.rs # .pos file format (PosFile, PosMetadata)
30 └── print/mod.rs # USB-serial discovery, SerialTransport, MockTransport
31 ```
32
33 ### External dependencies (minimal)
34
35 | Crate | Role |
36 |-------|------|
37 | `eframe` / `egui` | Native UI |
38 | `serde` / `serde_json` | `.pos` file format |
39 | `serialport` | USB-serial enumeration and I/O |
40 | `image` | Decode/resize images for `@image` raster print |
41 | `rfd` | Native open/save file dialogs |
42
43 ESC/POS command generation is **not** delegated to a third-party crate.
44
45 ---
46
47 ## UI structure
48
49 | Tab / area | Module | Description |
50 |------------|--------|-------------|
51 | **Editor** | `app.rs` | Multiline `TextEdit` (monospace) for template source |
52 | **Preview** | `app.rs` + `preview.rs` | Canvas render of `PreviewModel`; auto-scale or fixed mm |
53 | **Help** | `app.rs` | Scrollable view of `docs/HELP.md` via `include_str!` |
54 | Toolbar | `app.rs` | New, Open, Save, Save As, Print |
55 | Settings | `app.rs` | Page width (mm), preview mode |
56 | Print dialog | `app.rs` | Parameter fields + USB-serial printer picker |
57
58 Bottom panel switches tabs. Top panel holds actions and settings.
59
60 ---
61
62 ## Data flow
63
64 ### Edit loop (live preview)
65
66 1. User types in the Editor tab.
67 2. Each frame, `parse(&body)` runs; errors show in the toolbar.
68 3. On Preview tab, `render_preview(&doc, &metadata)` builds a `PreviewModel`.
69 4. Canvas draws text lines, rules, and placeholders for barcode/QR/image.
70
71 Preview is **not debounced** — it re-parses when the Preview tab is shown (and parse runs every frame for error display).
72
73 ### Save / load
74
75 1. **Open:** `rfd` file dialog → `PosFile::load_from_path` → populate `body`, `metadata`, `file_path`.
76 2. **Save / Save As:** `PosFile::save_to_path` writes pretty-printed JSON.
77
78 Image paths in `@image` resolve relative to the `.pos` file directory on print.
79
80 ### Print
81
82 1. User clicks **Print** → parse body → `collect_parameter_names(&doc)`.
83 2. Modal shows one field per unique parameter; pre-filled from `last_params` (in-memory).
84 3. User selects a USB-serial port from `list_usb_serial_printers()`.
85 4. `substitute_document` → `EscPosEncoder::encode_document` → `SerialTransport::open` (9600 baud) → `print_bytes`.
86
87 ---
88
89 ## Key types
90
91 Implemented in `dsl/mod.rs`, `io/mod.rs`, `print/mod.rs`:
92
93 ```rust
94 // dsl/
95 struct Document { blocks: Vec<Block> }
96
97 enum Block {
98 Paragraph { align, inlines },
99 Heading { level, inlines },
100 Rule,
101 Feed(u8),
102 Cut,
103 Image { path, width: ImageWidth, align },
104 Barcode { symbology, data, height, align, show_text },
105 Qr { data, size, ecc, align },
106 }
107
108 // io/
109 struct PosFile { version, metadata: PosMetadata, body }
110 struct PosMetadata { title, page_width_mm, preview_mode, chars_per_line, codepage }
111
112 // print/
113 struct PrinterDevice { id, display_name, port_name }
114 trait PrinterTransport { write_all, flush }
115 ```
116
117 ---
118
119 ## Preview vs print fidelity
120
121 | Aspect | Preview | Print |
122 |--------|---------|-------|
123 | Text font | egui monospace/proportional | Printer built-in font |
124 | Line width | From `chars_per_line()` | ESC/POS dot width from `page_width_mm` |
125 | Images | `[image: path]` placeholder | Monochrome raster (GS v 0) |
126 | Barcodes / QR | Text placeholder | Native ESC/POS commands |
127 | Alignment | Canvas positioning | ESC a |
128
129 Both paths share the same **AST**; substitution happens only at print time. Preview shows unresolved `${Param}` tokens as-is.
130
131 ---
132
133 ## State persistence (current)
134
135 | Data | Storage | Notes |
136 |------|---------|-------|
137 | Template + metadata | `.pos` file on disk | User saves explicitly |
138 | Last parameter values | `PosPrintApp.last_params` | In-memory only; lost on quit |
139 | Recent files | — | Not implemented |
140 | Selected printer | — | Not persisted between sessions |
141
142 ---
143
144 ## Testing
145
146 | Layer | Location | Approach |
147 |-------|----------|----------|
148 | DSL parser | `dsl/parser.rs` | Unit tests |
149 | Parameters | `params.rs` | Unit tests |
150 | ESC/POS encoder | `escpos.rs` | Byte structure tests |
151 | Preview | `preview.rs` | Unit tests |
152 | `.pos` I/O | `io/mod.rs` | Round-trip + tempfile tests |
153 | Printer I/O | `print/mod.rs` | `MockTransport`; no hardware in CI |
154 | App | `app.rs` | Default template parse/param tests |
155
156 Run: `cargo test` (20 tests). CI runs this on Linux (Docker) and Windows (shell runner).
157
158 ---
159
160 ## Build and release
161
162 - **CI:** GitLab (`.gitlab-ci.yml`) — `cargo test` on push; release artifacts on tags.
163 - **Linux artifact:** `.deb` via `cargo-deb` (`[package.metadata.deb]` in `Cargo.toml`).
164 - **Windows artifact:** `target/release/posprint.exe`.
165 - **Versioning:** Semver in `Cargo.toml`; `.pos` `version` field for file-format migrations.
166
167 ---
168
169 ## Planned (not implemented)
170
171 - USB printer class (bulk OUT) without serial emulation
172 - Bluetooth SPP
173 - Network printers (TCP 9100)
174 - Baud-rate autodetect / settings UI
175 - Persisted last parameters and recent files
176 - Syntax highlighting in editor
177
178 See [PRINTING.md](PRINTING.md) and [DSL-SPEC.md](DSL-SPEC.md) for protocol and language details.
@@ -1,178 +1,178 @@
1# System architecture
1# System architecture
2
2
3## Overview
3## Overview
4
4
5posprint is a **single Rust binary** using **egui** (eframe). No separate frontend language, no WebView, no IPC layer.
5posprint is a **single Rust binary** using **egui** (eframe). No separate frontend language, no WebView, no IPC layer.
6
6
7```
7```
8┌─────────────────────────────────────────┐
8┌─────────────────────────────────────────┐
9│ posprint (Rust + egui) │
9│ posprint (Rust + egui) │
10│ - Editor / Preview / Help tabs │
10│ - Editor / Preview / Help tabs │
11│ - DSL parse → AST │
11│ - DSL parse → AST │
12│ - Preview layout + in-tree ESC/POS │
12│ - Preview layout + in-tree ESC/POS │
13│ - USB-serial printer discovery/print │
13│ - USB-serial printer discovery/print │
14│ - `.pos` JSON load/save (serde) │
14│ - `.pos` JSON load/save (serde) │
15└─────────────────────────────────────────┘
15└─────────────────────────────────────────┘
16```
16```
17
17
18### Source layout
18### Source layout
19
19
20```
20```
21src/
21src/
22├── main.rs # eframe entry point
22├── main.rs # eframe entry point
23├── app.rs # egui UI (editor, preview, help, print dialog)
23├── app.rs # egui UI (editor, preview, help, print dialog)
24├── lib.rs # crate root; exports + HELP_MARKDOWN
24├── lib.rs # crate root; exports + HELP_MARKDOWN
25├── dsl/ # Parser and AST (mod.rs, parser.rs)
25├── dsl/ # Parser and AST (mod.rs, parser.rs)
26├── params.rs # Parameter collect/substitute
26├── params.rs # Parameter collect/substitute
27├── escpos.rs # ESC/POS byte encoder (in-tree)
27├── escpos.rs # ESC/POS byte encoder (in-tree)
28├── preview.rs # Preview model for UI canvas
28├── preview.rs # Preview model for UI canvas
29├── io/mod.rs # .pos file format (PosFile, PosMetadata)
29├── io/mod.rs # .pos file format (PosFile, PosMetadata)
30└── print/mod.rs # USB-serial discovery, SerialTransport, MockTransport
30└── print/mod.rs # USB-serial discovery, SerialTransport, MockTransport
31```
31```
32
32
33### External dependencies (minimal)
33### External dependencies (minimal)
34
34
35| Crate | Role |
35| Crate | Role |
36|-------|------|
36|-------|------|
37| `eframe` / `egui` | Native UI |
37| `eframe` / `egui` | Native UI |
38| `serde` / `serde_json` | `.pos` file format |
38| `serde` / `serde_json` | `.pos` file format |
39| `serialport` | USB-serial enumeration and I/O |
39| `serialport` | USB-serial enumeration and I/O |
40| `image` | Decode/resize images for `@image` raster print |
40| `image` | Decode/resize images for `@image` raster print |
41| `rfd` | Native open/save file dialogs |
41| `rfd` | Native open/save file dialogs |
42
42
43ESC/POS command generation is **not** delegated to a third-party crate.
43ESC/POS command generation is **not** delegated to a third-party crate.
44
44
45---
45---
46
46
47## UI structure
47## UI structure
48
48
49| Tab / area | Module | Description |
49| Tab / area | Module | Description |
50|------------|--------|-------------|
50|------------|--------|-------------|
51| **Editor** | `app.rs` | Multiline `TextEdit` (monospace) for template source |
51| **Editor** | `app.rs` | Multiline `TextEdit` (monospace) for template source |
52| **Preview** | `app.rs` + `preview.rs` | Canvas render of `PreviewModel`; auto-scale or fixed mm |
52| **Preview** | `app.rs` + `preview.rs` | Canvas render of `PreviewModel`; auto-scale or fixed mm |
53| **Help** | `app.rs` | Scrollable view of `docs/HELP.md` via `include_str!` |
53| **Help** | `app.rs` | Scrollable view of `docs/HELP.md` via `include_str!` |
54| Toolbar | `app.rs` | New, Open, Save, Save As, Print |
54| Toolbar | `app.rs` | New, Open, Save, Save As, Print |
55| Settings | `app.rs` | Page width (mm), preview mode |
55| Settings | `app.rs` | Page width (mm), preview mode |
56| Print dialog | `app.rs` | Parameter fields + USB-serial printer picker |
56| Print dialog | `app.rs` | Parameter fields + USB-serial printer picker |
57
57
58Bottom panel switches tabs. Top panel holds actions and settings.
58Bottom panel switches tabs. Top panel holds actions and settings.
59
59
60---
60---
61
61
62## Data flow
62## Data flow
63
63
64### Edit loop (live preview)
64### Edit loop (live preview)
65
65
661. User types in the Editor tab.
661. User types in the Editor tab.
672. Each frame, `parse(&body)` runs; errors show in the toolbar.
672. Each frame, `parse(&body)` runs; errors show in the toolbar.
683. On Preview tab, `render_preview(&doc, &metadata)` builds a `PreviewModel`.
683. On Preview tab, `render_preview(&doc, &metadata)` builds a `PreviewModel`.
694. Canvas draws text lines, rules, and placeholders for barcode/QR/image.
694. Canvas draws text lines, rules, and placeholders for barcode/QR/image.
70
70
71Preview is **not debounced** — it re-parses when the Preview tab is shown (and parse runs every frame for error display).
71Preview is **not debounced** — it re-parses when the Preview tab is shown (and parse runs every frame for error display).
72
72
73### Save / load
73### Save / load
74
74
751. **Open:** `rfd` file dialog → `PosFile::load_from_path` → populate `body`, `metadata`, `file_path`.
751. **Open:** `rfd` file dialog → `PosFile::load_from_path` → populate `body`, `metadata`, `file_path`.
762. **Save / Save As:** `PosFile::save_to_path` writes pretty-printed JSON.
762. **Save / Save As:** `PosFile::save_to_path` writes pretty-printed JSON.
77
77
78Image paths in `@image` resolve relative to the `.pos` file directory on print.
78Image paths in `@image` resolve relative to the `.pos` file directory on print.
79
79
80### Print
80### Print
81
81
821. User clicks **Print** → parse body → `collect_parameter_names(&doc)`.
821. User clicks **Print** → parse body → `collect_parameter_names(&doc)`.
832. Modal shows one field per unique parameter; pre-filled from `last_params` (in-memory).
832. Modal shows one field per unique parameter; pre-filled from `last_params` (in-memory).
843. User selects a USB-serial port from `list_usb_serial_printers()`.
843. User selects a USB-serial port from `list_usb_serial_printers()`.
854. `substitute_document` → `EscPosEncoder::encode_document` → `SerialTransport::open` (9600 baud) → `print_bytes`.
854. `substitute_document` → `EscPosEncoder::encode_document` → `SerialTransport::open` (9600 baud) → `print_bytes`.
86
86
87---
87---
88
88
89## Key types
89## Key types
90
90
91Implemented in `dsl/mod.rs`, `io/mod.rs`, `print/mod.rs`:
91Implemented in `dsl/mod.rs`, `io/mod.rs`, `print/mod.rs`:
92
92
93```rust
93```rust
94// dsl/
94// dsl/
95struct Document { blocks: Vec<Block> }
95struct Document { blocks: Vec<Block> }
96
96
97enum Block {
97enum Block {
98 Paragraph { align, inlines },
98 Paragraph { align, inlines },
99 Heading { level, inlines },
99 Heading { level, inlines },
100 Rule,
100 Rule,
101 Feed(u8),
101 Feed(u8),
102 Cut,
102 Cut,
103 Image { path, width: ImageWidth, align },
103 Image { path, width: ImageWidth, align },
104 Barcode { symbology, data, height, align, show_text },
104 Barcode { symbology, data, height, align, show_text },
105 Qr { data, size, ecc, align },
105 Qr { data, size, ecc, align },
106}
106}
107
107
108// io/
108// io/
109struct PosFile { version, metadata: PosMetadata, body }
109struct PosFile { version, metadata: PosMetadata, body }
110struct PosMetadata { title, page_width_mm, preview_mode, chars_per_line, codepage }
110struct PosMetadata { title, page_width_mm, preview_mode, chars_per_line, codepage }
111
111
112// print/
112// print/
113struct PrinterDevice { id, display_name, port_name }
113struct PrinterDevice { id, display_name, port_name }
114trait PrinterTransport { write_all, flush }
114trait PrinterTransport { write_all, flush }
115```
115```
116
116
117---
117---
118
118
119## Preview vs print fidelity
119## Preview vs print fidelity
120
120
121| Aspect | Preview | Print |
121| Aspect | Preview | Print |
122|--------|---------|-------|
122|--------|---------|-------|
123| Text font | egui monospace/proportional | Printer built-in font |
123| Text font | egui monospace/proportional | Printer built-in font |
124| Line width | From `chars_per_line()` | ESC/POS dot width from `page_width_mm` |
124| Line width | From `chars_per_line()` | ESC/POS dot width from `page_width_mm` |
125| Images | `[image: path]` placeholder | Monochrome raster (GS v 0) |
125| Images | `[image: path]` placeholder | Monochrome raster (GS v 0) |
126| Barcodes / QR | Text placeholder | Native ESC/POS commands |
126| Barcodes / QR | Text placeholder | Native ESC/POS commands |
127| Alignment | Canvas positioning | ESC a |
127| Alignment | Canvas positioning | ESC a |
128
128
129Both paths share the same **AST**; substitution happens only at print time. Preview shows unresolved `${Param}` tokens as-is.
129Both paths share the same **AST**; substitution happens only at print time. Preview shows unresolved `${Param}` tokens as-is.
130
130
131---
131---
132
132
133## State persistence (current)
133## State persistence (current)
134
134
135| Data | Storage | Notes |
135| Data | Storage | Notes |
136|------|---------|-------|
136|------|---------|-------|
137| Template + metadata | `.pos` file on disk | User saves explicitly |
137| Template + metadata | `.pos` file on disk | User saves explicitly |
138| Last parameter values | `PosPrintApp.last_params` | In-memory only; lost on quit |
138| Last parameter values | `PosPrintApp.last_params` | In-memory only; lost on quit |
139| Recent files | — | Not implemented |
139| Recent files | — | Not implemented |
140| Selected printer | — | Not persisted between sessions |
140| Selected printer | — | Not persisted between sessions |
141
141
142---
142---
143
143
144## Testing
144## Testing
145
145
146| Layer | Location | Approach |
146| Layer | Location | Approach |
147|-------|----------|----------|
147|-------|----------|----------|
148| DSL parser | `dsl/parser.rs` | Unit tests |
148| DSL parser | `dsl/parser.rs` | Unit tests |
149| Parameters | `params.rs` | Unit tests |
149| Parameters | `params.rs` | Unit tests |
150| ESC/POS encoder | `escpos.rs` | Byte structure tests |
150| ESC/POS encoder | `escpos.rs` | Byte structure tests |
151| Preview | `preview.rs` | Unit tests |
151| Preview | `preview.rs` | Unit tests |
152| `.pos` I/O | `io/mod.rs` | Round-trip + tempfile tests |
152| `.pos` I/O | `io/mod.rs` | Round-trip + tempfile tests |
153| Printer I/O | `print/mod.rs` | `MockTransport`; no hardware in CI |
153| Printer I/O | `print/mod.rs` | `MockTransport`; no hardware in CI |
154| App | `app.rs` | Default template parse/param tests |
154| App | `app.rs` | Default template parse/param tests |
155
155
156Run: `cargo test` (20 tests). CI runs this on Linux (Docker) and Windows (shell runner).
156Run: `cargo test` (20 tests). CI runs this on Linux (Docker) and Windows (shell runner).
157
157
158---
158---
159
159
160## Build and release
160## Build and release
161
161
162- **CI:** GitLab (`.gitlab-ci.yml`) — `cargo test` on push; release artifacts on tags.
162- **CI:** GitLab (`.gitlab-ci.yml`) — `cargo test` on push; release artifacts on tags.
163- **Linux artifact:** `.deb` via `cargo-deb` (`[package.metadata.deb]` in `Cargo.toml`).
163- **Linux artifact:** `.deb` via `cargo-deb` (`[package.metadata.deb]` in `Cargo.toml`).
164- **Windows artifact:** `target/release/posprint.exe`.
164- **Windows artifact:** `target/release/posprint.exe`.
165- **Versioning:** Semver in `Cargo.toml`; `.pos` `version` field for file-format migrations.
165- **Versioning:** Semver in `Cargo.toml`; `.pos` `version` field for file-format migrations.
166
166
167---
167---
168
168
169## Planned (not implemented)
169## Planned (not implemented)
170
170
171- USB printer class (bulk OUT) without serial emulation
171- USB printer class (bulk OUT) without serial emulation
172- Bluetooth SPP
172- Bluetooth SPP
173- Network printers (TCP 9100)
173- Network printers (TCP 9100)
174- Baud-rate autodetect / settings UI
174- Baud-rate autodetect / settings UI
175- Persisted last parameters and recent files
175- Persisted last parameters and recent files
176- Syntax highlighting in editor
176- Syntax highlighting in editor
177
177
178See [PRINTING.md](PRINTING.md) and [DSL-SPEC.md](DSL-SPEC.md) for protocol and language details.
178See [PRINTING.md](PRINTING.md) and [DSL-SPEC.md](DSL-SPEC.md) for protocol and language details.
docs/BUILD.md +122 −79
@@ -1,79 +1,122 @@
1 # Build scripts
2
3 Local release builds for Windows and Linux.
4
5 ## Windows
6
7 ```powershell
8 .\scripts\build-windows.ps1
9 ```
10
11 Output: `target\release\posprint.exe`
12
13 Options:
14
15 ```powershell
16 .\scripts\build-windows.ps1 -Deb:$false # exe only (default)
17 ```
18
19 ## Linux
20
21 ```bash
22 chmod +x scripts/build-linux.sh
23 ./scripts/build-linux.sh # release binary
24 ./scripts/build-linux.sh --deb # binary + .deb package
25 ```
26
27 On **Arch Linux**:
28
29 ```bash
30 chmod +x scripts/build-arch.sh
31 ./scripts/build-arch.sh # .pkg.tar.zst for pacman
32 sudo pacman -U packaging/arch/posprint-*-x86_64.pkg.tar.zst
33 ```
34
35 Outputs:
36
37 | Artifact | Path |
38 |----------|------|
39 | Binary | `target/release/posprint` |
40 | Debian package | `target/debian/*.deb` |
41 | Arch package | `packaging/arch/posprint-*-x86_64.pkg.tar.zst` |
42
43 ### Linux targets we support
44
45 | Format | Distros | Notes |
46 |--------|---------|-------|
47 | **`.deb`** | Debian, Ubuntu, Mint, Pop!_OS, etc. | **Recommended** for apt-based systems; produced by `cargo-deb` |
48 | **`.pkg.tar.zst`** | Arch Linux, Manjaro, EndeavourOS, etc. | **Recommended** for pacman; `sudo pacman -U posprint-*.pkg.tar.zst` |
49 | **Raw binary** | Any x86_64 Linux | Copy `target/release/posprint`; needs X11/Wayland libs at runtime |
50 | **`.rpm`** | Fedora, RHEL, openSUSE | Not automated yet; build binary and wrap with `fpm` if needed |
51 | **AppImage** | Universal | Not automated yet; good for portable distribution |
52
53 **Architecture:** `x86_64` (amd64) only in CI and build scripts today.
54
55 ### Linux build dependencies (Debian/Ubuntu)
56
57 ```bash
58 sudo apt-get install -y build-essential pkg-config \
59 libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
60 ```
61
62 For `.deb`:
63
64 ```bash
65 cargo install cargo-deb --locked
66 ```
67
68 ### Arch Linux build dependencies
69
70 ```bash
71 sudo pacman -S --needed base-devel rust pkgconf openssl libxkbcommon libxcb dbus-libs \
72 wayland libx11 fontconfig freetype2 libglvnd git rsync
73 ```
74
75 ## Tests before release
76
77 ```bash
78 cargo test --release
79 ```
1 # Build scripts
2
3 Local release builds for Windows and Linux.
4
5 ## Toolchain
6
7 You need a Rust toolchain (**1.88+**; CI uses 1.96). Install once:
8
9 ```bash
10 # Recommended (any distro)
11 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
12 # then restart the shell, or: source "$HOME/.cargo/env"
13
14 # Or on Arch Linux
15 sudo pacman -S --needed rust
16 ```
17
18 Also install the platform build libraries under **Linux build dependencies** below before `cargo test` / `cargo build`.
19
20 ## Windows
21
22 ```powershell
23 .\scripts\build-windows.ps1
24 ```
25
26 Output: `target\release\posprint.exe`
27
28 Options:
29
30 ```powershell
31 .\scripts\build-windows.ps1 -Deb:$false # exe only (default)
32 ```
33
34 ## Linux
35
36 ```bash
37 chmod +x scripts/build-linux.sh
38 ./scripts/build-linux.sh # release binary
39 ./scripts/build-linux.sh --deb # binary + .deb (prompts to install if interactive)
40 ./scripts/build-linux.sh --deb --install # build .deb and install with apt
41 ```
42
43 On **Arch Linux**:
44
45 ```bash
46 chmod +x scripts/build-arch.sh
47 ./scripts/build-arch.sh # .pkg.tar.zst (prompts to install if interactive)
48 ./scripts/build-arch.sh --install # build and install with pacman
49 ```
50
51 `build-arch.sh` accepts a **rustup** toolchain on `PATH`. If the pacman `rust`/`cargo` packages are not installed, it runs `makepkg --nodeps` after verifying `rustc`/`cargo` work (the PKGBUILD still lists those packages for AUR/CI).
52
53 After a successful package build, both scripts ask whether to install (TTY only). Pass `--install` to skip the prompt and install automatically. Non-interactive runs (CI/pipes) never prompt.
54
55 Outputs:
56
57 | Artifact | Path |
58 |----------|------|
59 | Binary | `target/release/posprint` |
60 | Debian package | `target/debian/*.deb` |
61 | Arch package | `packaging/arch/posprint-*-x86_64.pkg.tar.zst` |
62
63 ### Linux targets we support
64
65 | Format | Distros | Notes |
66 |--------|---------|-------|
67 | **`.deb`** | Debian, Ubuntu, Mint, Pop!_OS, etc. | **Recommended** for apt-based systems; produced by `cargo-deb` |
68 | **`.pkg.tar.zst`** | Arch Linux, Manjaro, EndeavourOS, etc. | **Recommended** for pacman; `sudo pacman -U posprint-*.pkg.tar.zst` |
69 | **Raw binary** | Any x86_64 Linux | Copy `target/release/posprint`; needs X11/Wayland libs at runtime |
70 | **`.rpm`** | Fedora, RHEL, openSUSE | Not automated yet; build binary and wrap with `fpm` if needed |
71 | **AppImage** | Universal | Not automated yet; good for portable distribution |
72
73 **Architecture:** `x86_64` (amd64) only in CI and build scripts today.
74
75 ### Linux build dependencies (Debian/Ubuntu)
76
77 ```bash
78 sudo apt-get install -y build-essential pkg-config \
79 libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev \
80 libssl-dev libudev-dev
81 ```
82
83 For `.deb`:
84
85 ```bash
86 cargo install cargo-deb --locked
87 ```
88
89 ### Arch Linux build dependencies
90
91 ```bash
92 sudo pacman -S --needed base-devel rust pkgconf openssl libxkbcommon libxcb dbus \
93 wayland libx11 fontconfig freetype2 libglvnd git rsync
94 ```
95
96 ### File association (`.pos` → posprint)
97
98 The package installs:
99
100 - `/usr/share/mime/packages/posprint.xml` → MIME type `application/x-posprint` for `*.pos`
101 - `/usr/share/applications/posprint.desktop` → claims that MIME type
102
103 After `pacman -U`, pacman hooks refresh the MIME and desktop databases. To make posprint the **default** opener (double-click):
104
105 ```bash
106 xdg-mime default posprint.desktop application/x-posprint
107 xdg-mime query filetype some.pos # expect: application/x-posprint
108 xdg-mime query default application/x-posprint # expect: posprint.desktop
109 ```
110
111 If `query filetype` still says `text/plain`, the MIME package was not installed or the cache is stale:
112
113 ```bash
114 sudo update-mime-database /usr/share/mime
115 sudo update-desktop-database /usr/share/applications
116 ```
117
118 ## Tests before release
119
120 ```bash
121 cargo test --release
122 ```
@@ -1,79 +1,122 @@
1# Build scripts
1# Build scripts
2
2
3Local release builds for Windows and Linux.
3Local release builds for Windows and Linux.
4
4
5## Windows
5## Toolchain
6
6
7```powershell
7You need a Rust toolchain (**1.88+**; CI uses 1.96). Install once:
8.\scripts\build-windows.ps1
8
9```
9```bash
10
10# Recommended (any distro)
11Output: `target\release\posprint.exe`
11curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
12
12# then restart the shell, or: source "$HOME/.cargo/env"
13Options:
13
14
14# Or on Arch Linux
15```powershell
15sudo pacman -S --needed rust
16.\scripts\build-windows.ps1 -Deb:$false # exe only (default)
16```
17```
17
18
18Also install the platform build libraries under **Linux build dependencies** below before `cargo test` / `cargo build`.
19## Linux
19
20
20## Windows
21```bash
21
22chmod +x scripts/build-linux.sh
22```powershell
23./scripts/build-linux.sh # release binary
23.\scripts\build-windows.ps1
24./scripts/build-linux.sh --deb # binary + .deb package
24```
25```
25
26
26Output: `target\release\posprint.exe`
27On **Arch Linux**:
27
28
28Options:
29```bash
29
30chmod +x scripts/build-arch.sh
30```powershell
31./scripts/build-arch.sh # .pkg.tar.zst for pacman
31.\scripts\build-windows.ps1 -Deb:$false # exe only (default)
32sudo pacman -U packaging/arch/posprint-*-x86_64.pkg.tar.zst
32```
33```
33
34
34## Linux
35Outputs:
35
36
36```bash
37| Artifact | Path |
37chmod +x scripts/build-linux.sh
38|----------|------|
38./scripts/build-linux.sh # release binary
39| Binary | `target/release/posprint` |
39./scripts/build-linux.sh --deb # binary + .deb (prompts to install if interactive)
40| Debian package | `target/debian/*.deb` |
40./scripts/build-linux.sh --deb --install # build .deb and install with apt
41| Arch package | `packaging/arch/posprint-*-x86_64.pkg.tar.zst` |
41```
42
42
43### Linux targets we support
43On **Arch Linux**:
44
44
45| Format | Distros | Notes |
45```bash
46|--------|---------|-------|
46chmod +x scripts/build-arch.sh
47| **`.deb`** | Debian, Ubuntu, Mint, Pop!_OS, etc. | **Recommended** for apt-based systems; produced by `cargo-deb` |
47./scripts/build-arch.sh # .pkg.tar.zst (prompts to install if interactive)
48| **`.pkg.tar.zst`** | Arch Linux, Manjaro, EndeavourOS, etc. | **Recommended** for pacman; `sudo pacman -U posprint-*.pkg.tar.zst` |
48./scripts/build-arch.sh --install # build and install with pacman
49| **Raw binary** | Any x86_64 Linux | Copy `target/release/posprint`; needs X11/Wayland libs at runtime |
49```
50| **`.rpm`** | Fedora, RHEL, openSUSE | Not automated yet; build binary and wrap with `fpm` if needed |
50
51| **AppImage** | Universal | Not automated yet; good for portable distribution |
51`build-arch.sh` accepts a **rustup** toolchain on `PATH`. If the pacman `rust`/`cargo` packages are not installed, it runs `makepkg --nodeps` after verifying `rustc`/`cargo` work (the PKGBUILD still lists those packages for AUR/CI).
52
52
53**Architecture:** `x86_64` (amd64) only in CI and build scripts today.
53After a successful package build, both scripts ask whether to install (TTY only). Pass `--install` to skip the prompt and install automatically. Non-interactive runs (CI/pipes) never prompt.
54
54
55### Linux build dependencies (Debian/Ubuntu)
55Outputs:
56
56
57```bash
57| Artifact | Path |
58sudo apt-get install -y build-essential pkg-config \
58|----------|------|
59 libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
59| Binary | `target/release/posprint` |
60```
60| Debian package | `target/debian/*.deb` |
61
61| Arch package | `packaging/arch/posprint-*-x86_64.pkg.tar.zst` |
62For `.deb`:
62
63
63### Linux targets we support
64```bash
64
65cargo install cargo-deb --locked
65| Format | Distros | Notes |
66```
66|--------|---------|-------|
67
67| **`.deb`** | Debian, Ubuntu, Mint, Pop!_OS, etc. | **Recommended** for apt-based systems; produced by `cargo-deb` |
68### Arch Linux build dependencies
68| **`.pkg.tar.zst`** | Arch Linux, Manjaro, EndeavourOS, etc. | **Recommended** for pacman; `sudo pacman -U posprint-*.pkg.tar.zst` |
69
69| **Raw binary** | Any x86_64 Linux | Copy `target/release/posprint`; needs X11/Wayland libs at runtime |
70```bash
70| **`.rpm`** | Fedora, RHEL, openSUSE | Not automated yet; build binary and wrap with `fpm` if needed |
71sudo pacman -S --needed base-devel rust pkgconf openssl libxkbcommon libxcb dbus-libs \
71| **AppImage** | Universal | Not automated yet; good for portable distribution |
72 wayland libx11 fontconfig freetype2 libglvnd git rsync
72
73```
73**Architecture:** `x86_64` (amd64) only in CI and build scripts today.
74
74
75## Tests before release
75### Linux build dependencies (Debian/Ubuntu)
76
76
77```bash
77```bash
78cargo test --release
78sudo apt-get install -y build-essential pkg-config \
79```
79 libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev \
80 libssl-dev libudev-dev
81```
82
83For `.deb`:
84
85```bash
86cargo install cargo-deb --locked
87```
88
89### Arch Linux build dependencies
90
91```bash
92sudo pacman -S --needed base-devel rust pkgconf openssl libxkbcommon libxcb dbus \
93 wayland libx11 fontconfig freetype2 libglvnd git rsync
94```
95
96### File association (`.pos` → posprint)
97
98The package installs:
99
100- `/usr/share/mime/packages/posprint.xml` → MIME type `application/x-posprint` for `*.pos`
101- `/usr/share/applications/posprint.desktop` → claims that MIME type
102
103After `pacman -U`, pacman hooks refresh the MIME and desktop databases. To make posprint the **default** opener (double-click):
104
105```bash
106xdg-mime default posprint.desktop application/x-posprint
107xdg-mime query filetype some.pos # expect: application/x-posprint
108xdg-mime query default application/x-posprint # expect: posprint.desktop
109```
110
111If `query filetype` still says `text/plain`, the MIME package was not installed or the cache is stale:
112
113```bash
114sudo update-mime-database /usr/share/mime
115sudo update-desktop-database /usr/share/applications
116```
117
118## Tests before release
119
120```bash
121cargo test --release
122```
docs/DSL-SPEC.md +269 −269
@@ -1,269 +1,269 @@
1 # Document DSL specification
2
3 A lightweight, markdown-inspired syntax for POS receipt templates. The DSL compiles to an AST and then to ESC/POS bytes or a screen preview.
4
5 > **Implementation:** Parser in `src/dsl/parser.rs`. All constructs below are implemented unless listed under [Future extensions](#future-extensions-not-implemented).
6
7 **Design goals:** easy to author, line-oriented, explicit about POS-specific features (barcodes, cut, feed), parameter-friendly.
8
9 ---
10
11 ## Document structure
12
13 A document is a sequence of **blocks** separated by blank lines. Blocks cannot be nested except for inline markup within text blocks.
14
15 ---
16
17 ## Text blocks
18
19 ### Paragraphs
20
21 Plain text with optional inline markup. One or more consecutive non-empty lines form a paragraph.
22
23 ```markdown
24 Thank you for your purchase!
25 Visit us again soon.
26 ```
27
28 ### Headings
29
30 ```markdown
31 # Store Name
32 ## Receipt
33 ```
34
35 - `#` → large / double-height text (ESC/POS emphasis)
36 - `##` → bold emphasis
37 - Maximum two levels in v1
38
39 ### Alignment
40
41 Prefix a paragraph with alignment markers:
42
43 ```markdown
44 :center:
45 Your Store Name
46
47 :right:
48 Total: ${Amount}
49 ```
50
51 | Marker | Effect |
52 |--------|--------|
53 | `:left:` | Left (default) |
54 | `:center:` | Centered |
55 | `:right:` | Right-aligned |
56
57 ### Inline markup
58
59 | Syntax | Effect |
60 |--------|--------|
61 | `**text**` | Bold |
62 | `*text*` | Italic / emphasized (printer secondary font if available) |
63 | `` `text` `` | Monospace / condensed |
64 | `${Name}` | Parameter placeholder (see Parameters) |
65
66 Parameters work inside any text, and inside barcode/QR/image directives (below).
67
68 **Example:**
69
70 ```markdown
71 Receipt #${DocumentNumber}
72 Date: ${Date}
73
74 Item: ${ItemName} **${LineTotal}**
75 ```
76
77 ### Horizontal rule
78
79 ```markdown
80 ---
81 ```
82
83 Renders a dashed or solid separator line across the print width.
84
85 ---
86
87 ## Directives (block-level)
88
89 Directives start with `@` at the beginning of a line.
90
91 ### Feed (blank lines)
92
93 ```markdown
94 @feed 3
95 ```
96
97 Advances paper by *n* lines.
98
99 ### Cut
100
101 ```markdown
102 @cut
103 ```
104
105 Partial cut after content (if printer supports). Often placed at document end.
106
107 ### Image
108
109 ```markdown
110 @image path/to/logo.png
111 @image ${LogoPath} width=50%
112 @image assets/qr-promo.png width=384
113 ```
114
115 | Attribute | Description |
116 |-----------|-------------|
117 | `path` (positional) | File path relative to `.pos` file or absolute; may be `${Param}` |
118 | `width` | `NN%` of printable width, or absolute dots (e.g. `384`) |
119 | `align` | `left` (default), `center`, `right` |
120
121 Images are converted to monochrome raster data, dithered, and scaled to width.
122
123 ### Barcode
124
125 ```markdown
126 @barcode CODE128 ${Sku}
127 @barcode EAN13 ${EanCode} height=80
128 ```
129
130 | Field | Values |
131 |-------|--------|
132 | Symbology | `CODE128`, `EAN13`, `EAN8`, `CODE39` |
133 | Data | Literal or `${Param}` |
134 | `height` | Module height in dots (default: 64) |
135 | `align` | `left`, `center`, `right` |
136 | `show_text` | `true` / `false` — HRI below barcode (default: true) |
137
138 ### QR code
139
140 ```markdown
141 @qr https://example.com/receipt/${DocumentNumber}
142 @qr ${PaymentUrl} size=6
143 ```
144
145 | Attribute | Description |
146 |-----------|-------------|
147 | Data (positional) | URL or text; may include `${Param}` |
148 | `size` | Module size 1–16 (default: 4) |
149 | `ecc` | Error correction: `L`, `M`, `Q`, `H` (default: `M`) |
150 | `align` | `left`, `center`, `right` |
151
152 ---
153
154 ## Parameters
155
156 ### Syntax
157
158 ```
159 ${ParameterName}
160 ```
161
162 - **Names:** `[A-Za-z_][A-Za-z0-9_]*` (ASCII letters, digits, underscore)
163 - **Case-sensitive:** `${DocNo}` and `${docno}` are different
164 - **Uniqueness at input:** all occurrences of the same name share one value entered at print time
165
166 ### Where parameters are allowed
167
168 | Location | Example |
169 |----------|---------|
170 | Text | `Order ${OrderId}` |
171 | Barcode data | `@barcode CODE128 ${OrderId}` |
172 | QR data | `@qr ${VerifyUrl}` |
173 | Image path | `@image ${LogoPath}` |
174
175 ### Print-time behavior
176
177 1. Before print, scan AST for all `${...}` tokens.
178 2. Deduplicate by name.
179 3. Show dialog with one field per unique name.
180 4. Pre-fill from last print session (global or per-file — implementation choice).
181 5. Substitute into AST, then render/print.
182
183 Missing parameter at print time: block print and highlight unresolved names in UI.
184
185 ---
186
187 ## Comments
188
189 ```markdown
190 <!-- This is a comment, not printed -->
191 ```
192
193 HTML-style comments are stripped at parse time.
194
195 ---
196
197 ## Example document
198
199 ```markdown
200 # ${StoreName}
201 :center:
202
203 123 Main Street
204 Tel: ${StorePhone}
205
206 ---
207 Date: ${Date} Time: ${Time}
208 Receipt: ${DocumentNumber}
209
210 Item Total
211 ${LineItems}
212
213 ---
214 :right:
215 **TOTAL: ${GrandTotal}**
216
217 @barcode CODE128 ${DocumentNumber}
218 @feed 2
219 @qr https://shop.example.com/r/${DocumentNumber}
220
221 Thank you!
222 @feed 4
223 @cut
224 ```
225
226 `${LineItems}` might be pre-formatted multi-line text passed as a single parameter (v1); structured line items are a future extension.
227
228 ---
229
230 ## Parse errors
231
232 The parser reports:
233
234 - Unknown directive
235 - Invalid barcode symbology
236 - Unclosed `**` or `` ` ``
237 - Invalid `${}` name
238 - Missing required directive argument
239
240 Errors include 1-based line and column for editor highlighting.
241
242 ---
243
244 ## ESC/POS mapping (summary)
245
246 | DSL | ESC/POS |
247 |-----|---------|
248 | `# heading` | Double width/height ON → text → OFF |
249 | `**bold**` | Bold ON/OFF |
250 | `:center:` | Justification center |
251 | `@feed n` | Print and feed n lines |
252 | `@cut` | GS V partial cut |
253 | `@barcode` | GS k / CODE128 native |
254 | `@qr` | GS ( k QR model 2 |
255 | `@image` | GS v 0 raster bit image |
256
257 Full command details live in the print encoder module; see [PRINTING.md](PRINTING.md).
258
259 ---
260
261 ## Future extensions (not implemented)
262
263 - `@table` for columnar line items
264 - `UPC-A` barcodes
265 - Conditionals: `@if ${HasDiscount} ... @endif`
266 - Loops / repeating sections
267 - `@signature` for custom ESC/POS hex escape
268 - Multiple code pages / Unicode subset
269 - Syntax highlighting in the editor
1 # Document DSL specification
2
3 A lightweight, markdown-inspired syntax for POS receipt templates. The DSL compiles to an AST and then to ESC/POS bytes or a screen preview.
4
5 > **Implementation:** Parser in `src/dsl/parser.rs`. All constructs below are implemented unless listed under [Future extensions](#future-extensions-not-implemented).
6
7 **Design goals:** easy to author, line-oriented, explicit about POS-specific features (barcodes, cut, feed), parameter-friendly.
8
9 ---
10
11 ## Document structure
12
13 A document is a sequence of **blocks** separated by blank lines. Blocks cannot be nested except for inline markup within text blocks.
14
15 ---
16
17 ## Text blocks
18
19 ### Paragraphs
20
21 Plain text with optional inline markup. One or more consecutive non-empty lines form a paragraph.
22
23 ```markdown
24 Thank you for your purchase!
25 Visit us again soon.
26 ```
27
28 ### Headings
29
30 ```markdown
31 # Store Name
32 ## Receipt
33 ```
34
35 - `#` → large / double-height text (ESC/POS emphasis)
36 - `##` → bold emphasis
37 - Maximum two levels in v1
38
39 ### Alignment
40
41 Prefix a paragraph with alignment markers:
42
43 ```markdown
44 :center:
45 Your Store Name
46
47 :right:
48 Total: ${Amount}
49 ```
50
51 | Marker | Effect |
52 |--------|--------|
53 | `:left:` | Left (default) |
54 | `:center:` | Centered |
55 | `:right:` | Right-aligned |
56
57 ### Inline markup
58
59 | Syntax | Effect |
60 |--------|--------|
61 | `**text**` | Bold |
62 | `*text*` | Italic / emphasized (printer secondary font if available) |
63 | `` `text` `` | Monospace / condensed |
64 | `${Name}` | Parameter placeholder (see Parameters) |
65
66 Parameters work inside any text, and inside barcode/QR/image directives (below).
67
68 **Example:**
69
70 ```markdown
71 Receipt #${DocumentNumber}
72 Date: ${Date}
73
74 Item: ${ItemName} **${LineTotal}**
75 ```
76
77 ### Horizontal rule
78
79 ```markdown
80 ---
81 ```
82
83 Renders a dashed or solid separator line across the print width.
84
85 ---
86
87 ## Directives (block-level)
88
89 Directives start with `@` at the beginning of a line.
90
91 ### Feed (blank lines)
92
93 ```markdown
94 @feed 3
95 ```
96
97 Advances paper by *n* lines.
98
99 ### Cut
100
101 ```markdown
102 @cut
103 ```
104
105 Partial cut after content (if printer supports). Often placed at document end.
106
107 ### Image
108
109 ```markdown
110 @image path/to/logo.png
111 @image ${LogoPath} width=50%
112 @image assets/qr-promo.png width=384
113 ```
114
115 | Attribute | Description |
116 |-----------|-------------|
117 | `path` (positional) | File path relative to `.pos` file or absolute; may be `${Param}` |
118 | `width` | `NN%` of printable width, or absolute dots (e.g. `384`) |
119 | `align` | `left` (default), `center`, `right` |
120
121 Images are converted to monochrome raster data, dithered, and scaled to width.
122
123 ### Barcode
124
125 ```markdown
126 @barcode CODE128 ${Sku}
127 @barcode EAN13 ${EanCode} height=80
128 ```
129
130 | Field | Values |
131 |-------|--------|
132 | Symbology | `CODE128`, `EAN13`, `EAN8`, `CODE39` |
133 | Data | Literal or `${Param}` |
134 | `height` | Module height in dots (default: 64) |
135 | `align` | `left`, `center`, `right` |
136 | `show_text` | `true` / `false` — HRI below barcode (default: true) |
137
138 ### QR code
139
140 ```markdown
141 @qr https://example.com/receipt/${DocumentNumber}
142 @qr ${PaymentUrl} size=6
143 ```
144
145 | Attribute | Description |
146 |-----------|-------------|
147 | Data (positional) | URL or text; may include `${Param}` |
148 | `size` | Module size 1–16 (default: 4) |
149 | `ecc` | Error correction: `L`, `M`, `Q`, `H` (default: `M`) |
150 | `align` | `left`, `center`, `right` |
151
152 ---
153
154 ## Parameters
155
156 ### Syntax
157
158 ```
159 ${ParameterName}
160 ```
161
162 - **Names:** `[A-Za-z_][A-Za-z0-9_]*` (ASCII letters, digits, underscore)
163 - **Case-sensitive:** `${DocNo}` and `${docno}` are different
164 - **Uniqueness at input:** all occurrences of the same name share one value entered at print time
165
166 ### Where parameters are allowed
167
168 | Location | Example |
169 |----------|---------|
170 | Text | `Order ${OrderId}` |
171 | Barcode data | `@barcode CODE128 ${OrderId}` |
172 | QR data | `@qr ${VerifyUrl}` |
173 | Image path | `@image ${LogoPath}` |
174
175 ### Print-time behavior
176
177 1. Before print, scan AST for all `${...}` tokens.
178 2. Deduplicate by name.
179 3. Show dialog with one field per unique name.
180 4. Pre-fill from last print session (global or per-file — implementation choice).
181 5. Substitute into AST, then render/print.
182
183 Missing parameter at print time: block print and highlight unresolved names in UI.
184
185 ---
186
187 ## Comments
188
189 ```markdown
190 <!-- This is a comment, not printed -->
191 ```
192
193 HTML-style comments are stripped at parse time.
194
195 ---
196
197 ## Example document
198
199 ```markdown
200 # ${StoreName}
201 :center:
202
203 123 Main Street
204 Tel: ${StorePhone}
205
206 ---
207 Date: ${Date} Time: ${Time}
208 Receipt: ${DocumentNumber}
209
210 Item Total
211 ${LineItems}
212
213 ---
214 :right:
215 **TOTAL: ${GrandTotal}**
216
217 @barcode CODE128 ${DocumentNumber}
218 @feed 2
219 @qr https://shop.example.com/r/${DocumentNumber}
220
221 Thank you!
222 @feed 4
223 @cut
224 ```
225
226 `${LineItems}` might be pre-formatted multi-line text passed as a single parameter (v1); structured line items are a future extension.
227
228 ---
229
230 ## Parse errors
231
232 The parser reports:
233
234 - Unknown directive
235 - Invalid barcode symbology
236 - Unclosed `**` or `` ` ``
237 - Invalid `${}` name
238 - Missing required directive argument
239
240 Errors include 1-based line and column for editor highlighting.
241
242 ---
243
244 ## ESC/POS mapping (summary)
245
246 | DSL | ESC/POS |
247 |-----|---------|
248 | `# heading` | Double width/height ON → text → OFF |
249 | `**bold**` | Bold ON/OFF |
250 | `:center:` | Justification center |
251 | `@feed n` | Print and feed n lines |
252 | `@cut` | GS V partial cut |
253 | `@barcode` | GS k / CODE128 native |
254 | `@qr` | GS ( k QR model 2 |
255 | `@image` | GS v 0 raster bit image |
256
257 Full command details live in the print encoder module; see [PRINTING.md](PRINTING.md).
258
259 ---
260
261 ## Future extensions (not implemented)
262
263 - `@table` for columnar line items
264 - `UPC-A` barcodes
265 - Conditionals: `@if ${HasDiscount} ... @endif`
266 - Loops / repeating sections
267 - `@signature` for custom ESC/POS hex escape
268 - Multiple code pages / Unicode subset
269 - Syntax highlighting in the editor
@@ -1,269 +1,269 @@
1# Document DSL specification
1# Document DSL specification
2
2
3A lightweight, markdown-inspired syntax for POS receipt templates. The DSL compiles to an AST and then to ESC/POS bytes or a screen preview.
3A lightweight, markdown-inspired syntax for POS receipt templates. The DSL compiles to an AST and then to ESC/POS bytes or a screen preview.
4
4
5> **Implementation:** Parser in `src/dsl/parser.rs`. All constructs below are implemented unless listed under [Future extensions](#future-extensions-not-implemented).
5> **Implementation:** Parser in `src/dsl/parser.rs`. All constructs below are implemented unless listed under [Future extensions](#future-extensions-not-implemented).
6
6
7**Design goals:** easy to author, line-oriented, explicit about POS-specific features (barcodes, cut, feed), parameter-friendly.
7**Design goals:** easy to author, line-oriented, explicit about POS-specific features (barcodes, cut, feed), parameter-friendly.
8
8
9---
9---
10
10
11## Document structure
11## Document structure
12
12
13A document is a sequence of **blocks** separated by blank lines. Blocks cannot be nested except for inline markup within text blocks.
13A document is a sequence of **blocks** separated by blank lines. Blocks cannot be nested except for inline markup within text blocks.
14
14
15---
15---
16
16
17## Text blocks
17## Text blocks
18
18
19### Paragraphs
19### Paragraphs
20
20
21Plain text with optional inline markup. One or more consecutive non-empty lines form a paragraph.
21Plain text with optional inline markup. One or more consecutive non-empty lines form a paragraph.
22
22
23```markdown
23```markdown
24Thank you for your purchase!
24Thank you for your purchase!
25Visit us again soon.
25Visit us again soon.
26```
26```
27
27
28### Headings
28### Headings
29
29
30```markdown
30```markdown
31# Store Name
31# Store Name
32## Receipt
32## Receipt
33```
33```
34
34
35- `#` → large / double-height text (ESC/POS emphasis)
35- `#` → large / double-height text (ESC/POS emphasis)
36- `##` → bold emphasis
36- `##` → bold emphasis
37- Maximum two levels in v1
37- Maximum two levels in v1
38
38
39### Alignment
39### Alignment
40
40
41Prefix a paragraph with alignment markers:
41Prefix a paragraph with alignment markers:
42
42
43```markdown
43```markdown
44:center:
44:center:
45Your Store Name
45Your Store Name
46
46
47:right:
47:right:
48Total: ${Amount}
48Total: ${Amount}
49```
49```
50
50
51| Marker | Effect |
51| Marker | Effect |
52|--------|--------|
52|--------|--------|
53| `:left:` | Left (default) |
53| `:left:` | Left (default) |
54| `:center:` | Centered |
54| `:center:` | Centered |
55| `:right:` | Right-aligned |
55| `:right:` | Right-aligned |
56
56
57### Inline markup
57### Inline markup
58
58
59| Syntax | Effect |
59| Syntax | Effect |
60|--------|--------|
60|--------|--------|
61| `**text**` | Bold |
61| `**text**` | Bold |
62| `*text*` | Italic / emphasized (printer secondary font if available) |
62| `*text*` | Italic / emphasized (printer secondary font if available) |
63| `` `text` `` | Monospace / condensed |
63| `` `text` `` | Monospace / condensed |
64| `${Name}` | Parameter placeholder (see Parameters) |
64| `${Name}` | Parameter placeholder (see Parameters) |
65
65
66Parameters work inside any text, and inside barcode/QR/image directives (below).
66Parameters work inside any text, and inside barcode/QR/image directives (below).
67
67
68**Example:**
68**Example:**
69
69
70```markdown
70```markdown
71Receipt #${DocumentNumber}
71Receipt #${DocumentNumber}
72Date: ${Date}
72Date: ${Date}
73
73
74Item: ${ItemName} **${LineTotal}**
74Item: ${ItemName} **${LineTotal}**
75```
75```
76
76
77### Horizontal rule
77### Horizontal rule
78
78
79```markdown
79```markdown
80---
80---
81```
81```
82
82
83Renders a dashed or solid separator line across the print width.
83Renders a dashed or solid separator line across the print width.
84
84
85---
85---
86
86
87## Directives (block-level)
87## Directives (block-level)
88
88
89Directives start with `@` at the beginning of a line.
89Directives start with `@` at the beginning of a line.
90
90
91### Feed (blank lines)
91### Feed (blank lines)
92
92
93```markdown
93```markdown
94@feed 3
94@feed 3
95```
95```
96
96
97Advances paper by *n* lines.
97Advances paper by *n* lines.
98
98
99### Cut
99### Cut
100
100
101```markdown
101```markdown
102@cut
102@cut
103```
103```
104
104
105Partial cut after content (if printer supports). Often placed at document end.
105Partial cut after content (if printer supports). Often placed at document end.
106
106
107### Image
107### Image
108
108
109```markdown
109```markdown
110@image path/to/logo.png
110@image path/to/logo.png
111@image ${LogoPath} width=50%
111@image ${LogoPath} width=50%
112@image assets/qr-promo.png width=384
112@image assets/qr-promo.png width=384
113```
113```
114
114
115| Attribute | Description |
115| Attribute | Description |
116|-----------|-------------|
116|-----------|-------------|
117| `path` (positional) | File path relative to `.pos` file or absolute; may be `${Param}` |
117| `path` (positional) | File path relative to `.pos` file or absolute; may be `${Param}` |
118| `width` | `NN%` of printable width, or absolute dots (e.g. `384`) |
118| `width` | `NN%` of printable width, or absolute dots (e.g. `384`) |
119| `align` | `left` (default), `center`, `right` |
119| `align` | `left` (default), `center`, `right` |
120
120
121Images are converted to monochrome raster data, dithered, and scaled to width.
121Images are converted to monochrome raster data, dithered, and scaled to width.
122
122
123### Barcode
123### Barcode
124
124
125```markdown
125```markdown
126@barcode CODE128 ${Sku}
126@barcode CODE128 ${Sku}
127@barcode EAN13 ${EanCode} height=80
127@barcode EAN13 ${EanCode} height=80
128```
128```
129
129
130| Field | Values |
130| Field | Values |
131|-------|--------|
131|-------|--------|
132| Symbology | `CODE128`, `EAN13`, `EAN8`, `CODE39` |
132| Symbology | `CODE128`, `EAN13`, `EAN8`, `CODE39` |
133| Data | Literal or `${Param}` |
133| Data | Literal or `${Param}` |
134| `height` | Module height in dots (default: 64) |
134| `height` | Module height in dots (default: 64) |
135| `align` | `left`, `center`, `right` |
135| `align` | `left`, `center`, `right` |
136| `show_text` | `true` / `false` — HRI below barcode (default: true) |
136| `show_text` | `true` / `false` — HRI below barcode (default: true) |
137
137
138### QR code
138### QR code
139
139
140```markdown
140```markdown
141@qr https://example.com/receipt/${DocumentNumber}
141@qr https://example.com/receipt/${DocumentNumber}
142@qr ${PaymentUrl} size=6
142@qr ${PaymentUrl} size=6
143```
143```
144
144
145| Attribute | Description |
145| Attribute | Description |
146|-----------|-------------|
146|-----------|-------------|
147| Data (positional) | URL or text; may include `${Param}` |
147| Data (positional) | URL or text; may include `${Param}` |
148| `size` | Module size 1–16 (default: 4) |
148| `size` | Module size 1–16 (default: 4) |
149| `ecc` | Error correction: `L`, `M`, `Q`, `H` (default: `M`) |
149| `ecc` | Error correction: `L`, `M`, `Q`, `H` (default: `M`) |
150| `align` | `left`, `center`, `right` |
150| `align` | `left`, `center`, `right` |
151
151
152---
152---
153
153
154## Parameters
154## Parameters
155
155
156### Syntax
156### Syntax
157
157
158```
158```
159${ParameterName}
159${ParameterName}
160```
160```
161
161
162- **Names:** `[A-Za-z_][A-Za-z0-9_]*` (ASCII letters, digits, underscore)
162- **Names:** `[A-Za-z_][A-Za-z0-9_]*` (ASCII letters, digits, underscore)
163- **Case-sensitive:** `${DocNo}` and `${docno}` are different
163- **Case-sensitive:** `${DocNo}` and `${docno}` are different
164- **Uniqueness at input:** all occurrences of the same name share one value entered at print time
164- **Uniqueness at input:** all occurrences of the same name share one value entered at print time
165
165
166### Where parameters are allowed
166### Where parameters are allowed
167
167
168| Location | Example |
168| Location | Example |
169|----------|---------|
169|----------|---------|
170| Text | `Order ${OrderId}` |
170| Text | `Order ${OrderId}` |
171| Barcode data | `@barcode CODE128 ${OrderId}` |
171| Barcode data | `@barcode CODE128 ${OrderId}` |
172| QR data | `@qr ${VerifyUrl}` |
172| QR data | `@qr ${VerifyUrl}` |
173| Image path | `@image ${LogoPath}` |
173| Image path | `@image ${LogoPath}` |
174
174
175### Print-time behavior
175### Print-time behavior
176
176
1771. Before print, scan AST for all `${...}` tokens.
1771. Before print, scan AST for all `${...}` tokens.
1782. Deduplicate by name.
1782. Deduplicate by name.
1793. Show dialog with one field per unique name.
1793. Show dialog with one field per unique name.
1804. Pre-fill from last print session (global or per-file — implementation choice).
1804. Pre-fill from last print session (global or per-file — implementation choice).
1815. Substitute into AST, then render/print.
1815. Substitute into AST, then render/print.
182
182
183Missing parameter at print time: block print and highlight unresolved names in UI.
183Missing parameter at print time: block print and highlight unresolved names in UI.
184
184
185---
185---
186
186
187## Comments
187## Comments
188
188
189```markdown
189```markdown
190<!-- This is a comment, not printed -->
190<!-- This is a comment, not printed -->
191```
191```
192
192
193HTML-style comments are stripped at parse time.
193HTML-style comments are stripped at parse time.
194
194
195---
195---
196
196
197## Example document
197## Example document
198
198
199```markdown
199```markdown
200# ${StoreName}
200# ${StoreName}
201:center:
201:center:
202
202
203123 Main Street
203123 Main Street
204Tel: ${StorePhone}
204Tel: ${StorePhone}
205
205
206---
206---
207Date: ${Date} Time: ${Time}
207Date: ${Date} Time: ${Time}
208Receipt: ${DocumentNumber}
208Receipt: ${DocumentNumber}
209
209
210Item Total
210Item Total
211${LineItems}
211${LineItems}
212
212
213---
213---
214:right:
214:right:
215**TOTAL: ${GrandTotal}**
215**TOTAL: ${GrandTotal}**
216
216
217@barcode CODE128 ${DocumentNumber}
217@barcode CODE128 ${DocumentNumber}
218@feed 2
218@feed 2
219@qr https://shop.example.com/r/${DocumentNumber}
219@qr https://shop.example.com/r/${DocumentNumber}
220
220
221Thank you!
221Thank you!
222@feed 4
222@feed 4
223@cut
223@cut
224```
224```
225
225
226`${LineItems}` might be pre-formatted multi-line text passed as a single parameter (v1); structured line items are a future extension.
226`${LineItems}` might be pre-formatted multi-line text passed as a single parameter (v1); structured line items are a future extension.
227
227
228---
228---
229
229
230## Parse errors
230## Parse errors
231
231
232The parser reports:
232The parser reports:
233
233
234- Unknown directive
234- Unknown directive
235- Invalid barcode symbology
235- Invalid barcode symbology
236- Unclosed `**` or `` ` ``
236- Unclosed `**` or `` ` ``
237- Invalid `${}` name
237- Invalid `${}` name
238- Missing required directive argument
238- Missing required directive argument
239
239
240Errors include 1-based line and column for editor highlighting.
240Errors include 1-based line and column for editor highlighting.
241
241
242---
242---
243
243
244## ESC/POS mapping (summary)
244## ESC/POS mapping (summary)
245
245
246| DSL | ESC/POS |
246| DSL | ESC/POS |
247|-----|---------|
247|-----|---------|
248| `# heading` | Double width/height ON → text → OFF |
248| `# heading` | Double width/height ON → text → OFF |
249| `**bold**` | Bold ON/OFF |
249| `**bold**` | Bold ON/OFF |
250| `:center:` | Justification center |
250| `:center:` | Justification center |
251| `@feed n` | Print and feed n lines |
251| `@feed n` | Print and feed n lines |
252| `@cut` | GS V partial cut |
252| `@cut` | GS V partial cut |
253| `@barcode` | GS k / CODE128 native |
253| `@barcode` | GS k / CODE128 native |
254| `@qr` | GS ( k QR model 2 |
254| `@qr` | GS ( k QR model 2 |
255| `@image` | GS v 0 raster bit image |
255| `@image` | GS v 0 raster bit image |
256
256
257Full command details live in the print encoder module; see [PRINTING.md](PRINTING.md).
257Full command details live in the print encoder module; see [PRINTING.md](PRINTING.md).
258
258
259---
259---
260
260
261## Future extensions (not implemented)
261## Future extensions (not implemented)
262
262
263- `@table` for columnar line items
263- `@table` for columnar line items
264- `UPC-A` barcodes
264- `UPC-A` barcodes
265- Conditionals: `@if ${HasDiscount} ... @endif`
265- Conditionals: `@if ${HasDiscount} ... @endif`
266- Loops / repeating sections
266- Loops / repeating sections
267- `@signature` for custom ESC/POS hex escape
267- `@signature` for custom ESC/POS hex escape
268- Multiple code pages / Unicode subset
268- Multiple code pages / Unicode subset
269- Syntax highlighting in the editor
269- Syntax highlighting in the editor
docs/FEASIBILITY.md +166 −166
@@ -1,166 +1,166 @@
1 # Feasibility and complexity assessment
2
3 > **Status:** MVP (v0.1.0) **implemented** — Rust + egui, USB-serial printing, 20 unit tests. This document retains the original feasibility analysis; see [ARCHITECTURE.md](ARCHITECTURE.md) for what is built today.
4
5 ## Executive summary
6
7 | Question | Answer |
8 |----------|--------|
9 | Is it feasible? | **Yes** — all required capabilities exist in mature libraries or documented protocols |
10 | Overall complexity | **Medium–high** for a complete v1; **medium** if Bluetooth is deferred |
11 | Biggest risk | Cross-platform raw printer I/O (USB class, serial, Bluetooth SPP) |
12 | Recommended MVP scope | USB-serial printers first (**done**); USB-printer-class and Bluetooth later |
13
14 A focused MVP is realistic for one developer in roughly **6–10 weeks**. A polished v1 with broad printer compatibility is closer to **3–4 months**.
15
16 ---
17
18 ## Requirements breakdown
19
20 ### 1. Cross-platform desktop app (Windows + Linux)
21
22 | Aspect | Feasibility | Complexity |
23 |--------|-------------|------------|
24 | Single codebase, native binaries | High | Low–medium |
25 | Packaged installers (.msi/.exe, .deb/AppImage) | High | Medium |
26
27 Modern cross-platform desktop frameworks (Tauri, egui, Avalonia, Qt) all support Windows and Linux. Packaging is routine but needs CI and per-OS testing.
28
29 ### 2. Markdown-like document syntax + live preview
30
31 | Aspect | Feasibility | Complexity |
32 |--------|-------------|------------|
33 | Custom lightweight DSL | High | Medium |
34 | Live preview pane | High | Medium |
35 | Width modes (auto-scale / fixed mm) | High | Low–medium |
36
37 The DSL does not need full CommonMark — a small, POS-oriented grammar keeps the parser simple. Preview renders to a monospace layout matching printer dot width (e.g. 384 dots @ 58 mm, 576 dots @ 80 mm). Matching exact printer fonts is approximate in preview; exact fidelity is only guaranteed at print time.
38
39 ### 3. Save / load `.pos` files
40
41 | Aspect | Feasibility | Complexity |
42 |--------|-------------|------------|
43 | JSON or TOML envelope + body text | High | Low |
44
45 Trivial with serde (Rust) or equivalent. Version field supports forward-compatible evolution.
46
47 ### 4. Parameter tokens (`${Name}`)
48
49 | Aspect | Feasibility | Complexity |
50 |--------|-------------|------------|
51 | Parse and collect unique names | High | Low |
52 | Print-time modal with last-used values | High | Low |
53 | Deduplicate same name across document | High | Low |
54 | Use in text, barcodes, QR, images | High | Low–medium |
55
56 Straightforward string substitution after validation. Image parameters might reference file paths or base64 — define clearly in DSL spec.
57
58 ### 5. Barcodes, QR codes, images
59
60 | Aspect | Feasibility | Complexity |
61 |--------|-------------|------------|
62 | Generate ESC/POS barcode commands | High | Low |
63 | Generate ESC/POS QR commands | High | Low |
64 | Rasterize images to printer width | High | Medium |
65
66 ESC/POS barcode, QR, and raster image commands are implemented in `src/escpos.rs` (in-tree). Preview uses text placeholders for barcodes/QR/images.
67
68 ### 6. Direct USB / Bluetooth printing (raw bytes, no spooler)
69
70 | Aspect | Feasibility | Complexity |
71 |--------|-------------|------------|
72 | USB serial (CDC-ACM, CH340, FTDI) | **High** | Medium |
73 | USB printer class (bulk OUT) | Medium | **High** |
74 | Bluetooth Classic SPP | Medium | **High** |
75 | Enumerate devices in UI | Medium | Medium |
76 | Printer-specific quirks | Ongoing | **High** |
77
78 This is the **primary technical risk**.
79
80 #### How POS printers actually connect
81
82 Most consumer thermal printers expose one of:
83
84 1. **Virtual COM port (USB-serial)** — very common; appears as `COM3` (Windows) or `/dev/ttyUSB0` / `/dev/ttyACM0` (Linux). Raw ESC/POS bytes are written to the serial port. **Easiest path.**
85
86 2. **USB printer class (interface 7)** — bulk transfers; **not implemented**. Would need `nusb` or Windows `usbprint.sys`.
87
88 3. **Bluetooth Classic SPP** — **not implemented**; deferred.
89
90 4. **Network (TCP 9100)** — common in production but **out of scope** unless added later.
91
92 “No drivers” in practice means **no Windows print spooler / CUPS job** — the app opens the device directly and writes bytes. USB-serial devices often need only the generic CDC driver already present. USB-printer-class devices on Windows may still use `usbprint.sys`, which is a kernel driver but not a vendor-specific print driver.
93
94 #### Compatibility reality
95
96 - **MVP (done):** Epson-compatible ESC/POS over USB-serial at 9600 baud.
97 - **Future:** USB printer class, Bluetooth SPP.
98
99 Expect **per-printer testing**; some devices need init sequences, code pages, or cut commands that differ slightly.
100
101 ---
102
103 ## Complexity by subsystem
104
105 ```
106 Effort (relative)
107 Editor UI ████████░░ Medium
108 Preview renderer ███████░░░ Medium
109 DSL parser ██████░░░░ Medium
110 File I/O ██░░░░░░░░ Low
111 Parameters ███░░░░░░░ Low
112 Barcode/QR/image █████░░░░░ Low–medium
113 Printer discovery ███████░░░ Medium
114 Raw print I/O █████████░ High
115 Integration/polish ██████░░░░ Medium
116 ```
117
118 ---
119
120 ## Effort estimate (one experienced developer)
121
122 | Phase | Scope | Duration |
123 |-------|-------|----------|
124 | **0 — Design** | Specs, DSL, file format | 1 week |
125 | **1 — Core** | Parser, ESC/POS builder, preview, `.pos` I/O | 2–3 weeks |
126 | **2 — UI** | Editor, preview split, settings, parameters dialog | 2 weeks |
127 | **3 — Print MVP** | USB-serial enumeration + print | 1–2 weeks |
128 | **4 — Hardening** | USB class, BT, edge cases, packaging | 2–4 weeks |
129
130 **MVP (serial USB only):** ~6–8 weeks
131 **Full v1 (USB + BT, packaged):** ~10–14 weeks
132
133 Add 30–50% if the developer is new to Rust or ESC/POS.
134
135 ---
136
137 ## Risks and mitigations
138
139 | Risk | Impact | Mitigation |
140 |------|--------|------------|
141 | Printer hardware diversity | Prints garbled or not at all | ESC/POS subset doc; test matrix; user-selectable code page |
142 | Linux permissions (`dialout`) | Cannot open serial port | Document group membership; clear error UI |
143 | Windows USB access | Admin / driver conflicts | Prefer serial-first; use `usbprint` where applicable |
144 | Bluetooth pairing UX | Users cannot find printer | Defer BT; link to OS pairing instructions |
145 | Preview ≠ print | User confusion | Label preview as approximate; same backend for print |
146 | Image size on narrow paper | Slow print or clipped | Auto-scale to page width; warn in UI |
147
148 ---
149
150 ## Out of scope (current release)
151
152 - Bluetooth printing
153 - USB printer class (non-serial)
154 - Network printers (TCP 9100)
155 - Non-ESC/POS protocols (Star Line, ZPL)
156 - Multi-column layout engines
157 - Collaborative editing / cloud sync
158 - macOS (feasible later with same stack)
159
160 ---
161
162 ## Recommendation
163
164 **MVP delivered.** Next increments: USB printer class, baud settings, persisted parameters, hardware test matrix. Bluetooth only if explicitly needed.
165
166 See [LANGUAGE-CHOICE.md](LANGUAGE-CHOICE.md) and [ARCHITECTURE.md](ARCHITECTURE.md).
1 # Feasibility and complexity assessment
2
3 > **Status:** MVP (v0.1.0) **implemented** — Rust + egui, USB-serial printing, 20 unit tests. This document retains the original feasibility analysis; see [ARCHITECTURE.md](ARCHITECTURE.md) for what is built today.
4
5 ## Executive summary
6
7 | Question | Answer |
8 |----------|--------|
9 | Is it feasible? | **Yes** — all required capabilities exist in mature libraries or documented protocols |
10 | Overall complexity | **Medium–high** for a complete v1; **medium** if Bluetooth is deferred |
11 | Biggest risk | Cross-platform raw printer I/O (USB class, serial, Bluetooth SPP) |
12 | Recommended MVP scope | USB-serial printers first (**done**); USB-printer-class and Bluetooth later |
13
14 A focused MVP is realistic for one developer in roughly **6–10 weeks**. A polished v1 with broad printer compatibility is closer to **3–4 months**.
15
16 ---
17
18 ## Requirements breakdown
19
20 ### 1. Cross-platform desktop app (Windows + Linux)
21
22 | Aspect | Feasibility | Complexity |
23 |--------|-------------|------------|
24 | Single codebase, native binaries | High | Low–medium |
25 | Packaged installers (.msi/.exe, .deb/AppImage) | High | Medium |
26
27 Modern cross-platform desktop frameworks (Tauri, egui, Avalonia, Qt) all support Windows and Linux. Packaging is routine but needs CI and per-OS testing.
28
29 ### 2. Markdown-like document syntax + live preview
30
31 | Aspect | Feasibility | Complexity |
32 |--------|-------------|------------|
33 | Custom lightweight DSL | High | Medium |
34 | Live preview pane | High | Medium |
35 | Width modes (auto-scale / fixed mm) | High | Low–medium |
36
37 The DSL does not need full CommonMark — a small, POS-oriented grammar keeps the parser simple. Preview renders to a monospace layout matching printer dot width (e.g. 384 dots @ 58 mm, 576 dots @ 80 mm). Matching exact printer fonts is approximate in preview; exact fidelity is only guaranteed at print time.
38
39 ### 3. Save / load `.pos` files
40
41 | Aspect | Feasibility | Complexity |
42 |--------|-------------|------------|
43 | JSON or TOML envelope + body text | High | Low |
44
45 Trivial with serde (Rust) or equivalent. Version field supports forward-compatible evolution.
46
47 ### 4. Parameter tokens (`${Name}`)
48
49 | Aspect | Feasibility | Complexity |
50 |--------|-------------|------------|
51 | Parse and collect unique names | High | Low |
52 | Print-time modal with last-used values | High | Low |
53 | Deduplicate same name across document | High | Low |
54 | Use in text, barcodes, QR, images | High | Low–medium |
55
56 Straightforward string substitution after validation. Image parameters might reference file paths or base64 — define clearly in DSL spec.
57
58 ### 5. Barcodes, QR codes, images
59
60 | Aspect | Feasibility | Complexity |
61 |--------|-------------|------------|
62 | Generate ESC/POS barcode commands | High | Low |
63 | Generate ESC/POS QR commands | High | Low |
64 | Rasterize images to printer width | High | Medium |
65
66 ESC/POS barcode, QR, and raster image commands are implemented in `src/escpos.rs` (in-tree). Preview uses text placeholders for barcodes/QR/images.
67
68 ### 6. Direct USB / Bluetooth printing (raw bytes, no spooler)
69
70 | Aspect | Feasibility | Complexity |
71 |--------|-------------|------------|
72 | USB serial (CDC-ACM, CH340, FTDI) | **High** | Medium |
73 | USB printer class (bulk OUT) | Medium | **High** |
74 | Bluetooth Classic SPP | Medium | **High** |
75 | Enumerate devices in UI | Medium | Medium |
76 | Printer-specific quirks | Ongoing | **High** |
77
78 This is the **primary technical risk**.
79
80 #### How POS printers actually connect
81
82 Most consumer thermal printers expose one of:
83
84 1. **Virtual COM port (USB-serial)** — very common; appears as `COM3` (Windows) or `/dev/ttyUSB0` / `/dev/ttyACM0` (Linux). Raw ESC/POS bytes are written to the serial port. **Easiest path.**
85
86 2. **USB printer class (interface 7)** — bulk transfers; **not implemented**. Would need `nusb` or Windows `usbprint.sys`.
87
88 3. **Bluetooth Classic SPP** — **not implemented**; deferred.
89
90 4. **Network (TCP 9100)** — common in production but **out of scope** unless added later.
91
92 “No drivers” in practice means **no Windows print spooler / CUPS job** — the app opens the device directly and writes bytes. USB-serial devices often need only the generic CDC driver already present. USB-printer-class devices on Windows may still use `usbprint.sys`, which is a kernel driver but not a vendor-specific print driver.
93
94 #### Compatibility reality
95
96 - **MVP (done):** Epson-compatible ESC/POS over USB-serial at 9600 baud.
97 - **Future:** USB printer class, Bluetooth SPP.
98
99 Expect **per-printer testing**; some devices need init sequences, code pages, or cut commands that differ slightly.
100
101 ---
102
103 ## Complexity by subsystem
104
105 ```
106 Effort (relative)
107 Editor UI ████████░░ Medium
108 Preview renderer ███████░░░ Medium
109 DSL parser ██████░░░░ Medium
110 File I/O ██░░░░░░░░ Low
111 Parameters ███░░░░░░░ Low
112 Barcode/QR/image █████░░░░░ Low–medium
113 Printer discovery ███████░░░ Medium
114 Raw print I/O █████████░ High
115 Integration/polish ██████░░░░ Medium
116 ```
117
118 ---
119
120 ## Effort estimate (one experienced developer)
121
122 | Phase | Scope | Duration |
123 |-------|-------|----------|
124 | **0 — Design** | Specs, DSL, file format | 1 week |
125 | **1 — Core** | Parser, ESC/POS builder, preview, `.pos` I/O | 2–3 weeks |
126 | **2 — UI** | Editor, preview split, settings, parameters dialog | 2 weeks |
127 | **3 — Print MVP** | USB-serial enumeration + print | 1–2 weeks |
128 | **4 — Hardening** | USB class, BT, edge cases, packaging | 2–4 weeks |
129
130 **MVP (serial USB only):** ~6–8 weeks
131 **Full v1 (USB + BT, packaged):** ~10–14 weeks
132
133 Add 30–50% if the developer is new to Rust or ESC/POS.
134
135 ---
136
137 ## Risks and mitigations
138
139 | Risk | Impact | Mitigation |
140 |------|--------|------------|
141 | Printer hardware diversity | Prints garbled or not at all | ESC/POS subset doc; test matrix; user-selectable code page |
142 | Linux permissions (`dialout`) | Cannot open serial port | Document group membership; clear error UI |
143 | Windows USB access | Admin / driver conflicts | Prefer serial-first; use `usbprint` where applicable |
144 | Bluetooth pairing UX | Users cannot find printer | Defer BT; link to OS pairing instructions |
145 | Preview ≠ print | User confusion | Label preview as approximate; same backend for print |
146 | Image size on narrow paper | Slow print or clipped | Auto-scale to page width; warn in UI |
147
148 ---
149
150 ## Out of scope (current release)
151
152 - Bluetooth printing
153 - USB printer class (non-serial)
154 - Network printers (TCP 9100)
155 - Non-ESC/POS protocols (Star Line, ZPL)
156 - Multi-column layout engines
157 - Collaborative editing / cloud sync
158 - macOS (feasible later with same stack)
159
160 ---
161
162 ## Recommendation
163
164 **MVP delivered.** Next increments: USB printer class, baud settings, persisted parameters, hardware test matrix. Bluetooth only if explicitly needed.
165
166 See [LANGUAGE-CHOICE.md](LANGUAGE-CHOICE.md) and [ARCHITECTURE.md](ARCHITECTURE.md).
@@ -1,166 +1,166 @@
1# Feasibility and complexity assessment
1# Feasibility and complexity assessment
2
2
3> **Status:** MVP (v0.1.0) **implemented** — Rust + egui, USB-serial printing, 20 unit tests. This document retains the original feasibility analysis; see [ARCHITECTURE.md](ARCHITECTURE.md) for what is built today.
3> **Status:** MVP (v0.1.0) **implemented** — Rust + egui, USB-serial printing, 20 unit tests. This document retains the original feasibility analysis; see [ARCHITECTURE.md](ARCHITECTURE.md) for what is built today.
4
4
5## Executive summary
5## Executive summary
6
6
7| Question | Answer |
7| Question | Answer |
8|----------|--------|
8|----------|--------|
9| Is it feasible? | **Yes** — all required capabilities exist in mature libraries or documented protocols |
9| Is it feasible? | **Yes** — all required capabilities exist in mature libraries or documented protocols |
10| Overall complexity | **Medium–high** for a complete v1; **medium** if Bluetooth is deferred |
10| Overall complexity | **Medium–high** for a complete v1; **medium** if Bluetooth is deferred |
11| Biggest risk | Cross-platform raw printer I/O (USB class, serial, Bluetooth SPP) |
11| Biggest risk | Cross-platform raw printer I/O (USB class, serial, Bluetooth SPP) |
12| Recommended MVP scope | USB-serial printers first (**done**); USB-printer-class and Bluetooth later |
12| Recommended MVP scope | USB-serial printers first (**done**); USB-printer-class and Bluetooth later |
13
13
14A focused MVP is realistic for one developer in roughly **6–10 weeks**. A polished v1 with broad printer compatibility is closer to **3–4 months**.
14A focused MVP is realistic for one developer in roughly **6–10 weeks**. A polished v1 with broad printer compatibility is closer to **3–4 months**.
15
15
16---
16---
17
17
18## Requirements breakdown
18## Requirements breakdown
19
19
20### 1. Cross-platform desktop app (Windows + Linux)
20### 1. Cross-platform desktop app (Windows + Linux)
21
21
22| Aspect | Feasibility | Complexity |
22| Aspect | Feasibility | Complexity |
23|--------|-------------|------------|
23|--------|-------------|------------|
24| Single codebase, native binaries | High | Low–medium |
24| Single codebase, native binaries | High | Low–medium |
25| Packaged installers (.msi/.exe, .deb/AppImage) | High | Medium |
25| Packaged installers (.msi/.exe, .deb/AppImage) | High | Medium |
26
26
27Modern cross-platform desktop frameworks (Tauri, egui, Avalonia, Qt) all support Windows and Linux. Packaging is routine but needs CI and per-OS testing.
27Modern cross-platform desktop frameworks (Tauri, egui, Avalonia, Qt) all support Windows and Linux. Packaging is routine but needs CI and per-OS testing.
28
28
29### 2. Markdown-like document syntax + live preview
29### 2. Markdown-like document syntax + live preview
30
30
31| Aspect | Feasibility | Complexity |
31| Aspect | Feasibility | Complexity |
32|--------|-------------|------------|
32|--------|-------------|------------|
33| Custom lightweight DSL | High | Medium |
33| Custom lightweight DSL | High | Medium |
34| Live preview pane | High | Medium |
34| Live preview pane | High | Medium |
35| Width modes (auto-scale / fixed mm) | High | Low–medium |
35| Width modes (auto-scale / fixed mm) | High | Low–medium |
36
36
37The DSL does not need full CommonMark — a small, POS-oriented grammar keeps the parser simple. Preview renders to a monospace layout matching printer dot width (e.g. 384 dots @ 58 mm, 576 dots @ 80 mm). Matching exact printer fonts is approximate in preview; exact fidelity is only guaranteed at print time.
37The DSL does not need full CommonMark — a small, POS-oriented grammar keeps the parser simple. Preview renders to a monospace layout matching printer dot width (e.g. 384 dots @ 58 mm, 576 dots @ 80 mm). Matching exact printer fonts is approximate in preview; exact fidelity is only guaranteed at print time.
38
38
39### 3. Save / load `.pos` files
39### 3. Save / load `.pos` files
40
40
41| Aspect | Feasibility | Complexity |
41| Aspect | Feasibility | Complexity |
42|--------|-------------|------------|
42|--------|-------------|------------|
43| JSON or TOML envelope + body text | High | Low |
43| JSON or TOML envelope + body text | High | Low |
44
44
45Trivial with serde (Rust) or equivalent. Version field supports forward-compatible evolution.
45Trivial with serde (Rust) or equivalent. Version field supports forward-compatible evolution.
46
46
47### 4. Parameter tokens (`${Name}`)
47### 4. Parameter tokens (`${Name}`)
48
48
49| Aspect | Feasibility | Complexity |
49| Aspect | Feasibility | Complexity |
50|--------|-------------|------------|
50|--------|-------------|------------|
51| Parse and collect unique names | High | Low |
51| Parse and collect unique names | High | Low |
52| Print-time modal with last-used values | High | Low |
52| Print-time modal with last-used values | High | Low |
53| Deduplicate same name across document | High | Low |
53| Deduplicate same name across document | High | Low |
54| Use in text, barcodes, QR, images | High | Low–medium |
54| Use in text, barcodes, QR, images | High | Low–medium |
55
55
56Straightforward string substitution after validation. Image parameters might reference file paths or base64 — define clearly in DSL spec.
56Straightforward string substitution after validation. Image parameters might reference file paths or base64 — define clearly in DSL spec.
57
57
58### 5. Barcodes, QR codes, images
58### 5. Barcodes, QR codes, images
59
59
60| Aspect | Feasibility | Complexity |
60| Aspect | Feasibility | Complexity |
61|--------|-------------|------------|
61|--------|-------------|------------|
62| Generate ESC/POS barcode commands | High | Low |
62| Generate ESC/POS barcode commands | High | Low |
63| Generate ESC/POS QR commands | High | Low |
63| Generate ESC/POS QR commands | High | Low |
64| Rasterize images to printer width | High | Medium |
64| Rasterize images to printer width | High | Medium |
65
65
66ESC/POS barcode, QR, and raster image commands are implemented in `src/escpos.rs` (in-tree). Preview uses text placeholders for barcodes/QR/images.
66ESC/POS barcode, QR, and raster image commands are implemented in `src/escpos.rs` (in-tree). Preview uses text placeholders for barcodes/QR/images.
67
67
68### 6. Direct USB / Bluetooth printing (raw bytes, no spooler)
68### 6. Direct USB / Bluetooth printing (raw bytes, no spooler)
69
69
70| Aspect | Feasibility | Complexity |
70| Aspect | Feasibility | Complexity |
71|--------|-------------|------------|
71|--------|-------------|------------|
72| USB serial (CDC-ACM, CH340, FTDI) | **High** | Medium |
72| USB serial (CDC-ACM, CH340, FTDI) | **High** | Medium |
73| USB printer class (bulk OUT) | Medium | **High** |
73| USB printer class (bulk OUT) | Medium | **High** |
74| Bluetooth Classic SPP | Medium | **High** |
74| Bluetooth Classic SPP | Medium | **High** |
75| Enumerate devices in UI | Medium | Medium |
75| Enumerate devices in UI | Medium | Medium |
76| Printer-specific quirks | Ongoing | **High** |
76| Printer-specific quirks | Ongoing | **High** |
77
77
78This is the **primary technical risk**.
78This is the **primary technical risk**.
79
79
80#### How POS printers actually connect
80#### How POS printers actually connect
81
81
82Most consumer thermal printers expose one of:
82Most consumer thermal printers expose one of:
83
83
841. **Virtual COM port (USB-serial)** — very common; appears as `COM3` (Windows) or `/dev/ttyUSB0` / `/dev/ttyACM0` (Linux). Raw ESC/POS bytes are written to the serial port. **Easiest path.**
841. **Virtual COM port (USB-serial)** — very common; appears as `COM3` (Windows) or `/dev/ttyUSB0` / `/dev/ttyACM0` (Linux). Raw ESC/POS bytes are written to the serial port. **Easiest path.**
85
85
862. **USB printer class (interface 7)** — bulk transfers; **not implemented**. Would need `nusb` or Windows `usbprint.sys`.
862. **USB printer class (interface 7)** — bulk transfers; **not implemented**. Would need `nusb` or Windows `usbprint.sys`.
87
87
883. **Bluetooth Classic SPP** — **not implemented**; deferred.
883. **Bluetooth Classic SPP** — **not implemented**; deferred.
89
89
904. **Network (TCP 9100)** — common in production but **out of scope** unless added later.
904. **Network (TCP 9100)** — common in production but **out of scope** unless added later.
91
91
92“No drivers” in practice means **no Windows print spooler / CUPS job** — the app opens the device directly and writes bytes. USB-serial devices often need only the generic CDC driver already present. USB-printer-class devices on Windows may still use `usbprint.sys`, which is a kernel driver but not a vendor-specific print driver.
92“No drivers” in practice means **no Windows print spooler / CUPS job** — the app opens the device directly and writes bytes. USB-serial devices often need only the generic CDC driver already present. USB-printer-class devices on Windows may still use `usbprint.sys`, which is a kernel driver but not a vendor-specific print driver.
93
93
94#### Compatibility reality
94#### Compatibility reality
95
95
96- **MVP (done):** Epson-compatible ESC/POS over USB-serial at 9600 baud.
96- **MVP (done):** Epson-compatible ESC/POS over USB-serial at 9600 baud.
97- **Future:** USB printer class, Bluetooth SPP.
97- **Future:** USB printer class, Bluetooth SPP.
98
98
99Expect **per-printer testing**; some devices need init sequences, code pages, or cut commands that differ slightly.
99Expect **per-printer testing**; some devices need init sequences, code pages, or cut commands that differ slightly.
100
100
101---
101---
102
102
103## Complexity by subsystem
103## Complexity by subsystem
104
104
105```
105```
106 Effort (relative)
106 Effort (relative)
107Editor UI ████████░░ Medium
107Editor UI ████████░░ Medium
108Preview renderer ███████░░░ Medium
108Preview renderer ███████░░░ Medium
109DSL parser ██████░░░░ Medium
109DSL parser ██████░░░░ Medium
110File I/O ██░░░░░░░░ Low
110File I/O ██░░░░░░░░ Low
111Parameters ███░░░░░░░ Low
111Parameters ███░░░░░░░ Low
112Barcode/QR/image █████░░░░░ Low–medium
112Barcode/QR/image █████░░░░░ Low–medium
113Printer discovery ███████░░░ Medium
113Printer discovery ███████░░░ Medium
114Raw print I/O █████████░ High
114Raw print I/O █████████░ High
115Integration/polish ██████░░░░ Medium
115Integration/polish ██████░░░░ Medium
116```
116```
117
117
118---
118---
119
119
120## Effort estimate (one experienced developer)
120## Effort estimate (one experienced developer)
121
121
122| Phase | Scope | Duration |
122| Phase | Scope | Duration |
123|-------|-------|----------|
123|-------|-------|----------|
124| **0 — Design** | Specs, DSL, file format | 1 week |
124| **0 — Design** | Specs, DSL, file format | 1 week |
125| **1 — Core** | Parser, ESC/POS builder, preview, `.pos` I/O | 2–3 weeks |
125| **1 — Core** | Parser, ESC/POS builder, preview, `.pos` I/O | 2–3 weeks |
126| **2 — UI** | Editor, preview split, settings, parameters dialog | 2 weeks |
126| **2 — UI** | Editor, preview split, settings, parameters dialog | 2 weeks |
127| **3 — Print MVP** | USB-serial enumeration + print | 1–2 weeks |
127| **3 — Print MVP** | USB-serial enumeration + print | 1–2 weeks |
128| **4 — Hardening** | USB class, BT, edge cases, packaging | 2–4 weeks |
128| **4 — Hardening** | USB class, BT, edge cases, packaging | 2–4 weeks |
129
129
130**MVP (serial USB only):** ~6–8 weeks
130**MVP (serial USB only):** ~6–8 weeks
131**Full v1 (USB + BT, packaged):** ~10–14 weeks
131**Full v1 (USB + BT, packaged):** ~10–14 weeks
132
132
133Add 30–50% if the developer is new to Rust or ESC/POS.
133Add 30–50% if the developer is new to Rust or ESC/POS.
134
134
135---
135---
136
136
137## Risks and mitigations
137## Risks and mitigations
138
138
139| Risk | Impact | Mitigation |
139| Risk | Impact | Mitigation |
140|------|--------|------------|
140|------|--------|------------|
141| Printer hardware diversity | Prints garbled or not at all | ESC/POS subset doc; test matrix; user-selectable code page |
141| Printer hardware diversity | Prints garbled or not at all | ESC/POS subset doc; test matrix; user-selectable code page |
142| Linux permissions (`dialout`) | Cannot open serial port | Document group membership; clear error UI |
142| Linux permissions (`dialout`) | Cannot open serial port | Document group membership; clear error UI |
143| Windows USB access | Admin / driver conflicts | Prefer serial-first; use `usbprint` where applicable |
143| Windows USB access | Admin / driver conflicts | Prefer serial-first; use `usbprint` where applicable |
144| Bluetooth pairing UX | Users cannot find printer | Defer BT; link to OS pairing instructions |
144| Bluetooth pairing UX | Users cannot find printer | Defer BT; link to OS pairing instructions |
145| Preview ≠ print | User confusion | Label preview as approximate; same backend for print |
145| Preview ≠ print | User confusion | Label preview as approximate; same backend for print |
146| Image size on narrow paper | Slow print or clipped | Auto-scale to page width; warn in UI |
146| Image size on narrow paper | Slow print or clipped | Auto-scale to page width; warn in UI |
147
147
148---
148---
149
149
150## Out of scope (current release)
150## Out of scope (current release)
151
151
152- Bluetooth printing
152- Bluetooth printing
153- USB printer class (non-serial)
153- USB printer class (non-serial)
154- Network printers (TCP 9100)
154- Network printers (TCP 9100)
155- Non-ESC/POS protocols (Star Line, ZPL)
155- Non-ESC/POS protocols (Star Line, ZPL)
156- Multi-column layout engines
156- Multi-column layout engines
157- Collaborative editing / cloud sync
157- Collaborative editing / cloud sync
158- macOS (feasible later with same stack)
158- macOS (feasible later with same stack)
159
159
160---
160---
161
161
162## Recommendation
162## Recommendation
163
163
164**MVP delivered.** Next increments: USB printer class, baud settings, persisted parameters, hardware test matrix. Bluetooth only if explicitly needed.
164**MVP delivered.** Next increments: USB printer class, baud settings, persisted parameters, hardware test matrix. Bluetooth only if explicitly needed.
165
165
166See [LANGUAGE-CHOICE.md](LANGUAGE-CHOICE.md) and [ARCHITECTURE.md](ARCHITECTURE.md).
166See [LANGUAGE-CHOICE.md](LANGUAGE-CHOICE.md) and [ARCHITECTURE.md](ARCHITECTURE.md).
docs/FILE-FORMAT.md +128 −128
@@ -1,128 +1,128 @@
1 # `.pos` file format
2
3 A `.pos` file stores a POS print template: metadata (page settings, title) plus the DSL document body as plain text.
4
5 **Format:** JSON envelope with a `.pos` extension (human-readable, git-friendly).
6 **MIME type (suggested):** `application/vnd.posprint+json`
7
8 ---
9
10 ## Top-level schema
11
12 ```json
13 {
14 "version": 1,
15 "metadata": { ... },
16 "body": "..."
17 }
18 ```
19
20 | Field | Type | Required | Description |
21 |-------|------|----------|-------------|
22 | `version` | `number` | yes | File format version (currently `1`) |
23 | `metadata` | `object` | yes | Document settings |
24 | `body` | `string` | yes | DSL source (UTF-8, `\n` line endings normalized on load) |
25
26 ---
27
28 ## Metadata schema (version 1)
29
30 ```json
31 {
32 "title": "Sales Receipt",
33 "page_width_mm": 80,
34 "chars_per_line": 48,
35 "codepage": "CP437"
36 }
37 ```
38
39 | Field | Type | Default | Description |
40 |-------|------|---------|-------------|
41 | `title` | `string?` | `null` | Display name in app title / recent files |
42 | `page_width_mm` | `number` | `80` | Physical paper width: `58` or `80` (others allowed) |
43 | `preview_mode` | `"autoscale"` \| `"fixed"` | `"autoscale"` | How preview panel sizes content |
44 | `chars_per_line` | `number?` | derived | Override character width for preview; derived from mm if omitted |
45 | `codepage` | `string?` | `"CP437"` | Character encoding for ESC/POS text |
46
47 ### Page width derivation
48
49 | `page_width_mm` | Typical dots (203 DPI) | Default `chars_per_line` (Font A) |
50 |-----------------|------------------------|-----------------------------------|
51 | 58 | 384 | 32 |
52 | 80 | 576 | 48 |
53
54 ---
55
56 ## Example file
57
58 **`receipt.pos`:**
59
60 ```json
61 {
62 "version": 1,
63 "metadata": {
64 "title": "Standard Receipt",
65 "page_width_mm": 80,
66 "codepage": "CP437"
67 },
68 "body": "# ${StoreName}\n:center:\n\nReceipt: ${DocumentNumber}\n\n---\n\n:right:\n**TOTAL: ${GrandTotal}**\n\n@barcode CODE128 ${DocumentNumber}\n@feed 4\n@cut\n"
69 }
70 ```
71
72 For readability, the app may save `body` with literal newlines (pretty-printed JSON) when the user chooses “formatted save”; both pretty and escaped forms are valid.
73
74 ---
75
76 ## Asset resolution
77
78 - Paths in `@image` directives are resolved relative to the **directory containing the `.pos` file** unless absolute.
79 - Bundled assets: optional `assets/` subfolder next to the template.
80 - Parameterized image paths (`${LogoPath}`) resolve after substitution; relative paths still anchor to the `.pos` file directory.
81
82 ---
83
84 ## Version migration
85
86 | From | To | Migration |
87 |------|-----|-----------|
88 | — | 1 | Initial release |
89
90 On load, if `version` is newer than app supports → error with upgrade message.
91 If older → run migration chain (none yet).
92
93 ---
94
95 ## Validation rules
96
97 On save:
98
99 - `version` must equal supported version
100 - `page_width_mm` > 0
101 - `body` must be valid UTF-8
102
103 On load:
104
105 - Parse JSON; validate schema
106 - Parse `body` with DSL parser; warnings shown in UI but file still loads
107
108 ---
109
110 ## TypeScript / Rust types (reference)
111
112 ```typescript
113 interface PosFile {
114 version: number;
115 metadata: PosMetadata;
116 body: string;
117 }
118
119 interface PosMetadata {
120 title?: string;
121 page_width_mm: number;
122 preview_mode: "autoscale" | "fixed";
123 chars_per_line?: number;
124 codepage?: string;
125 }
126 ```
127
128 Rust types use `serde` derive in `src/io/mod.rs` and are used directly by the egui app (no IPC layer).
1 # `.pos` file format
2
3 A `.pos` file stores a POS print template: metadata (page settings, title) plus the DSL document body as plain text.
4
5 **Format:** JSON envelope with a `.pos` extension (human-readable, git-friendly).
6 **MIME type (suggested):** `application/vnd.posprint+json`
7
8 ---
9
10 ## Top-level schema
11
12 ```json
13 {
14 "version": 1,
15 "metadata": { ... },
16 "body": "..."
17 }
18 ```
19
20 | Field | Type | Required | Description |
21 |-------|------|----------|-------------|
22 | `version` | `number` | yes | File format version (currently `1`) |
23 | `metadata` | `object` | yes | Document settings |
24 | `body` | `string` | yes | DSL source (UTF-8, `\n` line endings normalized on load) |
25
26 ---
27
28 ## Metadata schema (version 1)
29
30 ```json
31 {
32 "title": "Sales Receipt",
33 "page_width_mm": 80,
34 "chars_per_line": 48,
35 "codepage": "CP437"
36 }
37 ```
38
39 | Field | Type | Default | Description |
40 |-------|------|---------|-------------|
41 | `title` | `string?` | `null` | Display name in app title / recent files |
42 | `page_width_mm` | `number` | `80` | Physical paper width: `58` or `80` (others allowed) |
43 | `preview_mode` | `"autoscale"` \| `"fixed"` | `"autoscale"` | How preview panel sizes content |
44 | `chars_per_line` | `number?` | derived | Override character width for preview; derived from mm if omitted |
45 | `codepage` | `string?` | `"CP437"` | Character encoding for ESC/POS text |
46
47 ### Page width derivation
48
49 | `page_width_mm` | Typical dots (203 DPI) | Default `chars_per_line` (Font A) |
50 |-----------------|------------------------|-----------------------------------|
51 | 58 | 384 | 32 |
52 | 80 | 576 | 48 |
53
54 ---
55
56 ## Example file
57
58 **`receipt.pos`:**
59
60 ```json
61 {
62 "version": 1,
63 "metadata": {
64 "title": "Standard Receipt",
65 "page_width_mm": 80,
66 "codepage": "CP437"
67 },
68 "body": "# ${StoreName}\n:center:\n\nReceipt: ${DocumentNumber}\n\n---\n\n:right:\n**TOTAL: ${GrandTotal}**\n\n@barcode CODE128 ${DocumentNumber}\n@feed 4\n@cut\n"
69 }
70 ```
71
72 For readability, the app may save `body` with literal newlines (pretty-printed JSON) when the user chooses “formatted save”; both pretty and escaped forms are valid.
73
74 ---
75
76 ## Asset resolution
77
78 - Paths in `@image` directives are resolved relative to the **directory containing the `.pos` file** unless absolute.
79 - Bundled assets: optional `assets/` subfolder next to the template.
80 - Parameterized image paths (`${LogoPath}`) resolve after substitution; relative paths still anchor to the `.pos` file directory.
81
82 ---
83
84 ## Version migration
85
86 | From | To | Migration |
87 |------|-----|-----------|
88 | — | 1 | Initial release |
89
90 On load, if `version` is newer than app supports → error with upgrade message.
91 If older → run migration chain (none yet).
92
93 ---
94
95 ## Validation rules
96
97 On save:
98
99 - `version` must equal supported version
100 - `page_width_mm` > 0
101 - `body` must be valid UTF-8
102
103 On load:
104
105 - Parse JSON; validate schema
106 - Parse `body` with DSL parser; warnings shown in UI but file still loads
107
108 ---
109
110 ## TypeScript / Rust types (reference)
111
112 ```typescript
113 interface PosFile {
114 version: number;
115 metadata: PosMetadata;
116 body: string;
117 }
118
119 interface PosMetadata {
120 title?: string;
121 page_width_mm: number;
122 preview_mode: "autoscale" | "fixed";
123 chars_per_line?: number;
124 codepage?: string;
125 }
126 ```
127
128 Rust types use `serde` derive in `src/io/mod.rs` and are used directly by the egui app (no IPC layer).
@@ -1,128 +1,128 @@
1# `.pos` file format
1# `.pos` file format
2
2
3A `.pos` file stores a POS print template: metadata (page settings, title) plus the DSL document body as plain text.
3A `.pos` file stores a POS print template: metadata (page settings, title) plus the DSL document body as plain text.
4
4
5**Format:** JSON envelope with a `.pos` extension (human-readable, git-friendly).
5**Format:** JSON envelope with a `.pos` extension (human-readable, git-friendly).
6**MIME type (suggested):** `application/vnd.posprint+json`
6**MIME type (suggested):** `application/vnd.posprint+json`
7
7
8---
8---
9
9
10## Top-level schema
10## Top-level schema
11
11
12```json
12```json
13{
13{
14 "version": 1,
14 "version": 1,
15 "metadata": { ... },
15 "metadata": { ... },
16 "body": "..."
16 "body": "..."
17}
17}
18```
18```
19
19
20| Field | Type | Required | Description |
20| Field | Type | Required | Description |
21|-------|------|----------|-------------|
21|-------|------|----------|-------------|
22| `version` | `number` | yes | File format version (currently `1`) |
22| `version` | `number` | yes | File format version (currently `1`) |
23| `metadata` | `object` | yes | Document settings |
23| `metadata` | `object` | yes | Document settings |
24| `body` | `string` | yes | DSL source (UTF-8, `\n` line endings normalized on load) |
24| `body` | `string` | yes | DSL source (UTF-8, `\n` line endings normalized on load) |
25
25
26---
26---
27
27
28## Metadata schema (version 1)
28## Metadata schema (version 1)
29
29
30```json
30```json
31{
31{
32 "title": "Sales Receipt",
32 "title": "Sales Receipt",
33 "page_width_mm": 80,
33 "page_width_mm": 80,
34 "chars_per_line": 48,
34 "chars_per_line": 48,
35 "codepage": "CP437"
35 "codepage": "CP437"
36}
36}
37```
37```
38
38
39| Field | Type | Default | Description |
39| Field | Type | Default | Description |
40|-------|------|---------|-------------|
40|-------|------|---------|-------------|
41| `title` | `string?` | `null` | Display name in app title / recent files |
41| `title` | `string?` | `null` | Display name in app title / recent files |
42| `page_width_mm` | `number` | `80` | Physical paper width: `58` or `80` (others allowed) |
42| `page_width_mm` | `number` | `80` | Physical paper width: `58` or `80` (others allowed) |
43| `preview_mode` | `"autoscale"` \| `"fixed"` | `"autoscale"` | How preview panel sizes content |
43| `preview_mode` | `"autoscale"` \| `"fixed"` | `"autoscale"` | How preview panel sizes content |
44| `chars_per_line` | `number?` | derived | Override character width for preview; derived from mm if omitted |
44| `chars_per_line` | `number?` | derived | Override character width for preview; derived from mm if omitted |
45| `codepage` | `string?` | `"CP437"` | Character encoding for ESC/POS text |
45| `codepage` | `string?` | `"CP437"` | Character encoding for ESC/POS text |
46
46
47### Page width derivation
47### Page width derivation
48
48
49| `page_width_mm` | Typical dots (203 DPI) | Default `chars_per_line` (Font A) |
49| `page_width_mm` | Typical dots (203 DPI) | Default `chars_per_line` (Font A) |
50|-----------------|------------------------|-----------------------------------|
50|-----------------|------------------------|-----------------------------------|
51| 58 | 384 | 32 |
51| 58 | 384 | 32 |
52| 80 | 576 | 48 |
52| 80 | 576 | 48 |
53
53
54---
54---
55
55
56## Example file
56## Example file
57
57
58**`receipt.pos`:**
58**`receipt.pos`:**
59
59
60```json
60```json
61{
61{
62 "version": 1,
62 "version": 1,
63 "metadata": {
63 "metadata": {
64 "title": "Standard Receipt",
64 "title": "Standard Receipt",
65 "page_width_mm": 80,
65 "page_width_mm": 80,
66 "codepage": "CP437"
66 "codepage": "CP437"
67 },
67 },
68 "body": "# ${StoreName}\n:center:\n\nReceipt: ${DocumentNumber}\n\n---\n\n:right:\n**TOTAL: ${GrandTotal}**\n\n@barcode CODE128 ${DocumentNumber}\n@feed 4\n@cut\n"
68 "body": "# ${StoreName}\n:center:\n\nReceipt: ${DocumentNumber}\n\n---\n\n:right:\n**TOTAL: ${GrandTotal}**\n\n@barcode CODE128 ${DocumentNumber}\n@feed 4\n@cut\n"
69}
69}
70```
70```
71
71
72For readability, the app may save `body` with literal newlines (pretty-printed JSON) when the user chooses “formatted save”; both pretty and escaped forms are valid.
72For readability, the app may save `body` with literal newlines (pretty-printed JSON) when the user chooses “formatted save”; both pretty and escaped forms are valid.
73
73
74---
74---
75
75
76## Asset resolution
76## Asset resolution
77
77
78- Paths in `@image` directives are resolved relative to the **directory containing the `.pos` file** unless absolute.
78- Paths in `@image` directives are resolved relative to the **directory containing the `.pos` file** unless absolute.
79- Bundled assets: optional `assets/` subfolder next to the template.
79- Bundled assets: optional `assets/` subfolder next to the template.
80- Parameterized image paths (`${LogoPath}`) resolve after substitution; relative paths still anchor to the `.pos` file directory.
80- Parameterized image paths (`${LogoPath}`) resolve after substitution; relative paths still anchor to the `.pos` file directory.
81
81
82---
82---
83
83
84## Version migration
84## Version migration
85
85
86| From | To | Migration |
86| From | To | Migration |
87|------|-----|-----------|
87|------|-----|-----------|
88| — | 1 | Initial release |
88| — | 1 | Initial release |
89
89
90On load, if `version` is newer than app supports → error with upgrade message.
90On load, if `version` is newer than app supports → error with upgrade message.
91If older → run migration chain (none yet).
91If older → run migration chain (none yet).
92
92
93---
93---
94
94
95## Validation rules
95## Validation rules
96
96
97On save:
97On save:
98
98
99- `version` must equal supported version
99- `version` must equal supported version
100- `page_width_mm` > 0
100- `page_width_mm` > 0
101- `body` must be valid UTF-8
101- `body` must be valid UTF-8
102
102
103On load:
103On load:
104
104
105- Parse JSON; validate schema
105- Parse JSON; validate schema
106- Parse `body` with DSL parser; warnings shown in UI but file still loads
106- Parse `body` with DSL parser; warnings shown in UI but file still loads
107
107
108---
108---
109
109
110## TypeScript / Rust types (reference)
110## TypeScript / Rust types (reference)
111
111
112```typescript
112```typescript
113interface PosFile {
113interface PosFile {
114 version: number;
114 version: number;
115 metadata: PosMetadata;
115 metadata: PosMetadata;
116 body: string;
116 body: string;
117}
117}
118
118
119interface PosMetadata {
119interface PosMetadata {
120 title?: string;
120 title?: string;
121 page_width_mm: number;
121 page_width_mm: number;
122 preview_mode: "autoscale" | "fixed";
122 preview_mode: "autoscale" | "fixed";
123 chars_per_line?: number;
123 chars_per_line?: number;
124 codepage?: string;
124 codepage?: string;
125}
125}
126```
126```
127
127
128Rust types use `serde` derive in `src/io/mod.rs` and are used directly by the egui app (no IPC layer).
128Rust types use `serde` derive in `src/io/mod.rs` and are used directly by the egui app (no IPC layer).
docs/HELP-CLI-LINUX.md +68 −68
@@ -1,68 +1,68 @@
1 # Command-line printing (Linux)
2
3 Print a `.pos` template without opening the GUI.
4
5 Run `posprint cli-help` to print this section from the binary (no GUI required).
6
7 ## Syntax
8
9 ```bash
10 posprint print <file.pos> --printer <DEVICE> --set Name=Value [--set Other=Value ...]
11 ```
12
13 Short form:
14
15 ```bash
16 posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="My Shop" --set DocumentNumber=1001
17 ```
18
19 ## Rules
20
21 - **`--printer` / `-p`** (required): serial device path, e.g. `/dev/ttyUSB0`, `/dev/ttyACM0`.
22 - **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
23 - If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
24 - The GUI is not started when using the `print` subcommand.
25
26 ## Permissions
27
28 Your user must be in the **`dialout`** group:
29
30 ```bash
31 sudo usermod -aG dialout "$USER"
32 # log out and back in
33 groups
34 ```
35
36 ## Examples
37
38 ```bash
39 posprint print ~/receipts/sale.pos -p /dev/ttyUSB0 \
40 --set StoreName="Corner Cafe" \
41 --set DocumentNumber=42 \
42 --set Date=2026-07-15 \
43 --set GrandTotal=19.99
44 ```
45
46 ## Printer device
47
48 ```bash
49 ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null
50 ```
51
52 Use the device node shown when the printer is connected.
53
54 ## Exit codes
55
56 | Code | Meaning |
57 |------|---------|
58 | `0` | Printed successfully |
59 | `1` | Error (missing parameters, parse error, permission denied, etc.) |
60
61 ## Help
62
63 ```bash
64 posprint print --help
65 posprint --help
66 ```
67
68 Launch the graphical designer by running `posprint` with **no** subcommand.
1 # Command-line printing (Linux)
2
3 Print a `.pos` template without opening the GUI.
4
5 Run `posprint cli-help` to print this section from the binary (no GUI required).
6
7 ## Syntax
8
9 ```bash
10 posprint print <file.pos> --printer <DEVICE> --set Name=Value [--set Other=Value ...]
11 ```
12
13 Short form:
14
15 ```bash
16 posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="My Shop" --set DocumentNumber=1001
17 ```
18
19 ## Rules
20
21 - **`--printer` / `-p`** (required): serial device path, e.g. `/dev/ttyUSB0`, `/dev/ttyACM0`.
22 - **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
23 - If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
24 - The GUI is not started when using the `print` subcommand.
25
26 ## Permissions
27
28 Your user must be in the **`dialout`** group:
29
30 ```bash
31 sudo usermod -aG dialout "$USER"
32 # log out and back in
33 groups
34 ```
35
36 ## Examples
37
38 ```bash
39 posprint print ~/receipts/sale.pos -p /dev/ttyUSB0 \
40 --set StoreName="Corner Cafe" \
41 --set DocumentNumber=42 \
42 --set Date=2026-07-15 \
43 --set GrandTotal=19.99
44 ```
45
46 ## Printer device
47
48 ```bash
49 ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null
50 ```
51
52 Use the device node shown when the printer is connected.
53
54 ## Exit codes
55
56 | Code | Meaning |
57 |------|---------|
58 | `0` | Printed successfully |
59 | `1` | Error (missing parameters, parse error, permission denied, etc.) |
60
61 ## Help
62
63 ```bash
64 posprint print --help
65 posprint --help
66 ```
67
68 Launch the graphical designer by running `posprint` with **no** subcommand.
@@ -1,68 +1,68 @@
1# Command-line printing (Linux)
1# Command-line printing (Linux)
2
2
3Print a `.pos` template without opening the GUI.
3Print a `.pos` template without opening the GUI.
4
4
5Run `posprint cli-help` to print this section from the binary (no GUI required).
5Run `posprint cli-help` to print this section from the binary (no GUI required).
6
6
7## Syntax
7## Syntax
8
8
9```bash
9```bash
10posprint print <file.pos> --printer <DEVICE> --set Name=Value [--set Other=Value ...]
10posprint print <file.pos> --printer <DEVICE> --set Name=Value [--set Other=Value ...]
11```
11```
12
12
13Short form:
13Short form:
14
14
15```bash
15```bash
16posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="My Shop" --set DocumentNumber=1001
16posprint print receipt.pos -p /dev/ttyUSB0 --set StoreName="My Shop" --set DocumentNumber=1001
17```
17```
18
18
19## Rules
19## Rules
20
20
21- **`--printer` / `-p`** (required): serial device path, e.g. `/dev/ttyUSB0`, `/dev/ttyACM0`.
21- **`--printer` / `-p`** (required): serial device path, e.g. `/dev/ttyUSB0`, `/dev/ttyACM0`.
22- **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
22- **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
23- If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
23- If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
24- The GUI is not started when using the `print` subcommand.
24- The GUI is not started when using the `print` subcommand.
25
25
26## Permissions
26## Permissions
27
27
28Your user must be in the **`dialout`** group:
28Your user must be in the **`dialout`** group:
29
29
30```bash
30```bash
31sudo usermod -aG dialout "$USER"
31sudo usermod -aG dialout "$USER"
32# log out and back in
32# log out and back in
33groups
33groups
34```
34```
35
35
36## Examples
36## Examples
37
37
38```bash
38```bash
39posprint print ~/receipts/sale.pos -p /dev/ttyUSB0 \
39posprint print ~/receipts/sale.pos -p /dev/ttyUSB0 \
40 --set StoreName="Corner Cafe" \
40 --set StoreName="Corner Cafe" \
41 --set DocumentNumber=42 \
41 --set DocumentNumber=42 \
42 --set Date=2026-07-15 \
42 --set Date=2026-07-15 \
43 --set GrandTotal=19.99
43 --set GrandTotal=19.99
44```
44```
45
45
46## Printer device
46## Printer device
47
47
48```bash
48```bash
49ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null
49ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null
50```
50```
51
51
52Use the device node shown when the printer is connected.
52Use the device node shown when the printer is connected.
53
53
54## Exit codes
54## Exit codes
55
55
56| Code | Meaning |
56| Code | Meaning |
57|------|---------|
57|------|---------|
58| `0` | Printed successfully |
58| `0` | Printed successfully |
59| `1` | Error (missing parameters, parse error, permission denied, etc.) |
59| `1` | Error (missing parameters, parse error, permission denied, etc.) |
60
60
61## Help
61## Help
62
62
63```bash
63```bash
64posprint print --help
64posprint print --help
65posprint --help
65posprint --help
66```
66```
67
67
68Launch the graphical designer by running `posprint` with **no** subcommand.
68Launch the graphical designer by running `posprint` with **no** subcommand.
docs/HELP-CLI-WINDOWS.md +58 −58
@@ -1,58 +1,58 @@
1 # Command-line printing (Windows)
2
3 Print a `.pos` template without opening the GUI.
4
5 Run `posprint cli-help` to print this section from the binary (no GUI required).
6
7 ## Syntax
8
9 ```powershell
10 posprint print <file.pos> --printer <PORT> --set Name=Value [--set Other=Value ...]
11 ```
12
13 Short form:
14
15 ```powershell
16 posprint print receipt.pos -p COM3 --set StoreName="My Shop" --set DocumentNumber=1001
17 ```
18
19 ## Rules
20
21 - **`--printer` / `-p`** (required): USB-serial port name, e.g. `COM3`, `COM4`.
22 - **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
23 - If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
24 - The GUI is not started when using the `print` subcommand.
25
26 ## Examples
27
28 List required parameters by opening the template in the designer, or inspect the `${...}` tokens in the file body.
29
30 ```powershell
31 posprint print C:\receipts\sale.pos -p COM3 `
32 --set StoreName="Corner Cafe" `
33 --set DocumentNumber=42 `
34 --set Date=2026-07-15 `
35 --set GrandTotal=19.99
36 ```
37
38 ## Printer port
39
40 - Open **Device Manager → Ports (COM & LPT)** to find the printer COM port.
41 - Install the USB-serial driver if the device is not listed.
42 - Close other programs using the same COM port before printing.
43
44 ## Exit codes
45
46 | Code | Meaning |
47 |------|---------|
48 | `0` | Printed successfully |
49 | `1` | Error (missing parameters, parse error, port error, etc.) |
50
51 ## Help
52
53 ```powershell
54 posprint print --help
55 posprint --help
56 ```
57
58 Launch the graphical designer by running `posprint` with **no** subcommand.
1 # Command-line printing (Windows)
2
3 Print a `.pos` template without opening the GUI.
4
5 Run `posprint cli-help` to print this section from the binary (no GUI required).
6
7 ## Syntax
8
9 ```powershell
10 posprint print <file.pos> --printer <PORT> --set Name=Value [--set Other=Value ...]
11 ```
12
13 Short form:
14
15 ```powershell
16 posprint print receipt.pos -p COM3 --set StoreName="My Shop" --set DocumentNumber=1001
17 ```
18
19 ## Rules
20
21 - **`--printer` / `-p`** (required): USB-serial port name, e.g. `COM3`, `COM4`.
22 - **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
23 - If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
24 - The GUI is not started when using the `print` subcommand.
25
26 ## Examples
27
28 List required parameters by opening the template in the designer, or inspect the `${...}` tokens in the file body.
29
30 ```powershell
31 posprint print C:\receipts\sale.pos -p COM3 `
32 --set StoreName="Corner Cafe" `
33 --set DocumentNumber=42 `
34 --set Date=2026-07-15 `
35 --set GrandTotal=19.99
36 ```
37
38 ## Printer port
39
40 - Open **Device Manager → Ports (COM & LPT)** to find the printer COM port.
41 - Install the USB-serial driver if the device is not listed.
42 - Close other programs using the same COM port before printing.
43
44 ## Exit codes
45
46 | Code | Meaning |
47 |------|---------|
48 | `0` | Printed successfully |
49 | `1` | Error (missing parameters, parse error, port error, etc.) |
50
51 ## Help
52
53 ```powershell
54 posprint print --help
55 posprint --help
56 ```
57
58 Launch the graphical designer by running `posprint` with **no** subcommand.
@@ -1,58 +1,58 @@
1# Command-line printing (Windows)
1# Command-line printing (Windows)
2
2
3Print a `.pos` template without opening the GUI.
3Print a `.pos` template without opening the GUI.
4
4
5Run `posprint cli-help` to print this section from the binary (no GUI required).
5Run `posprint cli-help` to print this section from the binary (no GUI required).
6
6
7## Syntax
7## Syntax
8
8
9```powershell
9```powershell
10posprint print <file.pos> --printer <PORT> --set Name=Value [--set Other=Value ...]
10posprint print <file.pos> --printer <PORT> --set Name=Value [--set Other=Value ...]
11```
11```
12
12
13Short form:
13Short form:
14
14
15```powershell
15```powershell
16posprint print receipt.pos -p COM3 --set StoreName="My Shop" --set DocumentNumber=1001
16posprint print receipt.pos -p COM3 --set StoreName="My Shop" --set DocumentNumber=1001
17```
17```
18
18
19## Rules
19## Rules
20
20
21- **`--printer` / `-p`** (required): USB-serial port name, e.g. `COM3`, `COM4`.
21- **`--printer` / `-p`** (required): USB-serial port name, e.g. `COM3`, `COM4`.
22- **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
22- **`--set NAME=VALUE`** (required for every parameter): one flag per `${Name}` in the template.
23- If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
23- If any `${Name}` is missing or empty, the command **fails** and lists missing parameters.
24- The GUI is not started when using the `print` subcommand.
24- The GUI is not started when using the `print` subcommand.
25
25
26## Examples
26## Examples
27
27
28List required parameters by opening the template in the designer, or inspect the `${...}` tokens in the file body.
28List required parameters by opening the template in the designer, or inspect the `${...}` tokens in the file body.
29
29
30```powershell
30```powershell
31posprint print C:\receipts\sale.pos -p COM3 `
31posprint print C:\receipts\sale.pos -p COM3 `
32 --set StoreName="Corner Cafe" `
32 --set StoreName="Corner Cafe" `
33 --set DocumentNumber=42 `
33 --set DocumentNumber=42 `
34 --set Date=2026-07-15 `
34 --set Date=2026-07-15 `
35 --set GrandTotal=19.99
35 --set GrandTotal=19.99
36```
36```
37
37
38## Printer port
38## Printer port
39
39
40- Open **Device Manager → Ports (COM & LPT)** to find the printer COM port.
40- Open **Device Manager → Ports (COM & LPT)** to find the printer COM port.
41- Install the USB-serial driver if the device is not listed.
41- Install the USB-serial driver if the device is not listed.
42- Close other programs using the same COM port before printing.
42- Close other programs using the same COM port before printing.
43
43
44## Exit codes
44## Exit codes
45
45
46| Code | Meaning |
46| Code | Meaning |
47|------|---------|
47|------|---------|
48| `0` | Printed successfully |
48| `0` | Printed successfully |
49| `1` | Error (missing parameters, parse error, port error, etc.) |
49| `1` | Error (missing parameters, parse error, port error, etc.) |
50
50
51## Help
51## Help
52
52
53```powershell
53```powershell
54posprint print --help
54posprint print --help
55posprint --help
55posprint --help
56```
56```
57
57
58Launch the graphical designer by running `posprint` with **no** subcommand.
58Launch the graphical designer by running `posprint` with **no** subcommand.
docs/HELP.md +196 −196
@@ -1,196 +1,196 @@
1 # posprint Help
2
3 Built-in reference for the template editor and POS markup language.
4
5 ---
6
7 ## Application tabs
8
9 | Tab | Purpose |
10 |-----|---------|
11 | **Editor** | Write and edit template source |
12 | **Preview** | Live preview of rendered output |
13 | **Help** | This documentation |
14
15 ## Toolbar actions
16
17 | Action | Description |
18 |--------|-------------|
19 | **New** | Empty template with defaults |
20 | **Open** | Load a `.pos` file |
21 | **Save / Save As** | Write `.pos` file (metadata + body) |
22 | **Insert** | Menu to insert images, barcodes, QR codes, `@feed`, `@cut` |
23 | **Print** | Substitute parameters, pick USB printer, send ESC/POS bytes |
24
25 ## Editor assistance
26
27 - Type `@` at the start of a line to see **directive autocomplete** (`feed`, `cut`, `image`, `barcode`, `qr`).
28 - Use **Insert → Barcode / QR code** to pick native or raster type before inserting a snippet.
29
30 ## Page settings
31
32 | Setting | Description |
33 |---------|-------------|
34 | **Page width (mm)** | Paper width, typically `58` or `80` |
35
36 ---
37
38 ## Template language
39
40 A template is plain text: paragraphs, headings, directives, and inline markup.
41
42 ### Paragraphs
43
44 Consecutive non-empty lines form one paragraph.
45
46 ### Headings
47
48 ```markdown
49 # Large heading
50 ## Bold heading
51 ```
52
53 ### Alignment
54
55 `:left:`, `:center:`, or `:right:` before a paragraph.
56
57 ### Inline markup
58
59 | Syntax | Effect |
60 |--------|--------|
61 | `**text**` | Bold |
62 | `*text*` | Italic |
63 | `` `text` `` | Monospace |
64 | `${Name}` | Parameter (filled at print time) |
65
66 ### Horizontal rule
67
68 ```markdown
69 ---
70 ```
71
72 ### Comments
73
74 ```markdown
75 <!-- not printed -->
76 ```
77
78 ---
79
80 ## Directives
81
82 Directives start with `@` at the beginning of a line.
83
84 ### Paper feed / cut
85
86 ```markdown
87 @feed 3
88 @cut
89 ```
90
91 ### Image
92
93 ```markdown
94 @image logo.png
95 @image ${LogoPath} width=50% align=center
96 ```
97
98 ### Barcode
99
100 **Native** (printer draws barcode via ESC/POS):
101
102 ```markdown
103 @barcode CODE128 ${OrderId}
104 @barcode UPC-A 012345678905
105 @barcode ITF 12345678 height=80
106 ```
107
108 **Raster** (rendered as bitmap — works with any symbology below). Raster barcodes are stretched horizontally to the full paper width for reliable scanning; height follows the `height` attribute.
109
110 ```markdown
111 @barcode RASTER CODE128 ${OrderId}
112 @barcode RASTER CODE93 ABC-1234
113 ```
114
115 | Native symbology | Notes |
116 |----------------|-------|
117 | `CODE128` | Alphanumeric |
118 | `EAN13`, `EAN8` | Numeric |
119 | `CODE39` | Alphanumeric |
120 | `UPC-A`, `UPC-E` | Numeric |
121 | `ITF` | Interleaved 2 of 5; even digit count |
122 | `CODABAR` | Numeric + A-D start/stop |
123
124 | Raster-only symbology | Use `RASTER` prefix |
125 |-----------------------|---------------------|
126 | `CODE93`, `CODE11` | No native ESC/POS in firmware |
127
128 | Attribute | Description |
129 |-----------|-------------|
130 | `height` | Height in dots (default `64`; raster PNG height) |
131 | `align` | `left`, `center`, `right` |
132 | `show_text` | Native only: human-readable text under barcode |
133
134 ### QR code
135
136 **Native** (ESC/POS QR, model 2):
137
138 ```markdown
139 @qr https://example.com/${Id}
140 @qr ${Url} size=6 ecc=H align=center
141 ```
142
143 **Raster** (bitmap; supports QR versions 1–40):
144
145 ```markdown
146 @qr RASTER https://example.com/${Id}
147 @qr RASTER ${Url} version=5 scale=4 ecc=M
148 ```
149
150 | Attribute | Native | Raster |
151 |-----------|--------|--------|
152 | `size` | Module dot size 1–16 | — |
153 | `scale` | — | Pixels per module (default `4`) |
154 | `version` | — | QR version 1–40 (optional; auto if omitted) |
155 | `ecc` | `L`, `M`, `Q`, `H` | Same |
156 | `align` | `left`, `center`, `right` | Same |
157
158 ---
159
160 ## Parameters
161
162 `${ParameterName}` in text, barcode data, QR data, or image paths.
163
164 - Same name → **one input** at print time (GUI or CLI).
165 - CLI requires **every** parameter via `--set Name=Value`.
166
167 ---
168
169 ## Example receipt
170
171 ```markdown
172 # ${StoreName}
173 :center:
174
175 Receipt: ${DocumentNumber}
176
177 @barcode CODE128 ${DocumentNumber}
178 @qr RASTER https://shop.example.com/r/${DocumentNumber} scale=4
179
180 @feed 4
181 @cut
182 ```
183
184 ---
185
186 ## GUI printing (USB)
187
188 1. **Print** → enter parameters → choose serial port → **Print**.
189
190 **Linux:** `dialout` group. **Windows:** printer appears as `COMx`.
191
192 ---
193
194 ## `.pos` file format
195
196 JSON with `version`, `metadata`, and `body` (template source).
1 # posprint Help
2
3 Built-in reference for the template editor and POS markup language.
4
5 ---
6
7 ## Application tabs
8
9 | Tab | Purpose |
10 |-----|---------|
11 | **Editor** | Write and edit template source |
12 | **Preview** | Live preview of rendered output |
13 | **Help** | This documentation |
14
15 ## Toolbar actions
16
17 | Action | Description |
18 |--------|-------------|
19 | **New** | Empty template with defaults |
20 | **Open** | Load a `.pos` file |
21 | **Save / Save As** | Write `.pos` file (metadata + body) |
22 | **Insert** | Menu to insert images, barcodes, QR codes, `@feed`, `@cut` |
23 | **Print** | Substitute parameters, pick USB printer, send ESC/POS bytes |
24
25 ## Editor assistance
26
27 - Type `@` at the start of a line to see **directive autocomplete** (`feed`, `cut`, `image`, `barcode`, `qr`).
28 - Use **Insert → Barcode / QR code** to pick native or raster type before inserting a snippet.
29
30 ## Page settings
31
32 | Setting | Description |
33 |---------|-------------|
34 | **Page width (mm)** | Paper width, typically `58` or `80` |
35
36 ---
37
38 ## Template language
39
40 A template is plain text: paragraphs, headings, directives, and inline markup.
41
42 ### Paragraphs
43
44 Consecutive non-empty lines form one paragraph.
45
46 ### Headings
47
48 ```markdown
49 # Large heading
50 ## Bold heading
51 ```
52
53 ### Alignment
54
55 `:left:`, `:center:`, or `:right:` before a paragraph.
56
57 ### Inline markup
58
59 | Syntax | Effect |
60 |--------|--------|
61 | `**text**` | Bold |
62 | `*text*` | Italic |
63 | `` `text` `` | Monospace |
64 | `${Name}` | Parameter (filled at print time) |
65
66 ### Horizontal rule
67
68 ```markdown
69 ---
70 ```
71
72 ### Comments
73
74 ```markdown
75 <!-- not printed -->
76 ```
77
78 ---
79
80 ## Directives
81
82 Directives start with `@` at the beginning of a line.
83
84 ### Paper feed / cut
85
86 ```markdown
87 @feed 3
88 @cut
89 ```
90
91 ### Image
92
93 ```markdown
94 @image logo.png
95 @image ${LogoPath} width=50% align=center
96 ```
97
98 ### Barcode
99
100 **Native** (printer draws barcode via ESC/POS):
101
102 ```markdown
103 @barcode CODE128 ${OrderId}
104 @barcode UPC-A 012345678905
105 @barcode ITF 12345678 height=80
106 ```
107
108 **Raster** (rendered as bitmap — works with any symbology below). Raster barcodes are stretched horizontally to the full paper width for reliable scanning; height follows the `height` attribute.
109
110 ```markdown
111 @barcode RASTER CODE128 ${OrderId}
112 @barcode RASTER CODE93 ABC-1234
113 ```
114
115 | Native symbology | Notes |
116 |----------------|-------|
117 | `CODE128` | Alphanumeric |
118 | `EAN13`, `EAN8` | Numeric |
119 | `CODE39` | Alphanumeric |
120 | `UPC-A`, `UPC-E` | Numeric |
121 | `ITF` | Interleaved 2 of 5; even digit count |
122 | `CODABAR` | Numeric + A-D start/stop |
123
124 | Raster-only symbology | Use `RASTER` prefix |
125 |-----------------------|---------------------|
126 | `CODE93`, `CODE11` | No native ESC/POS in firmware |
127
128 | Attribute | Description |
129 |-----------|-------------|
130 | `height` | Height in dots (default `64`; raster PNG height) |
131 | `align` | `left`, `center`, `right` |
132 | `show_text` | Native only: human-readable text under barcode |
133
134 ### QR code
135
136 **Native** (ESC/POS QR, model 2):
137
138 ```markdown
139 @qr https://example.com/${Id}
140 @qr ${Url} size=6 ecc=H align=center
141 ```
142
143 **Raster** (bitmap; supports QR versions 1–40):
144
145 ```markdown
146 @qr RASTER https://example.com/${Id}
147 @qr RASTER ${Url} version=5 scale=4 ecc=M
148 ```
149
150 | Attribute | Native | Raster |
151 |-----------|--------|--------|
152 | `size` | Module dot size 1–16 | — |
153 | `scale` | — | Pixels per module (default `4`) |
154 | `version` | — | QR version 1–40 (optional; auto if omitted) |
155 | `ecc` | `L`, `M`, `Q`, `H` | Same |
156 | `align` | `left`, `center`, `right` | Same |
157
158 ---
159
160 ## Parameters
161
162 `${ParameterName}` in text, barcode data, QR data, or image paths.
163
164 - Same name → **one input** at print time (GUI or CLI).
165 - CLI requires **every** parameter via `--set Name=Value`.
166
167 ---
168
169 ## Example receipt
170
171 ```markdown
172 # ${StoreName}
173 :center:
174
175 Receipt: ${DocumentNumber}
176
177 @barcode CODE128 ${DocumentNumber}
178 @qr RASTER https://shop.example.com/r/${DocumentNumber} scale=4
179
180 @feed 4
181 @cut
182 ```
183
184 ---
185
186 ## GUI printing (USB)
187
188 1. **Print** → enter parameters → choose serial port → **Print**.
189
190 **Linux:** `dialout` group. **Windows:** printer appears as `COMx`.
191
192 ---
193
194 ## `.pos` file format
195
196 JSON with `version`, `metadata`, and `body` (template source).
@@ -1,196 +1,196 @@
1# posprint Help
1# posprint Help
2
2
3Built-in reference for the template editor and POS markup language.
3Built-in reference for the template editor and POS markup language.
4
4
5---
5---
6
6
7## Application tabs
7## Application tabs
8
8
9| Tab | Purpose |
9| Tab | Purpose |
10|-----|---------|
10|-----|---------|
11| **Editor** | Write and edit template source |
11| **Editor** | Write and edit template source |
12| **Preview** | Live preview of rendered output |
12| **Preview** | Live preview of rendered output |
13| **Help** | This documentation |
13| **Help** | This documentation |
14
14
15## Toolbar actions
15## Toolbar actions
16
16
17| Action | Description |
17| Action | Description |
18|--------|-------------|
18|--------|-------------|
19| **New** | Empty template with defaults |
19| **New** | Empty template with defaults |
20| **Open** | Load a `.pos` file |
20| **Open** | Load a `.pos` file |
21| **Save / Save As** | Write `.pos` file (metadata + body) |
21| **Save / Save As** | Write `.pos` file (metadata + body) |
22| **Insert** | Menu to insert images, barcodes, QR codes, `@feed`, `@cut` |
22| **Insert** | Menu to insert images, barcodes, QR codes, `@feed`, `@cut` |
23| **Print** | Substitute parameters, pick USB printer, send ESC/POS bytes |
23| **Print** | Substitute parameters, pick USB printer, send ESC/POS bytes |
24
24
25## Editor assistance
25## Editor assistance
26
26
27- Type `@` at the start of a line to see **directive autocomplete** (`feed`, `cut`, `image`, `barcode`, `qr`).
27- Type `@` at the start of a line to see **directive autocomplete** (`feed`, `cut`, `image`, `barcode`, `qr`).
28- Use **Insert → Barcode / QR code** to pick native or raster type before inserting a snippet.
28- Use **Insert → Barcode / QR code** to pick native or raster type before inserting a snippet.
29
29
30## Page settings
30## Page settings
31
31
32| Setting | Description |
32| Setting | Description |
33|---------|-------------|
33|---------|-------------|
34| **Page width (mm)** | Paper width, typically `58` or `80` |
34| **Page width (mm)** | Paper width, typically `58` or `80` |
35
35
36---
36---
37
37
38## Template language
38## Template language
39
39
40A template is plain text: paragraphs, headings, directives, and inline markup.
40A template is plain text: paragraphs, headings, directives, and inline markup.
41
41
42### Paragraphs
42### Paragraphs
43
43
44Consecutive non-empty lines form one paragraph.
44Consecutive non-empty lines form one paragraph.
45
45
46### Headings
46### Headings
47
47
48```markdown
48```markdown
49# Large heading
49# Large heading
50## Bold heading
50## Bold heading
51```
51```
52
52
53### Alignment
53### Alignment
54
54
55`:left:`, `:center:`, or `:right:` before a paragraph.
55`:left:`, `:center:`, or `:right:` before a paragraph.
56
56
57### Inline markup
57### Inline markup
58
58
59| Syntax | Effect |
59| Syntax | Effect |
60|--------|--------|
60|--------|--------|
61| `**text**` | Bold |
61| `**text**` | Bold |
62| `*text*` | Italic |
62| `*text*` | Italic |
63| `` `text` `` | Monospace |
63| `` `text` `` | Monospace |
64| `${Name}` | Parameter (filled at print time) |
64| `${Name}` | Parameter (filled at print time) |
65
65
66### Horizontal rule
66### Horizontal rule
67
67
68```markdown
68```markdown
69---
69---
70```
70```
71
71
72### Comments
72### Comments
73
73
74```markdown
74```markdown
75<!-- not printed -->
75<!-- not printed -->
76```
76```
77
77
78---
78---
79
79
80## Directives
80## Directives
81
81
82Directives start with `@` at the beginning of a line.
82Directives start with `@` at the beginning of a line.
83
83
84### Paper feed / cut
84### Paper feed / cut
85
85
86```markdown
86```markdown
87@feed 3
87@feed 3
88@cut
88@cut
89```
89```
90
90
91### Image
91### Image
92
92
93```markdown
93```markdown
94@image logo.png
94@image logo.png
95@image ${LogoPath} width=50% align=center
95@image ${LogoPath} width=50% align=center
96```
96```
97
97
98### Barcode
98### Barcode
99
99
100**Native** (printer draws barcode via ESC/POS):
100**Native** (printer draws barcode via ESC/POS):
101
101
102```markdown
102```markdown
103@barcode CODE128 ${OrderId}
103@barcode CODE128 ${OrderId}
104@barcode UPC-A 012345678905
104@barcode UPC-A 012345678905
105@barcode ITF 12345678 height=80
105@barcode ITF 12345678 height=80
106```
106```
107
107
108**Raster** (rendered as bitmap — works with any symbology below). Raster barcodes are stretched horizontally to the full paper width for reliable scanning; height follows the `height` attribute.
108**Raster** (rendered as bitmap — works with any symbology below). Raster barcodes are stretched horizontally to the full paper width for reliable scanning; height follows the `height` attribute.
109
109
110```markdown
110```markdown
111@barcode RASTER CODE128 ${OrderId}
111@barcode RASTER CODE128 ${OrderId}
112@barcode RASTER CODE93 ABC-1234
112@barcode RASTER CODE93 ABC-1234
113```
113```
114
114
115| Native symbology | Notes |
115| Native symbology | Notes |
116|----------------|-------|
116|----------------|-------|
117| `CODE128` | Alphanumeric |
117| `CODE128` | Alphanumeric |
118| `EAN13`, `EAN8` | Numeric |
118| `EAN13`, `EAN8` | Numeric |
119| `CODE39` | Alphanumeric |
119| `CODE39` | Alphanumeric |
120| `UPC-A`, `UPC-E` | Numeric |
120| `UPC-A`, `UPC-E` | Numeric |
121| `ITF` | Interleaved 2 of 5; even digit count |
121| `ITF` | Interleaved 2 of 5; even digit count |
122| `CODABAR` | Numeric + A-D start/stop |
122| `CODABAR` | Numeric + A-D start/stop |
123
123
124| Raster-only symbology | Use `RASTER` prefix |
124| Raster-only symbology | Use `RASTER` prefix |
125|-----------------------|---------------------|
125|-----------------------|---------------------|
126| `CODE93`, `CODE11` | No native ESC/POS in firmware |
126| `CODE93`, `CODE11` | No native ESC/POS in firmware |
127
127
128| Attribute | Description |
128| Attribute | Description |
129|-----------|-------------|
129|-----------|-------------|
130| `height` | Height in dots (default `64`; raster PNG height) |
130| `height` | Height in dots (default `64`; raster PNG height) |
131| `align` | `left`, `center`, `right` |
131| `align` | `left`, `center`, `right` |
132| `show_text` | Native only: human-readable text under barcode |
132| `show_text` | Native only: human-readable text under barcode |
133
133
134### QR code
134### QR code
135
135
136**Native** (ESC/POS QR, model 2):
136**Native** (ESC/POS QR, model 2):
137
137
138```markdown
138```markdown
139@qr https://example.com/${Id}
139@qr https://example.com/${Id}
140@qr ${Url} size=6 ecc=H align=center
140@qr ${Url} size=6 ecc=H align=center
141```
141```
142
142
143**Raster** (bitmap; supports QR versions 1–40):
143**Raster** (bitmap; supports QR versions 1–40):
144
144
145```markdown
145```markdown
146@qr RASTER https://example.com/${Id}
146@qr RASTER https://example.com/${Id}
147@qr RASTER ${Url} version=5 scale=4 ecc=M
147@qr RASTER ${Url} version=5 scale=4 ecc=M
148```
148```
149
149
150| Attribute | Native | Raster |
150| Attribute | Native | Raster |
151|-----------|--------|--------|
151|-----------|--------|--------|
152| `size` | Module dot size 1–16 | — |
152| `size` | Module dot size 1–16 | — |
153| `scale` | — | Pixels per module (default `4`) |
153| `scale` | — | Pixels per module (default `4`) |
154| `version` | — | QR version 1–40 (optional; auto if omitted) |
154| `version` | — | QR version 1–40 (optional; auto if omitted) |
155| `ecc` | `L`, `M`, `Q`, `H` | Same |
155| `ecc` | `L`, `M`, `Q`, `H` | Same |
156| `align` | `left`, `center`, `right` | Same |
156| `align` | `left`, `center`, `right` | Same |
157
157
158---
158---
159
159
160## Parameters
160## Parameters
161
161
162`${ParameterName}` in text, barcode data, QR data, or image paths.
162`${ParameterName}` in text, barcode data, QR data, or image paths.
163
163
164- Same name → **one input** at print time (GUI or CLI).
164- Same name → **one input** at print time (GUI or CLI).
165- CLI requires **every** parameter via `--set Name=Value`.
165- CLI requires **every** parameter via `--set Name=Value`.
166
166
167---
167---
168
168
169## Example receipt
169## Example receipt
170
170
171```markdown
171```markdown
172# ${StoreName}
172# ${StoreName}
173:center:
173:center:
174
174
175Receipt: ${DocumentNumber}
175Receipt: ${DocumentNumber}
176
176
177@barcode CODE128 ${DocumentNumber}
177@barcode CODE128 ${DocumentNumber}
178@qr RASTER https://shop.example.com/r/${DocumentNumber} scale=4
178@qr RASTER https://shop.example.com/r/${DocumentNumber} scale=4
179
179
180@feed 4
180@feed 4
181@cut
181@cut
182```
182```
183
183
184---
184---
185
185
186## GUI printing (USB)
186## GUI printing (USB)
187
187
1881. **Print** → enter parameters → choose serial port → **Print**.
1881. **Print** → enter parameters → choose serial port → **Print**.
189
189
190**Linux:** `dialout` group. **Windows:** printer appears as `COMx`.
190**Linux:** `dialout` group. **Windows:** printer appears as `COMx`.
191
191
192---
192---
193
193
194## `.pos` file format
194## `.pos` file format
195
195
196JSON with `version`, `metadata`, and `body` (template source).
196JSON with `version`, `metadata`, and `body` (template source).
docs/LANGUAGE-CHOICE.md +83 −83
@@ -1,83 +1,83 @@
1 # Language and platform choice
2
3 ## Decision (implemented)
4
5 | Decision | Choice |
6 |----------|--------|
7 | Language | **Rust** (single codebase) |
8 | UI | **egui** via **eframe** |
9 | Print protocol | **ESC/POS** (in-tree encoder) |
10 | MVP transport | **USB-serial** via `serialport` |
11 | Packaging | GitLab CI → Linux `.deb`, Windows `.exe` |
12
13 **Rationale:** One language, small dependency surface, direct control over ESC/POS bytes, native cross-platform UI without a WebView.
14
15 ---
16
17 ## Requirements
18
19 | Requirement | How it is met |
20 |-------------|---------------|
21 | Windows + Linux | Rust + egui + GitLab CI |
22 | Raw USB-serial print (no spooler) | `serialport` crate, 9600 baud |
23 | ESC/POS generation | `src/escpos.rs` (no external ESC/POS crate) |
24 | Live preview | `src/preview.rs` + egui canvas in `app.rs` |
25 | Small distributable | No Chromium/Node; release build uses LTO + strip |
26 | Unit tests | Every module has `#[cfg(test)]` tests |
27
28 ---
29
30 ## Dependencies in use
31
32 | Crate | Role | Why not hand-roll? |
33 |-------|------|-------------------|
34 | `eframe` / `egui` | UI framework | Building a GUI toolkit is out of scope |
35 | `serde` / `serde_json` | `.pos` files | Error-prone to parse/emit JSON manually |
36 | `serialport` | Cross-platform COM/tty access | OS-specific serial APIs differ |
37 | `image` | PNG/JPEG/GIF/BMP decode | Many formats and decoders |
38 | `rfd` | Native file dialogs | OS-native UX expected |
39
40 **Not used (by design):** `escpos`, `nusb`, `rusb`, `tauri`, TypeScript frontend.
41
42 ---
43
44 ## Candidates considered (historical)
45
46 | Option | Verdict |
47 |--------|---------|
48 | Rust + Tauri 2 + TypeScript | Rejected — two languages, WebView dependency |
49 | Rust + egui | **Selected** |
50 | C# + Avalonia | Viable but weaker serial/ESC/POS ecosystem |
51 | Go + Fyne | Weaker hardware I/O ecosystem |
52 | Python + PyQt | Poor packaging for desktop release |
53 | Electron | Bundle size too large |
54 | C++ + Qt | Slower iteration for a small app |
55
56 ---
57
58 ## Platform notes
59
60 ### Windows
61
62 - Printers appear as `COMx` after USB-serial driver install.
63 - Release: `posprint.exe` from `cargo build --release`.
64 - CI requires a GitLab runner tagged `windows` + `shell`.
65
66 ### Linux
67
68 - Devices: `/dev/ttyUSB*`, `/dev/ttyACM*`, etc.
69 - User must be in the **`dialout`** group.
70 - Release: `.deb` via `cargo deb`; install with `sudo dpkg -i …`.
71 - CI uses `rust:bookworm` image with X11 dev libs for egui.
72
73 ---
74
75 ## Deferred
76
77 | Item | Notes |
78 |------|-------|
79 | USB printer class (bulk) | Would need `nusb` or Windows `usbprint` path |
80 | Bluetooth SPP | Paired devices as serial ports; add when requested |
81 | macOS | Same stack should work; not in CI yet |
82
83 This document should be updated when transport or UI choices change.
1 # Language and platform choice
2
3 ## Decision (implemented)
4
5 | Decision | Choice |
6 |----------|--------|
7 | Language | **Rust** (single codebase) |
8 | UI | **egui** via **eframe** |
9 | Print protocol | **ESC/POS** (in-tree encoder) |
10 | MVP transport | **USB-serial** via `serialport` |
11 | Packaging | GitLab CI → Linux `.deb`, Windows `.exe` |
12
13 **Rationale:** One language, small dependency surface, direct control over ESC/POS bytes, native cross-platform UI without a WebView.
14
15 ---
16
17 ## Requirements
18
19 | Requirement | How it is met |
20 |-------------|---------------|
21 | Windows + Linux | Rust + egui + GitLab CI |
22 | Raw USB-serial print (no spooler) | `serialport` crate, 9600 baud |
23 | ESC/POS generation | `src/escpos.rs` (no external ESC/POS crate) |
24 | Live preview | `src/preview.rs` + egui canvas in `app.rs` |
25 | Small distributable | No Chromium/Node; release build uses LTO + strip |
26 | Unit tests | Every module has `#[cfg(test)]` tests |
27
28 ---
29
30 ## Dependencies in use
31
32 | Crate | Role | Why not hand-roll? |
33 |-------|------|-------------------|
34 | `eframe` / `egui` | UI framework | Building a GUI toolkit is out of scope |
35 | `serde` / `serde_json` | `.pos` files | Error-prone to parse/emit JSON manually |
36 | `serialport` | Cross-platform COM/tty access | OS-specific serial APIs differ |
37 | `image` | PNG/JPEG/GIF/BMP decode | Many formats and decoders |
38 | `rfd` | Native file dialogs | OS-native UX expected |
39
40 **Not used (by design):** `escpos`, `nusb`, `rusb`, `tauri`, TypeScript frontend.
41
42 ---
43
44 ## Candidates considered (historical)
45
46 | Option | Verdict |
47 |--------|---------|
48 | Rust + Tauri 2 + TypeScript | Rejected — two languages, WebView dependency |
49 | Rust + egui | **Selected** |
50 | C# + Avalonia | Viable but weaker serial/ESC/POS ecosystem |
51 | Go + Fyne | Weaker hardware I/O ecosystem |
52 | Python + PyQt | Poor packaging for desktop release |
53 | Electron | Bundle size too large |
54 | C++ + Qt | Slower iteration for a small app |
55
56 ---
57
58 ## Platform notes
59
60 ### Windows
61
62 - Printers appear as `COMx` after USB-serial driver install.
63 - Release: `posprint.exe` from `cargo build --release`.
64 - CI requires a GitLab runner tagged `windows` + `shell`.
65
66 ### Linux
67
68 - Devices: `/dev/ttyUSB*`, `/dev/ttyACM*`, etc.
69 - User must be in the **`dialout`** group.
70 - Release: `.deb` via `cargo deb`; install with `sudo dpkg -i …`.
71 - CI uses `rust:bookworm` image with X11 dev libs for egui.
72
73 ---
74
75 ## Deferred
76
77 | Item | Notes |
78 |------|-------|
79 | USB printer class (bulk) | Would need `nusb` or Windows `usbprint` path |
80 | Bluetooth SPP | Paired devices as serial ports; add when requested |
81 | macOS | Same stack should work; not in CI yet |
82
83 This document should be updated when transport or UI choices change.
@@ -1,83 +1,83 @@
1# Language and platform choice
1# Language and platform choice
2
2
3## Decision (implemented)
3## Decision (implemented)
4
4
5| Decision | Choice |
5| Decision | Choice |
6|----------|--------|
6|----------|--------|
7| Language | **Rust** (single codebase) |
7| Language | **Rust** (single codebase) |
8| UI | **egui** via **eframe** |
8| UI | **egui** via **eframe** |
9| Print protocol | **ESC/POS** (in-tree encoder) |
9| Print protocol | **ESC/POS** (in-tree encoder) |
10| MVP transport | **USB-serial** via `serialport` |
10| MVP transport | **USB-serial** via `serialport` |
11| Packaging | GitLab CI → Linux `.deb`, Windows `.exe` |
11| Packaging | GitLab CI → Linux `.deb`, Windows `.exe` |
12
12
13**Rationale:** One language, small dependency surface, direct control over ESC/POS bytes, native cross-platform UI without a WebView.
13**Rationale:** One language, small dependency surface, direct control over ESC/POS bytes, native cross-platform UI without a WebView.
14
14
15---
15---
16
16
17## Requirements
17## Requirements
18
18
19| Requirement | How it is met |
19| Requirement | How it is met |
20|-------------|---------------|
20|-------------|---------------|
21| Windows + Linux | Rust + egui + GitLab CI |
21| Windows + Linux | Rust + egui + GitLab CI |
22| Raw USB-serial print (no spooler) | `serialport` crate, 9600 baud |
22| Raw USB-serial print (no spooler) | `serialport` crate, 9600 baud |
23| ESC/POS generation | `src/escpos.rs` (no external ESC/POS crate) |
23| ESC/POS generation | `src/escpos.rs` (no external ESC/POS crate) |
24| Live preview | `src/preview.rs` + egui canvas in `app.rs` |
24| Live preview | `src/preview.rs` + egui canvas in `app.rs` |
25| Small distributable | No Chromium/Node; release build uses LTO + strip |
25| Small distributable | No Chromium/Node; release build uses LTO + strip |
26| Unit tests | Every module has `#[cfg(test)]` tests |
26| Unit tests | Every module has `#[cfg(test)]` tests |
27
27
28---
28---
29
29
30## Dependencies in use
30## Dependencies in use
31
31
32| Crate | Role | Why not hand-roll? |
32| Crate | Role | Why not hand-roll? |
33|-------|------|-------------------|
33|-------|------|-------------------|
34| `eframe` / `egui` | UI framework | Building a GUI toolkit is out of scope |
34| `eframe` / `egui` | UI framework | Building a GUI toolkit is out of scope |
35| `serde` / `serde_json` | `.pos` files | Error-prone to parse/emit JSON manually |
35| `serde` / `serde_json` | `.pos` files | Error-prone to parse/emit JSON manually |
36| `serialport` | Cross-platform COM/tty access | OS-specific serial APIs differ |
36| `serialport` | Cross-platform COM/tty access | OS-specific serial APIs differ |
37| `image` | PNG/JPEG/GIF/BMP decode | Many formats and decoders |
37| `image` | PNG/JPEG/GIF/BMP decode | Many formats and decoders |
38| `rfd` | Native file dialogs | OS-native UX expected |
38| `rfd` | Native file dialogs | OS-native UX expected |
39
39
40**Not used (by design):** `escpos`, `nusb`, `rusb`, `tauri`, TypeScript frontend.
40**Not used (by design):** `escpos`, `nusb`, `rusb`, `tauri`, TypeScript frontend.
41
41
42---
42---
43
43
44## Candidates considered (historical)
44## Candidates considered (historical)
45
45
46| Option | Verdict |
46| Option | Verdict |
47|--------|---------|
47|--------|---------|
48| Rust + Tauri 2 + TypeScript | Rejected — two languages, WebView dependency |
48| Rust + Tauri 2 + TypeScript | Rejected — two languages, WebView dependency |
49| Rust + egui | **Selected** |
49| Rust + egui | **Selected** |
50| C# + Avalonia | Viable but weaker serial/ESC/POS ecosystem |
50| C# + Avalonia | Viable but weaker serial/ESC/POS ecosystem |
51| Go + Fyne | Weaker hardware I/O ecosystem |
51| Go + Fyne | Weaker hardware I/O ecosystem |
52| Python + PyQt | Poor packaging for desktop release |
52| Python + PyQt | Poor packaging for desktop release |
53| Electron | Bundle size too large |
53| Electron | Bundle size too large |
54| C++ + Qt | Slower iteration for a small app |
54| C++ + Qt | Slower iteration for a small app |
55
55
56---
56---
57
57
58## Platform notes
58## Platform notes
59
59
60### Windows
60### Windows
61
61
62- Printers appear as `COMx` after USB-serial driver install.
62- Printers appear as `COMx` after USB-serial driver install.
63- Release: `posprint.exe` from `cargo build --release`.
63- Release: `posprint.exe` from `cargo build --release`.
64- CI requires a GitLab runner tagged `windows` + `shell`.
64- CI requires a GitLab runner tagged `windows` + `shell`.
65
65
66### Linux
66### Linux
67
67
68- Devices: `/dev/ttyUSB*`, `/dev/ttyACM*`, etc.
68- Devices: `/dev/ttyUSB*`, `/dev/ttyACM*`, etc.
69- User must be in the **`dialout`** group.
69- User must be in the **`dialout`** group.
70- Release: `.deb` via `cargo deb`; install with `sudo dpkg -i …`.
70- Release: `.deb` via `cargo deb`; install with `sudo dpkg -i …`.
71- CI uses `rust:bookworm` image with X11 dev libs for egui.
71- CI uses `rust:bookworm` image with X11 dev libs for egui.
72
72
73---
73---
74
74
75## Deferred
75## Deferred
76
76
77| Item | Notes |
77| Item | Notes |
78|------|-------|
78|------|-------|
79| USB printer class (bulk) | Would need `nusb` or Windows `usbprint` path |
79| USB printer class (bulk) | Would need `nusb` or Windows `usbprint` path |
80| Bluetooth SPP | Paired devices as serial ports; add when requested |
80| Bluetooth SPP | Paired devices as serial ports; add when requested |
81| macOS | Same stack should work; not in CI yet |
81| macOS | Same stack should work; not in CI yet |
82
82
83This document should be updated when transport or UI choices change.
83This document should be updated when transport or UI choices change.
docs/PRINTING.md +197 −197
@@ -1,197 +1,197 @@
1 # Printing subsystem
2
3 Direct raw-byte printing to POS thermal printers over **USB-serial** — without the Windows print spooler or CUPS.
4
5 > **Implementation status (v0.1.0):** USB-serial only. In-tree ESC/POS encoder in `src/escpos.rs`. USB printer class and Bluetooth are **not** implemented.
6
7 ---
8
9 ## Goals
10
11 1. Discover serial ports (USB-serial adapters and CDC printers)
12 2. Let the user pick a port in the print dialog
13 3. Generate ESC/POS bytes from the AST (after parameter substitution)
14 4. Write bytes at **9600 baud** (fixed for now)
15
16 ---
17
18 ## Protocol: ESC/POS
19
20 Target **Epson ESC/POS** compatible printers (58 mm / 80 mm thermal).
21
22 ### Implemented commands
23
24 | Feature | ESC/POS | Source |
25 |---------|---------|--------|
26 | Initialize | ESC @ | `escpos.rs` |
27 | Code page | ESC t 0 (CP437) | Always CP437 today; metadata field reserved |
28 | Bold | ESC E | Headings level 2, `**text**` flattened at encode |
29 | Double size | GS ! | Heading level 1 |
30 | Alignment | ESC a | Paragraphs, images, barcodes, QR |
31 | Line feed | LF, ESC d | Text lines, `@feed` |
32 | Partial cut | GS V 66 0 | `@cut` in template |
33 | Barcode | GS k | CODE128, EAN13, EAN8, CODE39 |
34 | QR Code | GS ( k | Model 2 |
35 | Raster image | GS v 0 | `@image` via `image` crate → threshold |
36
37 Encoder: `EscPosEncoder` in `src/escpos.rs` — **not** the `escpos` crates.io package.
38
39 ---
40
41 ## Transport (implemented)
42
43 ```
44 Print button
45 │
46 ▼
47 substitute_document()
48 │
49 ▼
50 EscPosEncoder::encode_document()
51 │
52 ▼
53 SerialTransport::open(port, 9600)
54 │
55 ▼
56 print_bytes() → write_all + flush
57 ```
58
59 ### `PrinterTransport` trait
60
61 ```rust
62 pub trait PrinterTransport {
63 fn write_all(&mut self, data: &[u8]) -> io::Result<()>;
64 fn flush(&mut self) -> io::Result<()>;
65 }
66 ```
67
68 | Type | Role |
69 |------|------|
70 | `SerialTransport` | Production — opens port via `serialport` |
71 | `MockTransport` | Tests — records bytes in `written` vec |
72
73 ### Discovery
74
75 `list_usb_serial_printers()` calls `serialport::available_ports()` and labels USB ports with VID/PID when available. All serial ports are listed (no POS-specific filter).
76
77 ### `PrinterDevice`
78
79 | Field | Example |
80 |-------|---------|
81 | `id` | `serial:COM3` |
82 | `display_name` | `COM3 — USB 04b8:0e15` |
83 | `port_name` | `COM3` |
84
85 ---
86
87 ## Print dialog (UI)
88
89 ```
90 ┌─────────────────────────────────────────┐
91 │ Print │
92 ├─────────────────────────────────────────┤
93 │ Parameters (one field per unique name) │
94 │ DocumentNumber: [________] │
95 │ │
96 │ USB printer │
97 │ [ Refresh ] │
98 │ ○ COM3 — USB 04b8:0e15 │
99 │ ○ /dev/ttyUSB0 — Serial │
100 │ │
101 │ [ Cancel ] [ Print ] │
102 └─────────────────────────────────────────┘
103 ```
104
105 - Parameters pre-filled from `last_params` (session memory).
106 - Same parameter name → one input, applied everywhere.
107 - Errors shown inline (parse, open port, write, barcode validation).
108
109 ---
110
111 ## Print pipeline
112
113 ```
114 Document body (DSL)
115 │
116 ▼
117 parse() → Document
118 │
119 ▼
120 collect_parameter_names() → UI dialog
121 │
122 ▼
123 substitute_document()
124 │
125 ▼
126 EscPosEncoder (in-tree)
127 │
128 ▼
129 SerialTransport::write_all
130 ```
131
132 ### Error handling (current)
133
134 | Condition | Behaviour |
135 |-----------|-----------|
136 | Parse error | Block print; show in toolbar |
137 | Port open failure | `PrintError::Open` message in dialog |
138 | Write failure | `PrintError::Write` message in dialog |
139 | EAN13/EAN8 invalid length | `EscPosError::Barcode` before write |
140 | Linux permission denied | User must join `dialout` group (documented in Help) |
141
142 Status polling (paper out, cover open) is **not** implemented.
143
144 ---
145
146 ## Images
147
148 1. Resolve path relative to `.pos` file directory (or absolute path).
149 2. Decode with `image` crate.
150 3. Convert to luma8, resize to target width (%, dots, or full printable width).
151 4. Threshold to 1-bit raster.
152 5. Emit `GS v 0` raster (`1D 76 30 00`, width/height LE, bitmap) — same format as print-bridge.
153
154 Preview shows `[image: path]` only — no bitmap preview yet.
155
156 ---
157
158 ## Preview vs print width
159
160 | `preview_mode` | Preview | Print |
161 |----------------|---------|-------|
162 | `autoscale` | Scales to panel width | Full paper width from metadata |
163 | `fixed` | Scaled by mm ratio | Full paper width |
164
165 ---
166
167 ## Testing without hardware
168
169 | Method | Location |
170 |--------|----------|
171 | `MockTransport` | `print/mod.rs` tests |
172 | ESC/POS byte checks | `escpos.rs` tests |
173 | `cargo test` | 20 tests; no printer required |
174
175 ---
176
177 ## Planned (not implemented)
178
179 | Feature | Notes |
180 |---------|-------|
181 | USB printer class | `nusb` / Windows `usbprint` |
182 | Bluetooth SPP | Serial port after OS pairing |
183 | Baud autodetect | Try 9600, 19200, 115200 |
184 | Printer status read | DLE EOT |
185 | Network TCP 9100 | Future |
186 | Image size warning in UI | Future |
187
188 ---
189
190 ## Dependencies
191
192 ```toml
193 serialport = "4"
194 image = { features = ["png", "jpeg", "gif", "bmp"] }
195 ```
196
197 No `escpos`, `nusb`, or `rusb` crates.
1 # Printing subsystem
2
3 Direct raw-byte printing to POS thermal printers over **USB-serial** — without the Windows print spooler or CUPS.
4
5 > **Implementation status (v0.1.0):** USB-serial only. In-tree ESC/POS encoder in `src/escpos.rs`. USB printer class and Bluetooth are **not** implemented.
6
7 ---
8
9 ## Goals
10
11 1. Discover serial ports (USB-serial adapters and CDC printers)
12 2. Let the user pick a port in the print dialog
13 3. Generate ESC/POS bytes from the AST (after parameter substitution)
14 4. Write bytes at **9600 baud** (fixed for now)
15
16 ---
17
18 ## Protocol: ESC/POS
19
20 Target **Epson ESC/POS** compatible printers (58 mm / 80 mm thermal).
21
22 ### Implemented commands
23
24 | Feature | ESC/POS | Source |
25 |---------|---------|--------|
26 | Initialize | ESC @ | `escpos.rs` |
27 | Code page | ESC t 0 (CP437) | Always CP437 today; metadata field reserved |
28 | Bold | ESC E | Headings level 2, `**text**` flattened at encode |
29 | Double size | GS ! | Heading level 1 |
30 | Alignment | ESC a | Paragraphs, images, barcodes, QR |
31 | Line feed | LF, ESC d | Text lines, `@feed` |
32 | Partial cut | GS V 66 0 | `@cut` in template |
33 | Barcode | GS k | CODE128, EAN13, EAN8, CODE39 |
34 | QR Code | GS ( k | Model 2 |
35 | Raster image | GS v 0 | `@image` via `image` crate → threshold |
36
37 Encoder: `EscPosEncoder` in `src/escpos.rs` — **not** the `escpos` crates.io package.
38
39 ---
40
41 ## Transport (implemented)
42
43 ```
44 Print button
45 │
46 ▼
47 substitute_document()
48 │
49 ▼
50 EscPosEncoder::encode_document()
51 │
52 ▼
53 SerialTransport::open(port, 9600)
54 │
55 ▼
56 print_bytes() → write_all + flush
57 ```
58
59 ### `PrinterTransport` trait
60
61 ```rust
62 pub trait PrinterTransport {
63 fn write_all(&mut self, data: &[u8]) -> io::Result<()>;
64 fn flush(&mut self) -> io::Result<()>;
65 }
66 ```
67
68 | Type | Role |
69 |------|------|
70 | `SerialTransport` | Production — opens port via `serialport` |
71 | `MockTransport` | Tests — records bytes in `written` vec |
72
73 ### Discovery
74
75 `list_usb_serial_printers()` calls `serialport::available_ports()` and labels USB ports with VID/PID when available. All serial ports are listed (no POS-specific filter).
76
77 ### `PrinterDevice`
78
79 | Field | Example |
80 |-------|---------|
81 | `id` | `serial:COM3` |
82 | `display_name` | `COM3 — USB 04b8:0e15` |
83 | `port_name` | `COM3` |
84
85 ---
86
87 ## Print dialog (UI)
88
89 ```
90 ┌─────────────────────────────────────────┐
91 │ Print │
92 ├─────────────────────────────────────────┤
93 │ Parameters (one field per unique name) │
94 │ DocumentNumber: [________] │
95 │ │
96 │ USB printer │
97 │ [ Refresh ] │
98 │ ○ COM3 — USB 04b8:0e15 │
99 │ ○ /dev/ttyUSB0 — Serial │
100 │ │
101 │ [ Cancel ] [ Print ] │
102 └─────────────────────────────────────────┘
103 ```
104
105 - Parameters pre-filled from `last_params` (session memory).
106 - Same parameter name → one input, applied everywhere.
107 - Errors shown inline (parse, open port, write, barcode validation).
108
109 ---
110
111 ## Print pipeline
112
113 ```
114 Document body (DSL)
115 │
116 ▼
117 parse() → Document
118 │
119 ▼
120 collect_parameter_names() → UI dialog
121 │
122 ▼
123 substitute_document()
124 │
125 ▼
126 EscPosEncoder (in-tree)
127 │
128 ▼
129 SerialTransport::write_all
130 ```
131
132 ### Error handling (current)
133
134 | Condition | Behaviour |
135 |-----------|-----------|
136 | Parse error | Block print; show in toolbar |
137 | Port open failure | `PrintError::Open` message in dialog |
138 | Write failure | `PrintError::Write` message in dialog |
139 | EAN13/EAN8 invalid length | `EscPosError::Barcode` before write |
140 | Linux permission denied | User must join `dialout` group (documented in Help) |
141
142 Status polling (paper out, cover open) is **not** implemented.
143
144 ---
145
146 ## Images
147
148 1. Resolve path relative to `.pos` file directory (or absolute path).
149 2. Decode with `image` crate.
150 3. Convert to luma8, resize to target width (%, dots, or full printable width).
151 4. Threshold to 1-bit raster.
152 5. Emit `GS v 0` raster (`1D 76 30 00`, width/height LE, bitmap) — same format as print-bridge.
153
154 Preview shows `[image: path]` only — no bitmap preview yet.
155
156 ---
157
158 ## Preview vs print width
159
160 | `preview_mode` | Preview | Print |
161 |----------------|---------|-------|
162 | `autoscale` | Scales to panel width | Full paper width from metadata |
163 | `fixed` | Scaled by mm ratio | Full paper width |
164
165 ---
166
167 ## Testing without hardware
168
169 | Method | Location |
170 |--------|----------|
171 | `MockTransport` | `print/mod.rs` tests |
172 | ESC/POS byte checks | `escpos.rs` tests |
173 | `cargo test` | 20 tests; no printer required |
174
175 ---
176
177 ## Planned (not implemented)
178
179 | Feature | Notes |
180 |---------|-------|
181 | USB printer class | `nusb` / Windows `usbprint` |
182 | Bluetooth SPP | Serial port after OS pairing |
183 | Baud autodetect | Try 9600, 19200, 115200 |
184 | Printer status read | DLE EOT |
185 | Network TCP 9100 | Future |
186 | Image size warning in UI | Future |
187
188 ---
189
190 ## Dependencies
191
192 ```toml
193 serialport = "4"
194 image = { features = ["png", "jpeg", "gif", "bmp"] }
195 ```
196
197 No `escpos`, `nusb`, or `rusb` crates.
@@ -1,197 +1,197 @@
1# Printing subsystem
1# Printing subsystem
2
2
3Direct raw-byte printing to POS thermal printers over **USB-serial** — without the Windows print spooler or CUPS.
3Direct raw-byte printing to POS thermal printers over **USB-serial** — without the Windows print spooler or CUPS.
4
4
5> **Implementation status (v0.1.0):** USB-serial only. In-tree ESC/POS encoder in `src/escpos.rs`. USB printer class and Bluetooth are **not** implemented.
5> **Implementation status (v0.1.0):** USB-serial only. In-tree ESC/POS encoder in `src/escpos.rs`. USB printer class and Bluetooth are **not** implemented.
6
6
7---
7---
8
8
9## Goals
9## Goals
10
10
111. Discover serial ports (USB-serial adapters and CDC printers)
111. Discover serial ports (USB-serial adapters and CDC printers)
122. Let the user pick a port in the print dialog
122. Let the user pick a port in the print dialog
133. Generate ESC/POS bytes from the AST (after parameter substitution)
133. Generate ESC/POS bytes from the AST (after parameter substitution)
144. Write bytes at **9600 baud** (fixed for now)
144. Write bytes at **9600 baud** (fixed for now)
15
15
16---
16---
17
17
18## Protocol: ESC/POS
18## Protocol: ESC/POS
19
19
20Target **Epson ESC/POS** compatible printers (58 mm / 80 mm thermal).
20Target **Epson ESC/POS** compatible printers (58 mm / 80 mm thermal).
21
21
22### Implemented commands
22### Implemented commands
23
23
24| Feature | ESC/POS | Source |
24| Feature | ESC/POS | Source |
25|---------|---------|--------|
25|---------|---------|--------|
26| Initialize | ESC @ | `escpos.rs` |
26| Initialize | ESC @ | `escpos.rs` |
27| Code page | ESC t 0 (CP437) | Always CP437 today; metadata field reserved |
27| Code page | ESC t 0 (CP437) | Always CP437 today; metadata field reserved |
28| Bold | ESC E | Headings level 2, `**text**` flattened at encode |
28| Bold | ESC E | Headings level 2, `**text**` flattened at encode |
29| Double size | GS ! | Heading level 1 |
29| Double size | GS ! | Heading level 1 |
30| Alignment | ESC a | Paragraphs, images, barcodes, QR |
30| Alignment | ESC a | Paragraphs, images, barcodes, QR |
31| Line feed | LF, ESC d | Text lines, `@feed` |
31| Line feed | LF, ESC d | Text lines, `@feed` |
32| Partial cut | GS V 66 0 | `@cut` in template |
32| Partial cut | GS V 66 0 | `@cut` in template |
33| Barcode | GS k | CODE128, EAN13, EAN8, CODE39 |
33| Barcode | GS k | CODE128, EAN13, EAN8, CODE39 |
34| QR Code | GS ( k | Model 2 |
34| QR Code | GS ( k | Model 2 |
35| Raster image | GS v 0 | `@image` via `image` crate → threshold |
35| Raster image | GS v 0 | `@image` via `image` crate → threshold |
36
36
37Encoder: `EscPosEncoder` in `src/escpos.rs` — **not** the `escpos` crates.io package.
37Encoder: `EscPosEncoder` in `src/escpos.rs` — **not** the `escpos` crates.io package.
38
38
39---
39---
40
40
41## Transport (implemented)
41## Transport (implemented)
42
42
43```
43```
44Print button
44Print button
45 │
45 │
46 ▼
46 ▼
47substitute_document()
47substitute_document()
48 │
48 │
49 ▼
49 ▼
50EscPosEncoder::encode_document()
50EscPosEncoder::encode_document()
51 │
51 │
52 ▼
52 ▼
53SerialTransport::open(port, 9600)
53SerialTransport::open(port, 9600)
54 │
54 │
55 ▼
55 ▼
56print_bytes() → write_all + flush
56print_bytes() → write_all + flush
57```
57```
58
58
59### `PrinterTransport` trait
59### `PrinterTransport` trait
60
60
61```rust
61```rust
62pub trait PrinterTransport {
62pub trait PrinterTransport {
63 fn write_all(&mut self, data: &[u8]) -> io::Result<()>;
63 fn write_all(&mut self, data: &[u8]) -> io::Result<()>;
64 fn flush(&mut self) -> io::Result<()>;
64 fn flush(&mut self) -> io::Result<()>;
65}
65}
66```
66```
67
67
68| Type | Role |
68| Type | Role |
69|------|------|
69|------|------|
70| `SerialTransport` | Production — opens port via `serialport` |
70| `SerialTransport` | Production — opens port via `serialport` |
71| `MockTransport` | Tests — records bytes in `written` vec |
71| `MockTransport` | Tests — records bytes in `written` vec |
72
72
73### Discovery
73### Discovery
74
74
75`list_usb_serial_printers()` calls `serialport::available_ports()` and labels USB ports with VID/PID when available. All serial ports are listed (no POS-specific filter).
75`list_usb_serial_printers()` calls `serialport::available_ports()` and labels USB ports with VID/PID when available. All serial ports are listed (no POS-specific filter).
76
76
77### `PrinterDevice`
77### `PrinterDevice`
78
78
79| Field | Example |
79| Field | Example |
80|-------|---------|
80|-------|---------|
81| `id` | `serial:COM3` |
81| `id` | `serial:COM3` |
82| `display_name` | `COM3 — USB 04b8:0e15` |
82| `display_name` | `COM3 — USB 04b8:0e15` |
83| `port_name` | `COM3` |
83| `port_name` | `COM3` |
84
84
85---
85---
86
86
87## Print dialog (UI)
87## Print dialog (UI)
88
88
89```
89```
90┌─────────────────────────────────────────┐
90┌─────────────────────────────────────────┐
91│ Print │
91│ Print │
92├─────────────────────────────────────────┤
92├─────────────────────────────────────────┤
93│ Parameters (one field per unique name) │
93│ Parameters (one field per unique name) │
94│ DocumentNumber: [________] │
94│ DocumentNumber: [________] │
95│ │
95│ │
96│ USB printer │
96│ USB printer │
97│ [ Refresh ] │
97│ [ Refresh ] │
98│ ○ COM3 — USB 04b8:0e15 │
98│ ○ COM3 — USB 04b8:0e15 │
99│ ○ /dev/ttyUSB0 — Serial │
99│ ○ /dev/ttyUSB0 — Serial │
100│ │
100│ │
101│ [ Cancel ] [ Print ] │
101│ [ Cancel ] [ Print ] │
102└─────────────────────────────────────────┘
102└─────────────────────────────────────────┘
103```
103```
104
104
105- Parameters pre-filled from `last_params` (session memory).
105- Parameters pre-filled from `last_params` (session memory).
106- Same parameter name → one input, applied everywhere.
106- Same parameter name → one input, applied everywhere.
107- Errors shown inline (parse, open port, write, barcode validation).
107- Errors shown inline (parse, open port, write, barcode validation).
108
108
109---
109---
110
110
111## Print pipeline
111## Print pipeline
112
112
113```
113```
114Document body (DSL)
114Document body (DSL)
115 │
115 │
116 ▼
116 ▼
117 parse() → Document
117 parse() → Document
118 │
118 │
119 ▼
119 ▼
120 collect_parameter_names() → UI dialog
120 collect_parameter_names() → UI dialog
121 │
121 │
122 ▼
122 ▼
123 substitute_document()
123 substitute_document()
124 │
124 │
125 ▼
125 ▼
126 EscPosEncoder (in-tree)
126 EscPosEncoder (in-tree)
127 │
127 │
128 ▼
128 ▼
129 SerialTransport::write_all
129 SerialTransport::write_all
130```
130```
131
131
132### Error handling (current)
132### Error handling (current)
133
133
134| Condition | Behaviour |
134| Condition | Behaviour |
135|-----------|-----------|
135|-----------|-----------|
136| Parse error | Block print; show in toolbar |
136| Parse error | Block print; show in toolbar |
137| Port open failure | `PrintError::Open` message in dialog |
137| Port open failure | `PrintError::Open` message in dialog |
138| Write failure | `PrintError::Write` message in dialog |
138| Write failure | `PrintError::Write` message in dialog |
139| EAN13/EAN8 invalid length | `EscPosError::Barcode` before write |
139| EAN13/EAN8 invalid length | `EscPosError::Barcode` before write |
140| Linux permission denied | User must join `dialout` group (documented in Help) |
140| Linux permission denied | User must join `dialout` group (documented in Help) |
141
141
142Status polling (paper out, cover open) is **not** implemented.
142Status polling (paper out, cover open) is **not** implemented.
143
143
144---
144---
145
145
146## Images
146## Images
147
147
1481. Resolve path relative to `.pos` file directory (or absolute path).
1481. Resolve path relative to `.pos` file directory (or absolute path).
1492. Decode with `image` crate.
1492. Decode with `image` crate.
1503. Convert to luma8, resize to target width (%, dots, or full printable width).
1503. Convert to luma8, resize to target width (%, dots, or full printable width).
1514. Threshold to 1-bit raster.
1514. Threshold to 1-bit raster.
1525. Emit `GS v 0` raster (`1D 76 30 00`, width/height LE, bitmap) — same format as print-bridge.
1525. Emit `GS v 0` raster (`1D 76 30 00`, width/height LE, bitmap) — same format as print-bridge.
153
153
154Preview shows `[image: path]` only — no bitmap preview yet.
154Preview shows `[image: path]` only — no bitmap preview yet.
155
155
156---
156---
157
157
158## Preview vs print width
158## Preview vs print width
159
159
160| `preview_mode` | Preview | Print |
160| `preview_mode` | Preview | Print |
161|----------------|---------|-------|
161|----------------|---------|-------|
162| `autoscale` | Scales to panel width | Full paper width from metadata |
162| `autoscale` | Scales to panel width | Full paper width from metadata |
163| `fixed` | Scaled by mm ratio | Full paper width |
163| `fixed` | Scaled by mm ratio | Full paper width |
164
164
165---
165---
166
166
167## Testing without hardware
167## Testing without hardware
168
168
169| Method | Location |
169| Method | Location |
170|--------|----------|
170|--------|----------|
171| `MockTransport` | `print/mod.rs` tests |
171| `MockTransport` | `print/mod.rs` tests |
172| ESC/POS byte checks | `escpos.rs` tests |
172| ESC/POS byte checks | `escpos.rs` tests |
173| `cargo test` | 20 tests; no printer required |
173| `cargo test` | 20 tests; no printer required |
174
174
175---
175---
176
176
177## Planned (not implemented)
177## Planned (not implemented)
178
178
179| Feature | Notes |
179| Feature | Notes |
180|---------|-------|
180|---------|-------|
181| USB printer class | `nusb` / Windows `usbprint` |
181| USB printer class | `nusb` / Windows `usbprint` |
182| Bluetooth SPP | Serial port after OS pairing |
182| Bluetooth SPP | Serial port after OS pairing |
183| Baud autodetect | Try 9600, 19200, 115200 |
183| Baud autodetect | Try 9600, 19200, 115200 |
184| Printer status read | DLE EOT |
184| Printer status read | DLE EOT |
185| Network TCP 9100 | Future |
185| Network TCP 9100 | Future |
186| Image size warning in UI | Future |
186| Image size warning in UI | Future |
187
187
188---
188---
189
189
190## Dependencies
190## Dependencies
191
191
192```toml
192```toml
193serialport = "4"
193serialport = "4"
194image = { features = ["png", "jpeg", "gif", "bmp"] }
194image = { features = ["png", "jpeg", "gif", "bmp"] }
195```
195```
196
196
197No `escpos`, `nusb`, or `rusb` crates.
197No `escpos`, `nusb`, or `rusb` crates.
packaging/arch/PKGBUILD +54 −54
@@ -1,54 +1,54 @@
1 # Maintainer: posprint contributors
2 pkgname=posprint
3 pkgver=0.1.0
4 pkgrel=1
5 pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6 arch=('x86_64')
7 url="https://gitlab.com/Timfa/posprint"
8 license=('MIT')
9 depends=(
10 'gcc-libs'
11 'libxkbcommon'
12 'libxcb'
13 'openssl'
14 'dbus-libs'
15 'wayland'
16 'libx11'
17 'fontconfig'
18 'freetype2'
19 'libglvnd'
20 )
21 makedepends=('rust' 'cargo' 'pkgconf' 'git')
22 options=('!lto')
23 source=()
24 sha256sums=()
25
26 prepare() {
27 local root="$startdir/../.."
28 mkdir -p "$srcdir/$pkgname-$pkgver"
29 rsync -a \
30 --exclude target \
31 --exclude .git \
32 --exclude packaging/arch/pkg \
33 --exclude packaging/arch/src \
34 --exclude 'packaging/arch/*.pkg.tar.zst' \
35 --exclude 'packaging/arch/*.pkg.tar.zst.sig' \
36 "$root/" "$srcdir/$pkgname-$pkgver/"
37 }
38
39 build() {
40 cd "$srcdir/$pkgname-$pkgver"
41 cargo build --release --locked
42 }
43
44 package() {
45 cd "$srcdir/$pkgname-$pkgver"
46 install -Dm755 target/release/posprint "$pkgdir/usr/bin/posprint"
47 install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
48 install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
49 install -Dm644 packaging/posprint.desktop "$pkgdir/usr/share/applications/posprint.desktop"
50 install -Dm644 packaging/mime/posprint.xml "$pkgdir/usr/share/mime/packages/posprint.xml"
51 install -Dm644 packaging/linux/posprint-print.desktop "$pkgdir/usr/share/kio/servicemenus/posprint-print.desktop"
52 install -Dm644 packaging/linux/posprint-print-thunar.xml "$pkgdir/usr/share/thunar/uca/posprint-print.xml"
53 install -Dm644 pos-logo.png "$pkgdir/usr/share/pixmaps/posprint.png"
54 }
1 # Maintainer: posprint contributors
2 pkgname=posprint
3 pkgver=0.1.1
4 pkgrel=1
5 pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6 arch=('x86_64')
7 url="https://gitlab.com/Timfa/posprint"
8 license=('MIT')
9 depends=(
10 'gcc-libs'
11 'libxkbcommon'
12 'libxcb'
13 'openssl'
14 'dbus'
15 'wayland'
16 'libx11'
17 'fontconfig'
18 'freetype2'
19 'libglvnd'
20 )
21 makedepends=('rust' 'cargo' 'pkgconf' 'git')
22 options=('!lto')
23 source=()
24 sha256sums=()
25
26 prepare() {
27 local root="$startdir/../.."
28 mkdir -p "$srcdir/$pkgname-$pkgver"
29 rsync -a \
30 --exclude target \
31 --exclude .git \
32 --exclude packaging/arch/pkg \
33 --exclude packaging/arch/src \
34 --exclude 'packaging/arch/*.pkg.tar.zst' \
35 --exclude 'packaging/arch/*.pkg.tar.zst.sig' \
36 "$root/" "$srcdir/$pkgname-$pkgver/"
37 }
38
39 build() {
40 cd "$srcdir/$pkgname-$pkgver"
41 cargo build --release --locked
42 }
43
44 package() {
45 cd "$srcdir/$pkgname-$pkgver"
46 install -Dm755 target/release/posprint "$pkgdir/usr/bin/posprint"
47 install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
48 install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
49 install -Dm644 packaging/posprint.desktop "$pkgdir/usr/share/applications/posprint.desktop"
50 install -Dm644 packaging/mime/posprint.xml "$pkgdir/usr/share/mime/packages/posprint.xml"
51 install -Dm644 packaging/linux/posprint-print.desktop "$pkgdir/usr/share/kio/servicemenus/posprint-print.desktop"
52 install -Dm644 packaging/linux/posprint-print-thunar.xml "$pkgdir/usr/share/thunar/uca/posprint-print.xml"
53 install -Dm644 pos-logo.png "$pkgdir/usr/share/pixmaps/posprint.png"
54 }
@@ -1,54 +1,54 @@
1# Maintainer: posprint contributors
1# Maintainer: posprint contributors
2pkgname=posprint
2pkgname=posprint
3pkgver=0.1.0
3pkgver=0.1.1
4pkgrel=1
4pkgrel=1
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6arch=('x86_64')
6arch=('x86_64')
7url="https://gitlab.com/Timfa/posprint"
7url="https://gitlab.com/Timfa/posprint"
8license=('MIT')
8license=('MIT')
9depends=(
9depends=(
10 'gcc-libs'
10 'gcc-libs'
11 'libxkbcommon'
11 'libxkbcommon'
12 'libxcb'
12 'libxcb'
13 'openssl'
13 'openssl'
14 'dbus-libs'
14 'dbus'
15 'wayland'
15 'wayland'
16 'libx11'
16 'libx11'
17 'fontconfig'
17 'fontconfig'
18 'freetype2'
18 'freetype2'
19 'libglvnd'
19 'libglvnd'
20)
20)
21makedepends=('rust' 'cargo' 'pkgconf' 'git')
21makedepends=('rust' 'cargo' 'pkgconf' 'git')
22options=('!lto')
22options=('!lto')
23source=()
23source=()
24sha256sums=()
24sha256sums=()
25
25
26prepare() {
26prepare() {
27 local root="$startdir/../.."
27 local root="$startdir/../.."
28 mkdir -p "$srcdir/$pkgname-$pkgver"
28 mkdir -p "$srcdir/$pkgname-$pkgver"
29 rsync -a \
29 rsync -a \
30 --exclude target \
30 --exclude target \
31 --exclude .git \
31 --exclude .git \
32 --exclude packaging/arch/pkg \
32 --exclude packaging/arch/pkg \
33 --exclude packaging/arch/src \
33 --exclude packaging/arch/src \
34 --exclude 'packaging/arch/*.pkg.tar.zst' \
34 --exclude 'packaging/arch/*.pkg.tar.zst' \
35 --exclude 'packaging/arch/*.pkg.tar.zst.sig' \
35 --exclude 'packaging/arch/*.pkg.tar.zst.sig' \
36 "$root/" "$srcdir/$pkgname-$pkgver/"
36 "$root/" "$srcdir/$pkgname-$pkgver/"
37}
37}
38
38
39build() {
39build() {
40 cd "$srcdir/$pkgname-$pkgver"
40 cd "$srcdir/$pkgname-$pkgver"
41 cargo build --release --locked
41 cargo build --release --locked
42}
42}
43
43
44package() {
44package() {
45 cd "$srcdir/$pkgname-$pkgver"
45 cd "$srcdir/$pkgname-$pkgver"
46 install -Dm755 target/release/posprint "$pkgdir/usr/bin/posprint"
46 install -Dm755 target/release/posprint "$pkgdir/usr/bin/posprint"
47 install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
47 install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
48 install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
48 install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
49 install -Dm644 packaging/posprint.desktop "$pkgdir/usr/share/applications/posprint.desktop"
49 install -Dm644 packaging/posprint.desktop "$pkgdir/usr/share/applications/posprint.desktop"
50 install -Dm644 packaging/mime/posprint.xml "$pkgdir/usr/share/mime/packages/posprint.xml"
50 install -Dm644 packaging/mime/posprint.xml "$pkgdir/usr/share/mime/packages/posprint.xml"
51 install -Dm644 packaging/linux/posprint-print.desktop "$pkgdir/usr/share/kio/servicemenus/posprint-print.desktop"
51 install -Dm644 packaging/linux/posprint-print.desktop "$pkgdir/usr/share/kio/servicemenus/posprint-print.desktop"
52 install -Dm644 packaging/linux/posprint-print-thunar.xml "$pkgdir/usr/share/thunar/uca/posprint-print.xml"
52 install -Dm644 packaging/linux/posprint-print-thunar.xml "$pkgdir/usr/share/thunar/uca/posprint-print.xml"
53 install -Dm644 pos-logo.png "$pkgdir/usr/share/pixmaps/posprint.png"
53 install -Dm644 pos-logo.png "$pkgdir/usr/share/pixmaps/posprint.png"
54}
54}
packaging/linux/posprint-print-thunar.xml +13 −13
@@ -1,13 +1,13 @@
1 <?xml version="1.0" encoding="UTF-8"?>
2 <actions>
3 <action>
4 <icon>posprint</icon>
5 <name>Print</name>
6 <command>posprint --print %f</command>
7 <description>Print POS receipt template</description>
8 <patterns>
9 <pattern>*.pos</pattern>
10 </patterns>
11 <startup-notify/>
12 </action>
13 </actions>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <actions>
3 <action>
4 <icon>posprint</icon>
5 <name>Print</name>
6 <command>posprint --print %f</command>
7 <description>Print POS receipt template</description>
8 <patterns>
9 <pattern>*.pos</pattern>
10 </patterns>
11 <startup-notify/>
12 </action>
13 </actions>
@@ -1,13 +1,13 @@
1<?xml version="1.0" encoding="UTF-8"?>
1<?xml version="1.0" encoding="UTF-8"?>
2<actions>
2<actions>
3<action>
3<action>
4 <icon>posprint</icon>
4 <icon>posprint</icon>
5 <name>Print</name>
5 <name>Print</name>
6 <command>posprint --print %f</command>
6 <command>posprint --print %f</command>
7 <description>Print POS receipt template</description>
7 <description>Print POS receipt template</description>
8 <patterns>
8 <patterns>
9 <pattern>*.pos</pattern>
9 <pattern>*.pos</pattern>
10 </patterns>
10 </patterns>
11 <startup-notify/>
11 <startup-notify/>
12</action>
12</action>
13</actions>
13</actions>
packaging/linux/posprint-print.desktop +11 −11
@@ -1,11 +1,11 @@
1 [Desktop Entry]
2 Type=Service
3 ServiceTypes=KonqPopupMenu/Plugin
4 MimeType=application/x-posprint;
5 Actions=Print;
6 X-KDE-Priority=TopLevel
7
8 [Desktop Action Print]
9 Name=Print
10 Icon=posprint
11 Exec=posprint --print %f
1 [Desktop Entry]
2 Type=Service
3 ServiceTypes=KonqPopupMenu/Plugin
4 MimeType=application/x-posprint;
5 Actions=Print;
6 X-KDE-Priority=TopLevel
7
8 [Desktop Action Print]
9 Name=Print
10 Icon=posprint
11 Exec=posprint --print %f
@@ -1,11 +1,11 @@
1[Desktop Entry]
1[Desktop Entry]
2Type=Service
2Type=Service
3ServiceTypes=KonqPopupMenu/Plugin
3ServiceTypes=KonqPopupMenu/Plugin
4MimeType=application/x-posprint;
4MimeType=application/x-posprint;
5Actions=Print;
5Actions=Print;
6X-KDE-Priority=TopLevel
6X-KDE-Priority=TopLevel
7
7
8[Desktop Action Print]
8[Desktop Action Print]
9Name=Print
9Name=Print
10Icon=posprint
10Icon=posprint
11Exec=posprint --print %f
11Exec=posprint --print %f
packaging/mime/posprint.xml +9 −6
@@ -1,6 +1,9 @@
1 <?xml version="1.0" encoding="UTF-8"?>
2 <mime-type xmlns="http://www.freedesktop.org/stand-alone/xml-mime-type">
3 <comment>POS print template</comment>
4 <glob pattern="*.pos"/>
5 <icon name="posprint"/>
6 </mime-type>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3 <mime-type type="application/x-posprint">
4 <comment>POS print template</comment>
5 <comment xml:lang="nl">POS-printsjabloon</comment>
6 <glob pattern="*.pos"/>
7 <icon name="posprint"/>
8 </mime-type>
9 </mime-info>
@@ -1,6 +1,9 @@
1<?xml version="1.0" encoding="UTF-8"?>
1<?xml version="1.0" encoding="UTF-8"?>
2<mime-type xmlns="http://www.freedesktop.org/stand-alone/xml-mime-type">
2<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3 <comment>POS print template</comment>
3 <mime-type type="application/x-posprint">
4 <glob pattern="*.pos"/>
4 <comment>POS print template</comment>
5 <icon name="posprint"/>
5 <comment xml:lang="nl">POS-printsjabloon</comment>
6</mime-type>
6 <glob pattern="*.pos"/>
7 <icon name="posprint"/>
8 </mime-type>
9</mime-info>
packaging/posprint.desktop +10 −10
@@ -1,10 +1,10 @@
1 [Desktop Entry]
2 Type=Application
3 Name=posprint
4 Comment=POS receipt template designer
5 Exec=posprint %f
6 Icon=posprint
7 Terminal=false
8 Categories=Office;Utility;
9 MimeType=application/x-posprint;
10 StartupNotify=true
1 [Desktop Entry]
2 Type=Application
3 Name=posprint
4 Comment=POS receipt template designer
5 Exec=posprint %f
6 Icon=posprint
7 Terminal=false
8 Categories=Office;Utility;
9 MimeType=application/x-posprint;
10 StartupNotify=true
@@ -1,10 +1,10 @@
1[Desktop Entry]
1[Desktop Entry]
2Type=Application
2Type=Application
3Name=posprint
3Name=posprint
4Comment=POS receipt template designer
4Comment=POS receipt template designer
5Exec=posprint %f
5Exec=posprint %f
6Icon=posprint
6Icon=posprint
7Terminal=false
7Terminal=false
8Categories=Office;Utility;
8Categories=Office;Utility;
9MimeType=application/x-posprint;
9MimeType=application/x-posprint;
10StartupNotify=true
10StartupNotify=true
scripts/build-arch.sh +99 −45
@@ -1,45 +1,99 @@
1 #!/usr/bin/env bash
2 # Build an Arch Linux pacman package (.pkg.tar.zst) for posprint.
3 set -euo pipefail
4
5 ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6 cd "$ROOT"
7
8 BUILD_DEB=false
9 SKIP_TESTS=false
10 AS_ROOT=false
11
12 for arg in "$@"; do
13 case "$arg" in
14 --skip-tests) SKIP_TESTS=true ;;
15 --asroot) AS_ROOT=true ;;
16 -h|--help)
17 echo "Usage: $0 [--skip-tests] [--asroot]"
18 echo "Builds packaging/arch/posprint-<ver>-<rel>-x86_64.pkg.tar.zst"
19 exit 0
20 ;;
21 *) echo "Unknown option: $arg"; exit 1 ;;
22 esac
23 done
24
25 if ! command -v makepkg &>/dev/null; then
26 echo "makepkg not found. On Arch, install base-devel: sudo pacman -S base-devel"
27 exit 1
28 fi
29
30 if [[ "$SKIP_TESTS" != "true" ]]; then
31 cargo test
32 fi
33
34 PKGVER="$(grep '^version' Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
35 sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
36
37 cd packaging/arch
38 MAKEPKG_FLAGS=(-f --noconfirm)
39 if [[ "$AS_ROOT" == "true" ]]; then
40 MAKEPKG_FLAGS+=(--asroot)
41 fi
42 makepkg "${MAKEPKG_FLAGS[@]}"
43
44 echo "Arch package:"
45 ls -lh posprint-"${PKGVER}"-*-x86_64.pkg.tar.zst
1 #!/usr/bin/env bash
2 # Build an Arch Linux pacman package (.pkg.tar.zst) for posprint.
3 set -euo pipefail
4
5 ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6 cd "$ROOT"
7
8 SKIP_TESTS=false
9 AS_ROOT=false
10 INSTALL=false
11
12 for arg in "$@"; do
13 case "$arg" in
14 --skip-tests) SKIP_TESTS=true ;;
15 --asroot) AS_ROOT=true ;;
16 --install) INSTALL=true ;;
17 -h|--help)
18 echo "Usage: $0 [--skip-tests] [--asroot] [--install]"
19 echo "Builds packaging/arch/posprint-<ver>-<rel>-x86_64.pkg.tar.zst"
20 echo " --install install the package with pacman after building"
21 echo "Without --install, prompts interactively when stdin is a TTY."
22 echo "Uses rustup/cargo on PATH; runs makepkg --nodeps if pacman rust/cargo are absent."
23 exit 0
24 ;;
25 *) echo "Unknown option: $arg"; exit 1 ;;
26 esac
27 done
28
29 want_install() {
30 if [[ "$INSTALL" == "true" ]]; then
31 return 0
32 fi
33 if [[ ! -t 0 ]]; then
34 return 1
35 fi
36 local answer
37 read -r -p "Install the package now with pacman? [y/N] " answer
38 [[ "$answer" =~ ^[Yy]([Ee][Ss])?$ ]]
39 }
40
41 if ! command -v makepkg &>/dev/null; then
42 echo "makepkg not found. On Arch, install base-devel: sudo pacman -S base-devel"
43 exit 1
44 fi
45
46 # Ensure rustup toolchains are visible to makepkg's build().
47 if [[ -f "$HOME/.cargo/env" ]]; then
48 # shellcheck source=/dev/null
49 source "$HOME/.cargo/env"
50 fi
51
52 if ! command -v cargo &>/dev/null || ! command -v rustc &>/dev/null; then
53 echo "cargo/rustc not found. Install via rustup (https://rustup.rs) or: sudo pacman -S rust"
54 exit 1
55 fi
56
57 # PKGBUILD lists pacman rust/cargo as makedepends. rustup installs don't register
58 # those packages, so skip dep resolution when the toolchain is already on PATH.
59 MAKEPKG_NODEPS=false
60 if ! pacman -Q rust &>/dev/null || ! pacman -Q cargo &>/dev/null; then
61 echo "Note: pacman rust/cargo not installed; using toolchain on PATH ($(rustc --version))."
62 echo " makepkg will run with --nodeps."
63 MAKEPKG_NODEPS=true
64 fi
65
66 if [[ "$SKIP_TESTS" != "true" ]]; then
67 cargo test
68 fi
69
70 PKGVER="$(grep '^version' Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
71 # makepkg refuses PKGBUILDs with Windows (CRLF) line endings.
72 sed -i "s/\r$//; s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
73
74 cd packaging/arch
75 MAKEPKG_FLAGS=(-f --noconfirm)
76 if [[ "$AS_ROOT" == "true" ]]; then
77 MAKEPKG_FLAGS+=(--asroot)
78 fi
79 if [[ "$MAKEPKG_NODEPS" == "true" ]]; then
80 MAKEPKG_FLAGS+=(--nodeps)
81 fi
82 makepkg "${MAKEPKG_FLAGS[@]}"
83
84 shopt -s nullglob
85 PACKAGES=(posprint-"${PKGVER}"-*-x86_64.pkg.tar.zst)
86 shopt -u nullglob
87 if [[ ${#PACKAGES[@]} -eq 0 ]]; then
88 echo "No package produced."
89 exit 1
90 fi
91
92 echo "Arch package:"
93 ls -lh "${PACKAGES[@]}"
94
95 if want_install; then
96 echo "Installing with pacman..."
97 sudo pacman -U --noconfirm "${PACKAGES[@]}"
98 echo "Installed."
99 fi
@@ -1,45 +1,99 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2# Build an Arch Linux pacman package (.pkg.tar.zst) for posprint.
2# Build an Arch Linux pacman package (.pkg.tar.zst) for posprint.
3set -euo pipefail
3set -euo pipefail
4
4
5ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6cd "$ROOT"
6cd "$ROOT"
7
7
8BUILD_DEB=false
8SKIP_TESTS=false
9SKIP_TESTS=false
9AS_ROOT=false
10AS_ROOT=false
10INSTALL=false
11
11
12for arg in "$@"; do
12for arg in "$@"; do
13 case "$arg" in
13 case "$arg" in
14 --skip-tests) SKIP_TESTS=true ;;
14 --skip-tests) SKIP_TESTS=true ;;
15 --asroot) AS_ROOT=true ;;
15 --asroot) AS_ROOT=true ;;
16 -h|--help)
16 --install) INSTALL=true ;;
17 echo "Usage: $0 [--skip-tests] [--asroot]"
17 -h|--help)
18 echo "Builds packaging/arch/posprint-<ver>-<rel>-x86_64.pkg.tar.zst"
18 echo "Usage: $0 [--skip-tests] [--asroot] [--install]"
19 exit 0
19 echo "Builds packaging/arch/posprint-<ver>-<rel>-x86_64.pkg.tar.zst"
20 ;;
20 echo " --install install the package with pacman after building"
21 *) echo "Unknown option: $arg"; exit 1 ;;
21 echo "Without --install, prompts interactively when stdin is a TTY."
22 esac
22 echo "Uses rustup/cargo on PATH; runs makepkg --nodeps if pacman rust/cargo are absent."
23done
23 exit 0
24
24 ;;
25if ! command -v makepkg &>/dev/null; then
25 *) echo "Unknown option: $arg"; exit 1 ;;
26 echo "makepkg not found. On Arch, install base-devel: sudo pacman -S base-devel"
26 esac
27 exit 1
27done
28fi
28
29
29want_install() {
30if [[ "$SKIP_TESTS" != "true" ]]; then
30 if [[ "$INSTALL" == "true" ]]; then
31 cargo test
31 return 0
32fi
32 fi
33
33 if [[ ! -t 0 ]]; then
34PKGVER="$(grep '^version' Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
34 return 1
35sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
35 fi
36
36 local answer
37cd packaging/arch
37 read -r -p "Install the package now with pacman? [y/N] " answer
38MAKEPKG_FLAGS=(-f --noconfirm)
38 [[ "$answer" =~ ^[Yy]([Ee][Ss])?$ ]]
39if [[ "$AS_ROOT" == "true" ]]; then
39}
40 MAKEPKG_FLAGS+=(--asroot)
40
41fi
41if ! command -v makepkg &>/dev/null; then
42makepkg "${MAKEPKG_FLAGS[@]}"
42 echo "makepkg not found. On Arch, install base-devel: sudo pacman -S base-devel"
43
43 exit 1
44echo "Arch package:"
44fi
45ls -lh posprint-"${PKGVER}"-*-x86_64.pkg.tar.zst
45
46# Ensure rustup toolchains are visible to makepkg's build().
47if [[ -f "$HOME/.cargo/env" ]]; then
48 # shellcheck source=/dev/null
49 source "$HOME/.cargo/env"
50fi
51
52if ! command -v cargo &>/dev/null || ! command -v rustc &>/dev/null; then
53 echo "cargo/rustc not found. Install via rustup (https://rustup.rs) or: sudo pacman -S rust"
54 exit 1
55fi
56
57# PKGBUILD lists pacman rust/cargo as makedepends. rustup installs don't register
58# those packages, so skip dep resolution when the toolchain is already on PATH.
59MAKEPKG_NODEPS=false
60if ! pacman -Q rust &>/dev/null || ! pacman -Q cargo &>/dev/null; then
61 echo "Note: pacman rust/cargo not installed; using toolchain on PATH ($(rustc --version))."
62 echo " makepkg will run with --nodeps."
63 MAKEPKG_NODEPS=true
64fi
65
66if [[ "$SKIP_TESTS" != "true" ]]; then
67 cargo test
68fi
69
70PKGVER="$(grep '^version' Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/')"
71# makepkg refuses PKGBUILDs with Windows (CRLF) line endings.
72sed -i "s/\r$//; s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
73
74cd packaging/arch
75MAKEPKG_FLAGS=(-f --noconfirm)
76if [[ "$AS_ROOT" == "true" ]]; then
77 MAKEPKG_FLAGS+=(--asroot)
78fi
79if [[ "$MAKEPKG_NODEPS" == "true" ]]; then
80 MAKEPKG_FLAGS+=(--nodeps)
81fi
82makepkg "${MAKEPKG_FLAGS[@]}"
83
84shopt -s nullglob
85PACKAGES=(posprint-"${PKGVER}"-*-x86_64.pkg.tar.zst)
86shopt -u nullglob
87if [[ ${#PACKAGES[@]} -eq 0 ]]; then
88 echo "No package produced."
89 exit 1
90fi
91
92echo "Arch package:"
93ls -lh "${PACKAGES[@]}"
94
95if want_install; then
96 echo "Installing with pacman..."
97 sudo pacman -U --noconfirm "${PACKAGES[@]}"
98 echo "Installed."
99fi
scripts/build-linux.sh +77 −37
@@ -1,37 +1,77 @@
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5 cd "$ROOT"
6
7 BUILD_DEB=false
8 SKIP_TESTS=false
9
10 for arg in "$@"; do
11 case "$arg" in
12 --deb) BUILD_DEB=true ;;
13 --skip-tests) SKIP_TESTS=true ;;
14 *) echo "Unknown option: $arg"; exit 1 ;;
15 esac
16 done
17
18 echo "Building posprint for Linux (x86_64)..."
19
20 if [[ "$SKIP_TESTS" != "true" ]]; then
21 cargo test
22 fi
23
24 cargo build --release
25 BIN="$ROOT/target/release/posprint"
26 echo "OK: $BIN"
27 ls -lh "$BIN"
28
29 if [[ "$BUILD_DEB" == "true" ]]; then
30 if ! command -v cargo-deb &>/dev/null; then
31 echo "Installing cargo-deb..."
32 cargo install cargo-deb --locked
33 fi
34 cargo deb
35 echo "Debian packages:"
36 ls -lh "$ROOT/target/debian/"*.deb
37 fi
1 #!/usr/bin/env bash
2 set -euo pipefail
3
4 ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5 cd "$ROOT"
6
7 BUILD_DEB=false
8 SKIP_TESTS=false
9 INSTALL=false
10
11 for arg in "$@"; do
12 case "$arg" in
13 --deb) BUILD_DEB=true ;;
14 --skip-tests) SKIP_TESTS=true ;;
15 --install) INSTALL=true ;;
16 -h|--help)
17 echo "Usage: $0 [--deb] [--skip-tests] [--install]"
18 echo "Builds target/release/posprint (and optionally a .deb)."
19 echo " --deb also build a Debian package with cargo-deb"
20 echo " --install install the .deb with apt after building (implies --deb)"
21 echo "Without --install, prompts interactively for .deb install when stdin is a TTY."
22 exit 0
23 ;;
24 *) echo "Unknown option: $arg"; exit 1 ;;
25 esac
26 done
27
28 if [[ "$INSTALL" == "true" ]]; then
29 BUILD_DEB=true
30 fi
31
32 want_install() {
33 if [[ "$INSTALL" == "true" ]]; then
34 return 0
35 fi
36 if [[ ! -t 0 ]]; then
37 return 1
38 fi
39 local answer
40 read -r -p "Install the .deb now with apt? [y/N] " answer
41 [[ "$answer" =~ ^[Yy]([Ee][Ss])?$ ]]
42 }
43
44 echo "Building posprint for Linux (x86_64)..."
45
46 if [[ "$SKIP_TESTS" != "true" ]]; then
47 cargo test
48 fi
49
50 cargo build --release
51 BIN="$ROOT/target/release/posprint"
52 echo "OK: $BIN"
53 ls -lh "$BIN"
54
55 if [[ "$BUILD_DEB" == "true" ]]; then
56 if ! command -v cargo-deb &>/dev/null; then
57 echo "Installing cargo-deb..."
58 cargo install cargo-deb --locked
59 fi
60 cargo deb
61 shopt -s nullglob
62 DEBS=("$ROOT"/target/debian/*.deb)
63 shopt -u nullglob
64 if [[ ${#DEBS[@]} -eq 0 ]]; then
65 echo "No .deb produced."
66 exit 1
67 fi
68 echo "Debian packages:"
69 ls -lh "${DEBS[@]}"
70
71 if want_install; then
72 echo "Installing with apt..."
73 # Relative path so apt treats it as a local package file.
74 sudo apt-get install -y "${DEBS[@]}"
75 echo "Installed."
76 fi
77 fi
@@ -1,37 +1,77 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2set -euo pipefail
2set -euo pipefail
3
3
4ROOT="$(cd "$(dirname "$0")/.." && pwd)"
4ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5cd "$ROOT"
5cd "$ROOT"
6
6
7BUILD_DEB=false
7BUILD_DEB=false
8SKIP_TESTS=false
8SKIP_TESTS=false
9
9INSTALL=false
10for arg in "$@"; do
10
11 case "$arg" in
11for arg in "$@"; do
12 --deb) BUILD_DEB=true ;;
12 case "$arg" in
13 --skip-tests) SKIP_TESTS=true ;;
13 --deb) BUILD_DEB=true ;;
14 *) echo "Unknown option: $arg"; exit 1 ;;
14 --skip-tests) SKIP_TESTS=true ;;
15 esac
15 --install) INSTALL=true ;;
16done
16 -h|--help)
17
17 echo "Usage: $0 [--deb] [--skip-tests] [--install]"
18echo "Building posprint for Linux (x86_64)..."
18 echo "Builds target/release/posprint (and optionally a .deb)."
19
19 echo " --deb also build a Debian package with cargo-deb"
20if [[ "$SKIP_TESTS" != "true" ]]; then
20 echo " --install install the .deb with apt after building (implies --deb)"
21 cargo test
21 echo "Without --install, prompts interactively for .deb install when stdin is a TTY."
22fi
22 exit 0
23
23 ;;
24cargo build --release
24 *) echo "Unknown option: $arg"; exit 1 ;;
25BIN="$ROOT/target/release/posprint"
25 esac
26echo "OK: $BIN"
26done
27ls -lh "$BIN"
27
28
28if [[ "$INSTALL" == "true" ]]; then
29if [[ "$BUILD_DEB" == "true" ]]; then
29 BUILD_DEB=true
30 if ! command -v cargo-deb &>/dev/null; then
30fi
31 echo "Installing cargo-deb..."
31
32 cargo install cargo-deb --locked
32want_install() {
33 fi
33 if [[ "$INSTALL" == "true" ]]; then
34 cargo deb
34 return 0
35 echo "Debian packages:"
35 fi
36 ls -lh "$ROOT/target/debian/"*.deb
36 if [[ ! -t 0 ]]; then
37fi
37 return 1
38 fi
39 local answer
40 read -r -p "Install the .deb now with apt? [y/N] " answer
41 [[ "$answer" =~ ^[Yy]([Ee][Ss])?$ ]]
42}
43
44echo "Building posprint for Linux (x86_64)..."
45
46if [[ "$SKIP_TESTS" != "true" ]]; then
47 cargo test
48fi
49
50cargo build --release
51BIN="$ROOT/target/release/posprint"
52echo "OK: $BIN"
53ls -lh "$BIN"
54
55if [[ "$BUILD_DEB" == "true" ]]; then
56 if ! command -v cargo-deb &>/dev/null; then
57 echo "Installing cargo-deb..."
58 cargo install cargo-deb --locked
59 fi
60 cargo deb
61 shopt -s nullglob
62 DEBS=("$ROOT"/target/debian/*.deb)
63 shopt -u nullglob
64 if [[ ${#DEBS[@]} -eq 0 ]]; then
65 echo "No .deb produced."
66 exit 1
67 fi
68 echo "Debian packages:"
69 ls -lh "${DEBS[@]}"
70
71 if want_install; then
72 echo "Installing with apt..."
73 # Relative path so apt treats it as a local package file.
74 sudo apt-get install -y "${DEBS[@]}"
75 echo "Installed."
76 fi
77fi
scripts/build-windows.ps1 +26 −26
@@ -1,26 +1,26 @@
1 #Requires -Version 5.1
2 param(
3 [switch]$SkipTests
4 )
5
6 $ErrorActionPreference = "Stop"
7 $Root = Split-Path -Parent $PSScriptRoot
8 Set-Location $Root
9
10 Write-Host "Building posprint for Windows (x64)..."
11
12 if (-not $SkipTests) {
13 cargo test
14 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
15 }
16
17 cargo build --release
18 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
19
20 $exe = Join-Path $Root "target\release\posprint.exe"
21 if (-not (Test-Path $exe)) {
22 Write-Error "Build failed: $exe not found"
23 }
24
25 Write-Host "OK: $exe"
26 Get-Item $exe | Select-Object FullName, Length, LastWriteTime
1 #Requires -Version 5.1
2 param(
3 [switch]$SkipTests
4 )
5
6 $ErrorActionPreference = "Stop"
7 $Root = Split-Path -Parent $PSScriptRoot
8 Set-Location $Root
9
10 Write-Host "Building posprint for Windows (x64)..."
11
12 if (-not $SkipTests) {
13 cargo test
14 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
15 }
16
17 cargo build --release
18 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
19
20 $exe = Join-Path $Root "target\release\posprint.exe"
21 if (-not (Test-Path $exe)) {
22 Write-Error "Build failed: $exe not found"
23 }
24
25 Write-Host "OK: $exe"
26 Get-Item $exe | Select-Object FullName, Length, LastWriteTime
@@ -1,26 +1,26 @@
1#Requires -Version 5.1
1#Requires -Version 5.1
2param(
2param(
3 [switch]$SkipTests
3 [switch]$SkipTests
4)
4)
5
5
6$ErrorActionPreference = "Stop"
6$ErrorActionPreference = "Stop"
7$Root = Split-Path -Parent $PSScriptRoot
7$Root = Split-Path -Parent $PSScriptRoot
8Set-Location $Root
8Set-Location $Root
9
9
10Write-Host "Building posprint for Windows (x64)..."
10Write-Host "Building posprint for Windows (x64)..."
11
11
12if (-not $SkipTests) {
12if (-not $SkipTests) {
13 cargo test
13 cargo test
14 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
14 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
15}
15}
16
16
17cargo build --release
17cargo build --release
18if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
18if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
19
19
20$exe = Join-Path $Root "target\release\posprint.exe"
20$exe = Join-Path $Root "target\release\posprint.exe"
21if (-not (Test-Path $exe)) {
21if (-not (Test-Path $exe)) {
22 Write-Error "Build failed: $exe not found"
22 Write-Error "Build failed: $exe not found"
23}
23}
24
24
25Write-Host "OK: $exe"
25Write-Host "OK: $exe"
26Get-Item $exe | Select-Object FullName, Length, LastWriteTime
26Get-Item $exe | Select-Object FullName, Length, LastWriteTime
src/datetime.rs +4 −0
@@ -70,6 +70,10 @@ fn datetime_to_tm(dt: &chrono::DateTime<Local>) -> tm {
70 70 tm_wday: dt.weekday().num_days_from_sunday() as i32,
71 71 tm_yday: 0,
72 72 tm_isdst: -1,
73 #[cfg(unix)]
74 tm_gmtoff: dt.offset().local_minus_utc() as libc::c_long,
75 #[cfg(unix)]
76 tm_zone: std::ptr::null(),
73 77 }
74 78 }
75 79
@@ -70,6 +70,10 @@ fn datetime_to_tm(dt: &chrono::DateTime<Local>) -> tm {
70 tm_wday: dt.weekday().num_days_from_sunday() as i32,
70 tm_wday: dt.weekday().num_days_from_sunday() as i32,
71 tm_yday: 0,
71 tm_yday: 0,
72 tm_isdst: -1,
72 tm_isdst: -1,
73 #[cfg(unix)]
74 tm_gmtoff: dt.offset().local_minus_utc() as libc::c_long,
75 #[cfg(unix)]
76 tm_zone: std::ptr::null(),
73 }
77 }
74}
78}
75
79