154 Commits
Author SHA1 Message Date
Dominic Radermacher f7cce68609 fix compile warnings about missing field initializer 2026-07-18 08:07:42 +02:00
Tobias KlausmannandDominic Radermacher 921206cd5f print_img: correct off-center print area via per-device pin_offset
On the PT-P900W the print area is not centered on the 560-pin printhead:
its center sits at pin 272 rather than the head center (pin 280), a fixed
8-pin offset that is constant across all tape widths. Centering the raster
data on the head therefore prints ~0.5mm off-center (measured as a constant
~1mm margin delta across 12/18/36mm tapes, confirmed against the spec).

Add a pin_offset field to _pt_dev_info (0 = centered, the default for all
existing printers) and apply it in print_img. Set it to -8 for the
PT-P900Wc, which reproduces the spec left-margin exactly for every tape
width ((560-print_area)/2 - 8 = documented left margin).

Reference: Brother "Software Developer's Manual - Raster Command Reference,
PT-P900/P900W/P950NW", section 2.3.5 "Raster line" (per-tape left/right
margin and print-area pin counts for the 560-pin head).
https://download.brother.com/welcome/docp100407/cv_ptp900_eng_raster_102.pdf
2026-07-18 08:01:24 +02:00
Tobias KlausmannandDominic Radermacher 9af6276135 add support for PT-P900Wc (04f9:2085, 360dpi, 36mm)
Add the PT-P900Wc with a 560px printhead and 360dpi resolution, using the
P700 init sequence, PackBits raster, the print-information command and
precut support. Verified printing on 36mm laminated tape.

The existing 360dpi handling doubled the 180dpi tape widths, which is wrong
for wide tapes: the 180dpi values are clamped by those printers' 128-pin
printheads, not the true printable area. Add a separate px360 column with
Brother's documented print areas (36mm = 454px, confirmed on hardware; the
narrower widths are from the raster reference and untested) and clamp the
result to max_px so 360dpi printers with a narrower head (PT-9200DX) stay
safe.

Also add the udev uaccess rule for 2085.
2026-07-18 07:56:55 +02:00
Tobias KlausmannandDominic Radermacher c8ce56e054 libptouch: fix stack buffer overflow in ptouch_sendraster
The raster packet buffer was fixed at 64 bytes, but a full raster line is
max_px/8 bytes plus up to 4 header bytes. For printers with a printhead
wider than 480px this overflows the buffer and smashes the stack. No
previously supported printer was wide enough to trigger it (the widest,
PT-9200DX at 384px, needs 52 bytes), but a 560px printhead needs 74.

Size the buffer to 128 bytes, which is the maximum a single packet can be
since ptouch_send() caps transfers at 128 bytes.
2026-07-18 07:52:44 +02:00
Dominic Radermacher 5cf946bf43 add udev rules for some missing printers 2026-04-20 07:30:44 +02:00
Dominic Radermacher 57084a30e6 improve support for 360dpi printers (untested) 2026-03-09 08:01:30 +01:00
Dominic Radermacher 9cd8a5bc22 preparing for support of printers with 360 dpi 2026-03-08 10:26:46 +01:00
Pascal de BruijnandDominic Radermacher 25e7a8c876 write_png: show physical output size 2026-03-08 09:30:59 +01:00
Pascal de BruijnandDominic Radermacher cb76f2ae75 set output PNG resolution to 180 2026-03-08 09:29:16 +01:00
Pascal de BruijnandDominic Radermacher 245aa4aad0 add fontmargin to manual page 2026-03-08 09:28:09 +01:00
Pascal de BruijnandDominic Radermacher 0db6ba4477 add missing break introduced in c489e026971d00f5616a4f3c87c10dfb40b7d2b9 2026-03-08 09:27:41 +01:00
Pascal de BruijnandDominic Radermacher 5e5e833bcd gdImageStringFT_180dpi wrapper 2026-03-08 09:26:49 +01:00
Pascal de BruijnandDominic Radermacher c08a456bfd find_fontsize: always account for common ascenders and descenders 2026-03-08 09:25:30 +01:00
Pascal de BruijnandDominic Radermacher 2d4ffd6112 implement font margin 2026-03-08 09:24:14 +01:00
Pascal de BruijnandDominic Radermacher 118afc7694 get_baselineoffset: rounded letters are usually not on the baseline 2026-03-08 09:22:40 +01:00
Dominic Radermacher 76c419f952 Add support for using \n for new line (thanks to github.com/probonopd/) v1.8 2026-03-06 08:20:32 +01:00
Dominic Radermacher bdd724fef5 added PT-9200DX with different entry (thanks to Christian Pauls) 2026-02-27 07:50:15 +01:00
Dominic Radermacher 3e026ef26b fix strange output when calling ptouch-print --help multiple times 2026-01-23 08:12:51 +01:00
Ed MasteandDominic Radermacher 5cbc680f63 Use CMake-argp to find agrp include and library paths
On at least FreeBSD argp is a separate library that needs to have its
path specified in order to link.
2025-12-15 07:15:21 +01:00
Ed MasteandDominic Radermacher 7ef61111bc Import CMake-argp
From https://github.com/alehaa/CMake-argp at commit 5523dc6b7de7.
2025-12-15 07:15:10 +01:00
Dominic Radermacher fd526f9dbe add param --align for aligning multi-line text centered or right-aligned 2025-12-08 15:33:06 +01:00
Jonas KonradandDominic Radermacher d2a3bac46e Add command line flag for toggling precut For devices that support cutting before the current label ("precut"), change the default to no precut and add a command line flag to turn it on.
Odd behavior in testing with my PT-H500: When printing with precut, and then printing the next label without precut, the next label still gets a precut. i.e. the label with the precut flag gets cut on both ends, even if the next label does not have this flag. The label after that works as expected.

I'm unsure if this is printer behavior or if it could be resolved by sending additional commands somehow (maybe resetting the flag).
2025-12-01 20:35:45 +01:00
Jonas KonradandDominic Radermacher c2b607be7c Enable pre-cut for PT-H500 2025-12-01 19:38:37 +01:00
Michael RichterandDominic Radermacher 7509ef765c Add support for HSe-251E (heatshrink-tube) tapes 2025-12-01 19:35:59 +01:00
Dominic Radermacher b3ab878bfb updated translation files 2025-11-02 12:56:16 +01:00
Dominic Radermacher a27a320672 add PT-E560BT (thanks to Paul-Kenji Cahier) 2025-10-31 08:04:08 +01:00
Markus SchrammaandDominic Radermacher d8a4ed71e2 add --timeout option 2025-09-28 08:05:41 +02:00
Dominic Radermacher e730c3b480 better help text for newline arg, rename build script v1.7 2025-08-11 15:09:36 +02:00
Dominic Radermacher d293e9427d coding style cosmetics 2025-08-11 09:57:02 +02:00
Michael SchulzandDominic Radermacher 92c1e43f0c improved argv parser, enable printing of text starting with a dash 2025-08-11 09:49:18 +02:00
Dominic Radermacher 3bcde60eea update po files 2025-08-10 08:28:40 +02:00
FrostandDominic Radermacher f1c34dd0d4 Send chain magic after precut
This lets you do chain mode with a precut first.
2025-08-10 08:23:56 +02:00
FrostandDominic Radermacher f59e19349b Print without the default length margins
Brother's software may default to 0x0e, but that probably assumes you're making text labels and not printing images. For printing images you might want borderless (we certainly do), and for text labels you can always add the margins to the label before printing.

This commit uses 1px length margins instead of 0 to prevent some leftover black on the edges of the next print.
2025-08-10 08:22:39 +02:00
Dominic Radermacher ab80c721f6 fix compile warning 2025-08-10 07:23:11 +02:00
Dominic Radermacher d7d97eede8 fix gettext.cmake 2025-08-03 14:21:56 +02:00
Dominic Radermacher d1eeacbdd8 Added USB IDs for PT-E550W, but doesn't work yet (only prints empty tape) 2025-08-03 10:11:15 +02:00
Dominic Radermacher efa48162a8 better gettext support (thanks to Michael Schulz) 2025-08-03 09:42:30 +02:00
Dominic Radermacher 1f450d9124 Add support for PT-E310BT (thanks to Christian Radin) 2025-06-22 08:13:08 +02:00
Marcus MüllerandDominic Radermacher 1a39fe1284 udev uaccess rules must have lower order than 73-seat-late.rules
see, for example, https://github.com/bigbigmdm/IMSProg/issues/98 . If the rule granting uaccess tag to a device is loaded after the seat-late rule, seat-late can't grant the user access to the device.

Signed-off-by: Marcus Müller <mueller@baseband.digital>
2025-06-01 20:15:29 +02:00
Dominic Radermacher 2c9828af87 add support for PT-9200DX, thanks Ralf Lieb for reporting 2025-06-01 20:12:20 +02:00
Dominic Radermacher 2f18522602 fix segfault for last commit 2025-05-19 13:33:55 +02:00
Dominic Radermacher 140bf0a6cc for printers with less than 128px printhead, make sure we dont print too much pixels 2025-05-12 18:29:56 +02:00
Dominic Radermacher a6c67df2c9 cosmetics 2025-05-12 17:59:45 +02:00
Dominic Radermacher ec923ed579 Add support for PT-2300 and fix 112px width centering (thanks to Bradley Erickson) 2025-05-12 17:47:00 +02:00
Nico SonackandDominic Radermacher aa5392bc13 zero-initialise array to silence valgrind v1.6 2024-10-29 20:21:48 +01:00
Dominic Radermacher 740b20e150 Add --copies switch for multiple printouts (thanks to Wojciech Fred) 2024-10-06 17:46:29 +02:00
Jan BaierandDominic Radermacher bc7d32a6e6 Fix segfault when using --force-tape-width without printer
When force_tape_width is *not* used it is expected to open/close the usb
device.
2024-08-15 09:44:19 +02:00
Didi KohenandDominic Radermacher 9cae7f465b improve udev rules 2024-08-11 13:53:05 +02:00
Dominic Radermacher 9a0ef8c7d6 Fix chain print support for the D460BT family (thanks to Guilherme Espada) 2024-08-11 13:31:20 +02:00
Dominic Radermacher b904e22cf1 Add --force-tape-with, enables use of --writepng without the need of a printer connected (thanks to Didi Kohen) 2024-08-11 13:15:22 +02:00