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
This commit is contained in:
Tobias Klausmann
2026-07-18 08:01:24 +02:00
committed by Dominic Radermacher
parent 9af6276135
commit 921206cd5f
3 changed files with 19 additions and 3 deletions
+7 -2
View File
@@ -89,10 +89,14 @@ struct _pt_dev_info ptdevs[] = {
{0x04f9, 0x2074, "PT-D600", 128, 180, FLAG_RASTER_PACKBITS},
/* PT-D600 was reported to work, but with some quirks (premature
cutting of tape, printing maximum of 73mm length) */
{0x04f9, 0x2085, "PT-P900Wc", 560, 360, FLAG_RASTER_PACKBITS|FLAG_P700_INIT|FLAG_USE_INFO_CMD|FLAG_HAS_PRECUT},
{0x04f9, 0x2085, "PT-P900Wc", 560, 360, FLAG_RASTER_PACKBITS|FLAG_P700_INIT|FLAG_USE_INFO_CMD|FLAG_HAS_PRECUT, -8},
/* PT-P900Wc: 360dpi, 560px printhead (70 bytes/raster line). Verified
printing on 36mm laminated tape. Narrower tape widths use Brother's
documented 360dpi print areas (see tape_info) but are untested. */
documented 360dpi print areas (see tape_info) but are untested.
pin_offset = -8: the print area is centred at pin 272, not the head
centre (pin 280) - a constant offset across all tape widths. See the
Brother "Software Developer's Manual - Raster Command Reference,
PT-P900/P900W/P950NW", section 2.3.5 "Raster line". */
{0x04f9, 0x20af, "PT-P710BT", 128, 180, FLAG_RASTER_PACKBITS|FLAG_HAS_PRECUT},
{0x04f9, 0x20df, "PT-D410", 128, 180, FLAG_USE_INFO_CMD|FLAG_HAS_PRECUT|FLAG_D460BT_MAGIC},
{0x04f9, 0x20e0, "PT-D460BT", 128, 180, FLAG_P700_INIT|FLAG_USE_INFO_CMD|FLAG_HAS_PRECUT|FLAG_D460BT_MAGIC},
@@ -175,6 +179,7 @@ int ptouch_open(ptouch_dev *ptdev)
(*ptdev)->devinfo->dpi=ptdevs[k].dpi;
(*ptdev)->devinfo->max_px=ptdevs[k].max_px;
(*ptdev)->devinfo->flags=ptdevs[k].flags;
(*ptdev)->devinfo->pin_offset=ptdevs[k].pin_offset;
return 0;
}
}