mirror of
https://git.familie-radermacher.ch/linux/ptouch-print.git
synced 2025-06-28 03:57:02 +00:00
added arg --pad <n> to work around printers that require some padding (blank tape)
This commit is contained in:
parent
a32e645d79
commit
5c6df164c3
@ -339,6 +339,21 @@ gdImage *img_cutmark(int tape_width)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gdImage *img_padding(int tape_width, int length)
|
||||||
|
{
|
||||||
|
gdImage *out=NULL;
|
||||||
|
|
||||||
|
if ((length < 1) || (length > 256)) {
|
||||||
|
length=1;
|
||||||
|
}
|
||||||
|
out=gdImageCreatePalette(length, tape_width);
|
||||||
|
if (out == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
gdImageColorAllocate(out, 255, 255, 255);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
void usage(char *progname)
|
void usage(char *progname)
|
||||||
{
|
{
|
||||||
printf("usage: %s [options] <print-command(s)>\n", progname);
|
printf("usage: %s [options] <print-command(s)>\n", progname);
|
||||||
@ -353,6 +368,7 @@ void usage(char *progname)
|
|||||||
printf("\t\t\t\tIf the text contains spaces, use quotation marks\n\t\t\t\taround it.\n");
|
printf("\t\t\t\tIf the text contains spaces, use quotation marks\n\t\t\t\taround it.\n");
|
||||||
printf("\t--cutmark\t\tPrint a mark where the tape should be cut\n");
|
printf("\t--cutmark\t\tPrint a mark where the tape should be cut\n");
|
||||||
printf("\t--fontsize\t\tManually set fontsize\n");
|
printf("\t--fontsize\t\tManually set fontsize\n");
|
||||||
|
printf("\t--pad <n>\t\tAdd n pixels padding (blank tape)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,6 +411,12 @@ int parse_args(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
}
|
}
|
||||||
|
} else if (strcmp(&argv[i][1], "-pad") == 0) {
|
||||||
|
if (i+1<argc) {
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
usage(argv[0]);
|
||||||
|
}
|
||||||
} else if (strcmp(&argv[i][1], "-text") == 0) {
|
} else if (strcmp(&argv[i][1], "-text") == 0) {
|
||||||
for (lines=0; (lines < MAX_LINES) && (i < argc); lines++) {
|
for (lines=0; (lines < MAX_LINES) && (i < argc); lines++) {
|
||||||
if ((i+1 >= argc) || (argv[i+1][0] == '-')) {
|
if ((i+1 >= argc) || (argv[i+1][0] == '-')) {
|
||||||
@ -495,6 +517,12 @@ int main(int argc, char *argv[])
|
|||||||
out=img_append(out, im);
|
out=img_append(out, im);
|
||||||
gdImageDestroy(im);
|
gdImageDestroy(im);
|
||||||
im = NULL;
|
im = NULL;
|
||||||
|
} else if (strcmp(&argv[i][1], "-pad") == 0) {
|
||||||
|
int length=strtol(argv[++i], NULL, 10);
|
||||||
|
im=img_padding(tape_width, length);
|
||||||
|
out=img_append(out, im);
|
||||||
|
gdImageDestroy(im);
|
||||||
|
im = NULL;
|
||||||
} else if (strcmp(&argv[i][1], "-debug") == 0) {
|
} else if (strcmp(&argv[i][1], "-debug") == 0) {
|
||||||
debug = true;
|
debug = true;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user