mirror of
https://git.familie-radermacher.ch/linux/ptouch-print.git
synced 2025-05-13 15:22:56 +00:00
Add support for PT-2300 and fix 112px width centering (thanks to Bradley Erickson)
This commit is contained in:
parent
aa5392bc13
commit
ec923ed579
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
libptouch - functions to help accessing a brother ptouch
|
libptouch - functions to help accessing a brother ptouch
|
||||||
|
|
||||||
Copyright (C) 2013-2023 Dominic Radermacher <dominic@familie-radermacher.ch>
|
Copyright (C) 2013-2025 Dominic Radermacher <dominic@familie-radermacher.ch>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
This program is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License version 3 as
|
under the terms of the GNU General Public License version 3 as
|
||||||
@ -45,9 +45,10 @@ struct _pt_tape_info tape_info[]= {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct _pt_dev_info ptdevs[] = {
|
struct _pt_dev_info ptdevs[] = {
|
||||||
|
{0x04f9, 0x2004, "PT-2300", 112, 180, FLAG_RASTER_PACKBITS|FLAG_HAS_PRECUT}, /* 180dpi, 112px printhead */
|
||||||
{0x04f9, 0x2007, "PT-2420PC", 128, 180, FLAG_RASTER_PACKBITS}, /* 180dpi, 128px, maximum tape width 24mm, must send TIFF compressed pixel data */
|
{0x04f9, 0x2007, "PT-2420PC", 128, 180, FLAG_RASTER_PACKBITS}, /* 180dpi, 128px, maximum tape width 24mm, must send TIFF compressed pixel data */
|
||||||
{0x04f9, 0x2011, "PT-2450PC", 128, 180, FLAG_RASTER_PACKBITS},
|
{0x04f9, 0x2011, "PT-2450PC", 128, 180, FLAG_RASTER_PACKBITS},
|
||||||
{0x04f9, 0x2019, "PT-1950", 128, 180, FLAG_RASTER_PACKBITS}, /* 180dpi, apparently 112px printhead ?, maximum tape width 18mm - unconfirmed if it works */
|
{0x04f9, 0x2019, "PT-1950", 112, 180, FLAG_RASTER_PACKBITS}, /* 180dpi, apparently 112px printhead ?, maximum tape width 18mm - unconfirmed if it works */
|
||||||
{0x04f9, 0x201f, "PT-2700", 128, 180, FLAG_HAS_PRECUT},
|
{0x04f9, 0x201f, "PT-2700", 128, 180, FLAG_HAS_PRECUT},
|
||||||
{0x04f9, 0x202c, "PT-1230PC", 128, 180, FLAG_NONE}, /* 180dpi, supports tapes up to 12mm - I don't know how much pixels it can print! */
|
{0x04f9, 0x202c, "PT-1230PC", 128, 180, FLAG_NONE}, /* 180dpi, supports tapes up to 12mm - I don't know how much pixels it can print! */
|
||||||
/* Notes about the PT-1230PC: While it is true that this printer supports
|
/* Notes about the PT-1230PC: While it is true that this printer supports
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
ptouch-print - Print labels with images or text on a Brother P-Touch
|
ptouch-print - Print labels with images or text on a Brother P-Touch
|
||||||
|
|
||||||
Copyright (C) 2015-2024 Dominic Radermacher <dominic@familie-radermacher.ch>
|
Copyright (C) 2015-2025 Dominic Radermacher <dominic@familie-radermacher.ch>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
This program is free software; you can redistribute it and/or modify it
|
||||||
under the terms of the GNU General Public License version 3 as
|
under the terms of the GNU General Public License version 3 as
|
||||||
@ -67,7 +67,7 @@ void rasterline_setpixel(uint8_t* rasterline, size_t size, int pixel)
|
|||||||
{
|
{
|
||||||
// TODO: pixel should be unsigned, since we can't have negative
|
// TODO: pixel should be unsigned, since we can't have negative
|
||||||
// if (pixel > ptdev->devinfo->device_max_px) {
|
// if (pixel > ptdev->devinfo->device_max_px) {
|
||||||
if (pixel > (int)(size*8)) {
|
if ((pixel < 0) || (pixel >= (int)(size*8))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rasterline[(size-1)-(pixel/8)] |= (uint8_t)(1<<(pixel%8));
|
rasterline[(size-1)-(pixel/8)] |= (uint8_t)(1<<(pixel%8));
|
||||||
@ -91,7 +91,7 @@ int print_img(ptouch_dev ptdev, gdImage *im, int chain)
|
|||||||
printf(_("maximum printing width for this tape is %ipx\n"), tape_width);
|
printf(_("maximum printing width for this tape is %ipx\n"), tape_width);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//offset=64-(gdImageSY(im)/2); /* always print centered */
|
printf(_("image size (%ipx x %ipx)\n"), gdImageSX(im), gdImageSY(im));
|
||||||
size_t max_pixels=ptouch_get_max_width(ptdev);
|
size_t max_pixels=ptouch_get_max_width(ptdev);
|
||||||
offset=((int)max_pixels / 2)-(gdImageSY(im)/2); /* always print centered */
|
offset=((int)max_pixels / 2)-(gdImageSY(im)/2); /* always print centered */
|
||||||
printf("max_pixels=%ld, offset=%d\n", max_pixels, offset);
|
printf("max_pixels=%ld, offset=%d\n", max_pixels, offset);
|
||||||
@ -136,7 +136,7 @@ int print_img(ptouch_dev ptdev, gdImage *im, int chain)
|
|||||||
rasterline_setpixel(rasterline, sizeof(rasterline), offset+i);
|
rasterline_setpixel(rasterline, sizeof(rasterline), offset+i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ptouch_sendraster(ptdev, rasterline, 16) != 0) {
|
if (ptouch_sendraster(ptdev, rasterline, (ptdev->devinfo->max_px / 8)) != 0) {
|
||||||
printf(_("ptouch_sendraster() failed\n"));
|
printf(_("ptouch_sendraster() failed\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# Enable non-root access for known ptouch printers
|
# Enable non-root access for known ptouch printers
|
||||||
|
SUBSYSTEM == "usb", ATTRS{idVendor} == "04f9", ATTRS{idProduct} == "2004", MODE="0660", TAG+="uaccess"
|
||||||
SUBSYSTEM == "usb", ATTRS{idVendor} == "04f9", ATTRS{idProduct} == "2007", MODE="0660", TAG+="uaccess"
|
SUBSYSTEM == "usb", ATTRS{idVendor} == "04f9", ATTRS{idProduct} == "2007", MODE="0660", TAG+="uaccess"
|
||||||
SUBSYSTEM == "usb", ATTRS{idVendor} == "04f9", ATTRS{idProduct} == "2011", MODE="0660", TAG+="uaccess"
|
SUBSYSTEM == "usb", ATTRS{idVendor} == "04f9", ATTRS{idProduct} == "2011", MODE="0660", TAG+="uaccess"
|
||||||
SUBSYSTEM == "usb", ATTRS{idVendor} == "04f9", ATTRS{idProduct} == "2019", MODE="0660", TAG+="uaccess"
|
SUBSYSTEM == "usb", ATTRS{idVendor} == "04f9", ATTRS{idProduct} == "2019", MODE="0660", TAG+="uaccess"
|
||||||
|
Loading…
Reference in New Issue
Block a user