diff --git a/include/ptouch.h b/include/ptouch.h index a2b33c7..bb199be 100644 --- a/include/ptouch.h +++ b/include/ptouch.h @@ -57,6 +57,11 @@ struct _pt_dev_info { int dpi; /* Dots per inch of the printhead */ //size_t bytes_per_line; int flags; + /* Pins to shift the print area from the centre of the printhead. + On some models the print area is not centred on the head; see the + Brother "Software Developer's Manual - Raster Command Reference, + PT-P900/P900W/P950NW", section 2.3.5 "Raster line". 0 = centred. */ + int pin_offset; }; typedef struct _pt_dev_info *pt_dev_info; diff --git a/src/libptouch.c b/src/libptouch.c index 5a3be8d..b710573 100644 --- a/src/libptouch.c +++ b/src/libptouch.c @@ -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; } } diff --git a/src/ptouch-print.c b/src/ptouch-print.c index 648c823..5a8e81c 100644 --- a/src/ptouch-print.c +++ b/src/ptouch-print.c @@ -186,7 +186,13 @@ int print_img(ptouch_dev ptdev, gdImage *im, int chain, int precut) return -1; } printf(_("image size (%ipx x %ipx)\n"), gdImageSX(im), gdImageSY(im)); - int offset = ((int)max_pixels / 2) - (gdImageSY(im)/2); /* always print centered */ + int offset = ((int)max_pixels / 2) - (gdImageSY(im)/2); /* center within the printhead */ + /* Some models do not center the print area on the printhead. pin_offset + is a fixed per-device shift (in pins/px, constant across tape widths) + that corrects for this; it is 0 where centering is already correct. + See the Brother "Software Developer's Manual - Raster Command + Reference, PT-P900/P900W/P950NW", section 2.3.5 "Raster line". */ + offset += ptdev->devinfo->pin_offset; printf("max_pixels=%ld, offset=%d\n", max_pixels, offset); if ((ptdev->devinfo->flags & FLAG_RASTER_PACKBITS) == FLAG_RASTER_PACKBITS) { if (arguments.debug) {