1
0
mirror of https://git.familie-radermacher.ch/linux/ptouch-print.git synced 2026-04-06 02:42:21 +00:00

preparing for support of printers with 360 dpi

This commit is contained in:
Dominic Radermacher
2026-03-08 10:26:46 +01:00
parent 25e7a8c876
commit 9cd8a5bc22
6 changed files with 278 additions and 135 deletions

View File

@@ -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-2023 Dominic Radermacher <dominic@familie-radermacher.ch> Copyright (C) 2015-2026 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
@@ -102,8 +102,10 @@ int ptouch_send(ptouch_dev ptdev, uint8_t *data, size_t len);
int ptouch_init(ptouch_dev ptdev); int ptouch_init(ptouch_dev ptdev);
int ptouch_lf(ptouch_dev ptdev); int ptouch_lf(ptouch_dev ptdev);
int ptouch_ff(ptouch_dev ptdev); int ptouch_ff(ptouch_dev ptdev);
int ptouch_get_dpi(ptouch_dev ptdev);
size_t ptouch_get_max_width(ptouch_dev ptdev); size_t ptouch_get_max_width(ptouch_dev ptdev);
size_t ptouch_get_tape_width(ptouch_dev ptdev); size_t ptouch_get_tape_width(ptouch_dev ptdev);
int ptouch_get_max_lines(ptouch_dev ptdev, int fontsize_px);
int ptouch_page_flags(ptouch_dev ptdev, uint8_t page_flags); int ptouch_page_flags(ptouch_dev ptdev, uint8_t page_flags);
int ptouch_finalize(ptouch_dev ptdev, int chain); int ptouch_finalize(ptouch_dev ptdev, int chain);
int ptouch_getstatus(ptouch_dev ptdev, int timeout); int ptouch_getstatus(ptouch_dev ptdev, int timeout);

123
po/de.po
View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ptouch-print 1.7\n" "Project-Id-Version: ptouch-print 1.7\n"
"Report-Msgid-Bugs-To: dominic@familie-radermacher.ch\n" "Report-Msgid-Bugs-To: dominic@familie-radermacher.ch\n"
"POT-Creation-Date: 2026-03-06 08:07+0100\n" "POT-Creation-Date: 2026-03-08 10:22+0100\n"
"PO-Revision-Date: 2024-05-23 22:27-0400\n" "PO-Revision-Date: 2024-05-23 22:27-0400\n"
"Last-Translator: dominic@familie-radermacher.ch\n" "Last-Translator: dominic@familie-radermacher.ch\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n" "Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
@@ -100,7 +100,7 @@ msgstr ""
msgid "debug: called ptouch_getstatus() with NULL ptdev\n" msgid "debug: called ptouch_getstatus() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:369 src/libptouch.c:405 #: src/libptouch.c:369 src/libptouch.c:407
#, c-format #, c-format
msgid "read error: %s\n" msgid "read error: %s\n"
msgstr "" msgstr ""
@@ -110,194 +110,229 @@ msgstr ""
msgid "timeout (%i sec) while waiting for status response\n" msgid "timeout (%i sec) while waiting for status response\n"
msgstr "" msgstr ""
#: src/libptouch.c:388 #: src/libptouch.c:390
#, c-format #, c-format
msgid "unknown tape width of %imm, please report this.\n" msgid "unknown tape width of %imm, please report this.\n"
msgstr "Unbekannte Schriftband breite (%i mm), bitte melden\n" msgstr "Unbekannte Schriftband breite (%i mm), bitte melden\n"
#: src/libptouch.c:394 #: src/libptouch.c:396
#, c-format #, c-format
msgid "got only 16 bytes... wondering what they are:\n" msgid "got only 16 bytes... wondering what they are:\n"
msgstr "nur 16 bytes empfangen... mal gucken was die sind:\n" msgstr "nur 16 bytes empfangen... mal gucken was die sind:\n"
#: src/libptouch.c:398 #: src/libptouch.c:400
#, c-format #, c-format
msgid "read error: got %i instead of 32 bytes\n" msgid "read error: got %i instead of 32 bytes\n"
msgstr "Lesefehler: %i anstatt 32 bytes empfangen\n" msgstr "Lesefehler: %i anstatt 32 bytes empfangen\n"
#: src/libptouch.c:401 #: src/libptouch.c:403
#, c-format #, c-format
msgid "strange status:\n" msgid "strange status:\n"
msgstr "Seltsamer Status:\n" msgstr "Seltsamer Status:\n"
#: src/libptouch.c:403 #: src/libptouch.c:405
#, c-format #, c-format
msgid "trying to flush junk\n" msgid "trying to flush junk\n"
msgstr "" msgstr ""
#: src/libptouch.c:408 #: src/libptouch.c:410
#, c-format #, c-format
msgid "got another %i bytes. now try again\n" msgid "got another %i bytes. now try again\n"
msgstr "weitere %i bytes empfangen. probiere es nochmal.\n" msgstr "weitere %i bytes empfangen. probiere es nochmal.\n"
#: src/libptouch.c:415 #: src/libptouch.c:417
#, fuzzy, c-format
msgid "debug: called ptouch_get_dpi() with NULL ptdev\n"
msgstr "ptouch_rasterstart() fehlgeschlagen\n"
#: src/libptouch.c:430
#, fuzzy, c-format
msgid "debug: called ptouch_get_max_lines() with NULL ptdev\n"
msgstr "ptouch_rasterstart() fehlgeschlagen\n"
#: src/libptouch.c:434
#, fuzzy, c-format
msgid "debug: called ptouch_get_max_lines() with invalid fontsize_px\n"
msgstr "ptouch_rasterstart() fehlgeschlagen\n"
#: src/libptouch.c:437
#, c-format
msgid "debug: calculated max lines %d \n"
msgstr ""
#: src/libptouch.c:444
#, c-format #, c-format
msgid "debug: called ptouch_get_tape_width() with NULL ptdev\n" msgid "debug: called ptouch_get_tape_width() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:424 #: src/libptouch.c:453
#, c-format #, c-format
msgid "debug: called ptouch_get_max_width() with NULL ptdev\n" msgid "debug: called ptouch_get_max_width() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:436 #: src/libptouch.c:465
#, c-format #, c-format
msgid "debug: called ptouch_sendraster() with NULL ptdev\n" msgid "debug: called ptouch_sendraster() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:153 #: src/ptouch-print.c:174
#, c-format #, c-format
msgid "nothing to print\n" msgid "nothing to print\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:161 #: src/ptouch-print.c:182
#, c-format #, c-format
msgid "image is too large (%ipx x %ipx)\n" msgid "image is too large (%ipx x %ipx)\n"
msgstr "Bild ist zu gross (%ipx x %ipx)\n" msgstr "Bild ist zu gross (%ipx x %ipx)\n"
#: src/ptouch-print.c:162 #: src/ptouch-print.c:183
#, c-format #, c-format
msgid "maximum printing width for this tape is %ipx\n" msgid "maximum printing width for this tape is %ipx\n"
msgstr "Maximal druckbare Breite für dieses Schriftband sind %ipx\n" msgstr "Maximal druckbare Breite für dieses Schriftband sind %ipx\n"
#: src/ptouch-print.c:165 #: src/ptouch-print.c:186
#, fuzzy, c-format #, fuzzy, c-format
msgid "image size (%ipx x %ipx)\n" msgid "image size (%ipx x %ipx)\n"
msgstr "Bild ist zu gross (%ipx x %ipx)\n" msgstr "Bild ist zu gross (%ipx x %ipx)\n"
#: src/ptouch-print.c:175 #: src/ptouch-print.c:196
#, c-format #, c-format
msgid "ptouch_rasterstart() failed\n" msgid "ptouch_rasterstart() failed\n"
msgstr "ptouch_rasterstart() fehlgeschlagen\n" msgstr "ptouch_rasterstart() fehlgeschlagen\n"
#: src/ptouch-print.c:181 #: src/ptouch-print.c:202
#, c-format #, c-format
msgid "send print information command\n" msgid "send print information command\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:187 #: src/ptouch-print.c:208
#, c-format #, c-format
msgid "send PT-D460BT magic commands\n" msgid "send PT-D460BT magic commands\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:194 #: src/ptouch-print.c:215
#, c-format #, c-format
msgid "send precut command\n" msgid "send precut command\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:203 #: src/ptouch-print.c:224
#, c-format #, c-format
msgid "send PT-D460BT chain commands\n" msgid "send PT-D460BT chain commands\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:215 #: src/ptouch-print.c:236
#, fuzzy, c-format #, fuzzy, c-format
msgid "ptouch_sendraster() failed\n" msgid "ptouch_sendraster() failed\n"
msgstr "ptouch_send() fehlgeschlagen\n" msgstr "ptouch_send() fehlgeschlagen\n"
#: src/ptouch-print.c:264 #: src/ptouch-print.c:285
#, c-format #, c-format
msgid "writing image '%s' failed\n" msgid "writing image '%s' failed\n"
msgstr "Schreiben der Bilddatei '%s' fehlgeschlagen\n" msgstr "Schreiben der Bilddatei '%s' fehlgeschlagen\n"
#: src/ptouch-print.c:286 #: src/ptouch-print.c:291
#, c-format #, c-format
msgid "debug: o baseline offset - %d\n" msgid "printing '%s' requires %.1f mm of tape\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:287 #: src/ptouch-print.c:313
#, c-format
msgid "debug: z baseline offset - %d\n"
msgstr ""
#: src/ptouch-print.c:314
#, c-format #, c-format
msgid "debug: text baseline offset - %d\n" msgid "debug: text baseline offset - %d\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:346 #: src/ptouch-print.c:387
#, c-format #, c-format
msgid "render_text(): %i lines, font = '%s', align = '%c'\n" msgid "render_text(): %i lines, font = '%s', align = '%c'\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:349 #: src/ptouch-print.c:390
#, c-format #, c-format
msgid "warning: font config not available\n" msgid "warning: font config not available\n"
msgstr "Warnung: fontconfig ist nicht verfügbar\n" msgstr "Warnung: fontconfig ist nicht verfügbar\n"
#: src/ptouch-print.c:353 #: src/ptouch-print.c:394
#, c-format #, c-format
msgid "setting font size=%i\n" msgid "setting font size=%i\n"
msgstr "setze Zeichensatzgrösse=%i\n" msgstr "setze Zeichensatzgrösse=%i\n"
#: src/ptouch-print.c:357 #: src/ptouch-print.c:396
#, fuzzy, c-format
msgid "ignoring setting font margin=%i\n"
msgstr "setze Zeichensatzgrösse=%i\n"
#: src/ptouch-print.c:401
#, c-format #, c-format
msgid "could not estimate needed font size\n" msgid "could not estimate needed font size\n"
msgstr "Konnte die notwendige Zeichensatzgrösse nicht bestimmen\n" msgstr "Konnte die notwendige Zeichensatzgrösse nicht bestimmen\n"
#: src/ptouch-print.c:364 #: src/ptouch-print.c:408
#, c-format #, c-format
msgid "choosing font size=%i\n" msgid "choosing font size=%i\n"
msgstr "Wähle Zeichensatzgrösse %i\n" msgstr "Wähle Zeichensatzgrösse %i\n"
#: src/ptouch-print.c:380 src/ptouch-print.c:414 #: src/ptouch-print.c:424 src/ptouch-print.c:458
#, c-format #, fuzzy, c-format
msgid "error in gdImageStringFT: %s\n" msgid "error in gdImageStringFT_180dpi: %s\n"
msgstr "Fehler in Funktion gdImageStringFT(): %s\n" msgstr "Fehler in Funktion gdImageStringFT(): %s\n"
#: src/ptouch-print.c:571 #: src/ptouch-print.c:615
#, c-format #, c-format
msgid "Only up to %d lines are supported" msgid "Only up to %d lines are supported"
msgstr "" msgstr ""
#: src/ptouch-print.c:649 #: src/ptouch-print.c:696
msgid "No arguments supported" msgid "No arguments supported"
msgstr "" msgstr ""
#: src/ptouch-print.c:654 #: src/ptouch-print.c:701
msgid "Option --writepng missing" msgid "Option --writepng missing"
msgstr "" msgstr ""
#: src/ptouch-print.c:657 #: src/ptouch-print.c:704
msgid "Options --force_tape_width and --info can't be used together" msgid "Options --force_tape_width and --info can't be used together"
msgstr "" msgstr ""
#: src/ptouch-print.c:688 #: src/ptouch-print.c:735
#, c-format #, c-format
msgid "ptouch_init() failed\n" msgid "ptouch_init() failed\n"
msgstr "ptouch_init() fehlgeschlagen\n" msgstr "ptouch_init() fehlgeschlagen\n"
#: src/ptouch-print.c:691 #: src/ptouch-print.c:738
#, c-format #, c-format
msgid "ptouch_getstatus() failed\n" msgid "ptouch_getstatus() failed\n"
msgstr "ptouch_getstatus() fehlgeschlagen\n" msgstr "ptouch_getstatus() fehlgeschlagen\n"
#: src/ptouch-print.c:705 #: src/ptouch-print.c:752
#, c-format
msgid "printer has %d dpi\n"
msgstr ""
#: src/ptouch-print.c:753
#, fuzzy, c-format #, fuzzy, c-format
msgid "maximum printing width for this printer is %ldpx\n" msgid "maximum printing width for this printer is %ldpx\n"
msgstr "Maximal druckbare Breite für dieses Schriftband sind %ipx\n" msgstr "Maximal druckbare Breite für dieses Schriftband sind %ipx\n"
#: src/ptouch-print.c:706 #: src/ptouch-print.c:754
#, fuzzy, c-format #, fuzzy, c-format
msgid "maximum printing width for this tape is %ldpx\n" msgid "maximum printing width for this tape is %ldpx\n"
msgstr "Maximal druckbare Breite für dieses Schriftband sind %ipx\n" msgstr "Maximal druckbare Breite für dieses Schriftband sind %ipx\n"
#: src/ptouch-print.c:731 #: src/ptouch-print.c:779
#, c-format #, c-format
msgid "failed to load image file\n" msgid "failed to load image file\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:740 #: src/ptouch-print.c:788
#, c-format #, c-format
msgid "could not render text\n" msgid "could not render text\n"
msgstr "Konnte Text nicht rendern\n" msgstr "Konnte Text nicht rendern\n"
#: src/ptouch-print.c:779 #: src/ptouch-print.c:827
#, c-format #, c-format
msgid "ptouch_finalize(%d) failed\n" msgid "ptouch_finalize(%d) failed\n"
msgstr "ptouch_finalize(%d) fehlgeschlagen\n" msgstr "ptouch_finalize(%d) fehlgeschlagen\n"

123
po/en.po
View File

@@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ptouch-print 1.7\n" "Project-Id-Version: ptouch-print 1.7\n"
"Report-Msgid-Bugs-To: dominic@familie-radermacher.ch\n" "Report-Msgid-Bugs-To: dominic@familie-radermacher.ch\n"
"POT-Creation-Date: 2026-03-06 08:07+0100\n" "POT-Creation-Date: 2026-03-08 10:22+0100\n"
"PO-Revision-Date: 2024-05-23 22:26-0400\n" "PO-Revision-Date: 2024-05-23 22:26-0400\n"
"Last-Translator: dominic@familie-radermacher.ch\n" "Last-Translator: dominic@familie-radermacher.ch\n"
"Language-Team: English <en@translate.freefriends.org>\n" "Language-Team: English <en@translate.freefriends.org>\n"
@@ -100,7 +100,7 @@ msgstr "debug: dumping raw status bytes\n"
msgid "debug: called ptouch_getstatus() with NULL ptdev\n" msgid "debug: called ptouch_getstatus() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:369 src/libptouch.c:405 #: src/libptouch.c:369 src/libptouch.c:407
#, c-format #, c-format
msgid "read error: %s\n" msgid "read error: %s\n"
msgstr "read error: %s\n" msgstr "read error: %s\n"
@@ -110,194 +110,229 @@ msgstr "read error: %s\n"
msgid "timeout (%i sec) while waiting for status response\n" msgid "timeout (%i sec) while waiting for status response\n"
msgstr "timeout while waiting for status response\n" msgstr "timeout while waiting for status response\n"
#: src/libptouch.c:388 #: src/libptouch.c:390
#, c-format #, c-format
msgid "unknown tape width of %imm, please report this.\n" msgid "unknown tape width of %imm, please report this.\n"
msgstr "unknown tape width of %imm, please report this.\n" msgstr "unknown tape width of %imm, please report this.\n"
#: src/libptouch.c:394 #: src/libptouch.c:396
#, c-format #, c-format
msgid "got only 16 bytes... wondering what they are:\n" msgid "got only 16 bytes... wondering what they are:\n"
msgstr "got only 16 bytes... wondering what they are:\n" msgstr "got only 16 bytes... wondering what they are:\n"
#: src/libptouch.c:398 #: src/libptouch.c:400
#, c-format #, c-format
msgid "read error: got %i instead of 32 bytes\n" msgid "read error: got %i instead of 32 bytes\n"
msgstr "read error: got %i instead of 32 bytes\n" msgstr "read error: got %i instead of 32 bytes\n"
#: src/libptouch.c:401 #: src/libptouch.c:403
#, c-format #, c-format
msgid "strange status:\n" msgid "strange status:\n"
msgstr "strange status:\n" msgstr "strange status:\n"
#: src/libptouch.c:403 #: src/libptouch.c:405
#, c-format #, c-format
msgid "trying to flush junk\n" msgid "trying to flush junk\n"
msgstr "trying to flush junk\n" msgstr "trying to flush junk\n"
#: src/libptouch.c:408 #: src/libptouch.c:410
#, c-format #, c-format
msgid "got another %i bytes. now try again\n" msgid "got another %i bytes. now try again\n"
msgstr "got another %i bytes. now try again\n" msgstr "got another %i bytes. now try again\n"
#: src/libptouch.c:415 #: src/libptouch.c:417
#, fuzzy, c-format
msgid "debug: called ptouch_get_dpi() with NULL ptdev\n"
msgstr "ptouch_rasterstart() failed\n"
#: src/libptouch.c:430
#, fuzzy, c-format
msgid "debug: called ptouch_get_max_lines() with NULL ptdev\n"
msgstr "ptouch_rasterstart() failed\n"
#: src/libptouch.c:434
#, fuzzy, c-format
msgid "debug: called ptouch_get_max_lines() with invalid fontsize_px\n"
msgstr "ptouch_rasterstart() failed\n"
#: src/libptouch.c:437
#, c-format
msgid "debug: calculated max lines %d \n"
msgstr ""
#: src/libptouch.c:444
#, c-format #, c-format
msgid "debug: called ptouch_get_tape_width() with NULL ptdev\n" msgid "debug: called ptouch_get_tape_width() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:424 #: src/libptouch.c:453
#, c-format #, c-format
msgid "debug: called ptouch_get_max_width() with NULL ptdev\n" msgid "debug: called ptouch_get_max_width() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:436 #: src/libptouch.c:465
#, c-format #, c-format
msgid "debug: called ptouch_sendraster() with NULL ptdev\n" msgid "debug: called ptouch_sendraster() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:153 #: src/ptouch-print.c:174
#, c-format #, c-format
msgid "nothing to print\n" msgid "nothing to print\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:161 #: src/ptouch-print.c:182
#, c-format #, c-format
msgid "image is too large (%ipx x %ipx)\n" msgid "image is too large (%ipx x %ipx)\n"
msgstr "image is too large (%ipx x %ipx)\n" msgstr "image is too large (%ipx x %ipx)\n"
#: src/ptouch-print.c:162 #: src/ptouch-print.c:183
#, c-format #, c-format
msgid "maximum printing width for this tape is %ipx\n" msgid "maximum printing width for this tape is %ipx\n"
msgstr "maximum printing width for this tape is %ipx\n" msgstr "maximum printing width for this tape is %ipx\n"
#: src/ptouch-print.c:165 #: src/ptouch-print.c:186
#, fuzzy, c-format #, fuzzy, c-format
msgid "image size (%ipx x %ipx)\n" msgid "image size (%ipx x %ipx)\n"
msgstr "image is too large (%ipx x %ipx)\n" msgstr "image is too large (%ipx x %ipx)\n"
#: src/ptouch-print.c:175 #: src/ptouch-print.c:196
#, c-format #, c-format
msgid "ptouch_rasterstart() failed\n" msgid "ptouch_rasterstart() failed\n"
msgstr "ptouch_rasterstart() failed\n" msgstr "ptouch_rasterstart() failed\n"
#: src/ptouch-print.c:181 #: src/ptouch-print.c:202
#, c-format #, c-format
msgid "send print information command\n" msgid "send print information command\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:187 #: src/ptouch-print.c:208
#, c-format #, c-format
msgid "send PT-D460BT magic commands\n" msgid "send PT-D460BT magic commands\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:194 #: src/ptouch-print.c:215
#, c-format #, c-format
msgid "send precut command\n" msgid "send precut command\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:203 #: src/ptouch-print.c:224
#, c-format #, c-format
msgid "send PT-D460BT chain commands\n" msgid "send PT-D460BT chain commands\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:215 #: src/ptouch-print.c:236
#, c-format #, c-format
msgid "ptouch_sendraster() failed\n" msgid "ptouch_sendraster() failed\n"
msgstr "ptouch_sendraster() failed\n" msgstr "ptouch_sendraster() failed\n"
#: src/ptouch-print.c:264 #: src/ptouch-print.c:285
#, c-format #, c-format
msgid "writing image '%s' failed\n" msgid "writing image '%s' failed\n"
msgstr "writing image '%s' failed\n" msgstr "writing image '%s' failed\n"
#: src/ptouch-print.c:286 #: src/ptouch-print.c:291
#, c-format #, c-format
msgid "debug: o baseline offset - %d\n" msgid "printing '%s' requires %.1f mm of tape\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:287 #: src/ptouch-print.c:313
#, c-format
msgid "debug: z baseline offset - %d\n"
msgstr ""
#: src/ptouch-print.c:314
#, c-format #, c-format
msgid "debug: text baseline offset - %d\n" msgid "debug: text baseline offset - %d\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:346 #: src/ptouch-print.c:387
#, c-format #, c-format
msgid "render_text(): %i lines, font = '%s', align = '%c'\n" msgid "render_text(): %i lines, font = '%s', align = '%c'\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:349 #: src/ptouch-print.c:390
#, c-format #, c-format
msgid "warning: font config not available\n" msgid "warning: font config not available\n"
msgstr "warning: font config not available\n" msgstr "warning: font config not available\n"
#: src/ptouch-print.c:353 #: src/ptouch-print.c:394
#, c-format #, c-format
msgid "setting font size=%i\n" msgid "setting font size=%i\n"
msgstr "setting font size=%i\n" msgstr "setting font size=%i\n"
#: src/ptouch-print.c:357 #: src/ptouch-print.c:396
#, fuzzy, c-format
msgid "ignoring setting font margin=%i\n"
msgstr "setting font size=%i\n"
#: src/ptouch-print.c:401
#, c-format #, c-format
msgid "could not estimate needed font size\n" msgid "could not estimate needed font size\n"
msgstr "could not estimate needed font size\n" msgstr "could not estimate needed font size\n"
#: src/ptouch-print.c:364 #: src/ptouch-print.c:408
#, c-format #, c-format
msgid "choosing font size=%i\n" msgid "choosing font size=%i\n"
msgstr "choosing font size=%i\n" msgstr "choosing font size=%i\n"
#: src/ptouch-print.c:380 src/ptouch-print.c:414 #: src/ptouch-print.c:424 src/ptouch-print.c:458
#, c-format #, fuzzy, c-format
msgid "error in gdImageStringFT: %s\n" msgid "error in gdImageStringFT_180dpi: %s\n"
msgstr "error in gdImageStringFT: %s\n" msgstr "error in gdImageStringFT: %s\n"
#: src/ptouch-print.c:571 #: src/ptouch-print.c:615
#, c-format #, c-format
msgid "Only up to %d lines are supported" msgid "Only up to %d lines are supported"
msgstr "" msgstr ""
#: src/ptouch-print.c:649 #: src/ptouch-print.c:696
msgid "No arguments supported" msgid "No arguments supported"
msgstr "" msgstr ""
#: src/ptouch-print.c:654 #: src/ptouch-print.c:701
msgid "Option --writepng missing" msgid "Option --writepng missing"
msgstr "" msgstr ""
#: src/ptouch-print.c:657 #: src/ptouch-print.c:704
msgid "Options --force_tape_width and --info can't be used together" msgid "Options --force_tape_width and --info can't be used together"
msgstr "" msgstr ""
#: src/ptouch-print.c:688 #: src/ptouch-print.c:735
#, c-format #, c-format
msgid "ptouch_init() failed\n" msgid "ptouch_init() failed\n"
msgstr "ptouch_init() failed\n" msgstr "ptouch_init() failed\n"
#: src/ptouch-print.c:691 #: src/ptouch-print.c:738
#, c-format #, c-format
msgid "ptouch_getstatus() failed\n" msgid "ptouch_getstatus() failed\n"
msgstr "ptouch_getstatus() failed\n" msgstr "ptouch_getstatus() failed\n"
#: src/ptouch-print.c:705 #: src/ptouch-print.c:752
#, c-format
msgid "printer has %d dpi\n"
msgstr ""
#: src/ptouch-print.c:753
#, fuzzy, c-format #, fuzzy, c-format
msgid "maximum printing width for this printer is %ldpx\n" msgid "maximum printing width for this printer is %ldpx\n"
msgstr "maximum printing width for this tape is %ipx\n" msgstr "maximum printing width for this tape is %ipx\n"
#: src/ptouch-print.c:706 #: src/ptouch-print.c:754
#, fuzzy, c-format #, fuzzy, c-format
msgid "maximum printing width for this tape is %ldpx\n" msgid "maximum printing width for this tape is %ldpx\n"
msgstr "maximum printing width for this tape is %ipx\n" msgstr "maximum printing width for this tape is %ipx\n"
#: src/ptouch-print.c:731 #: src/ptouch-print.c:779
#, c-format #, c-format
msgid "failed to load image file\n" msgid "failed to load image file\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:740 #: src/ptouch-print.c:788
#, c-format #, c-format
msgid "could not render text\n" msgid "could not render text\n"
msgstr "could not render text\n" msgstr "could not render text\n"
#: src/ptouch-print.c:779 #: src/ptouch-print.c:827
#, c-format #, c-format
msgid "ptouch_finalize(%d) failed\n" msgid "ptouch_finalize(%d) failed\n"
msgstr "ptouch_finalize(%d) failed\n" msgstr "ptouch_finalize(%d) failed\n"

View File

@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ptouch-print\n" "Project-Id-Version: ptouch-print\n"
"Report-Msgid-Bugs-To: dominic@familie-radermacher.ch\n" "Report-Msgid-Bugs-To: dominic@familie-radermacher.ch\n"
"POT-Creation-Date: 2026-03-06 08:13+0100\n" "POT-Creation-Date: 2026-03-08 10:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -98,7 +98,7 @@ msgstr ""
msgid "debug: called ptouch_getstatus() with NULL ptdev\n" msgid "debug: called ptouch_getstatus() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:369 src/libptouch.c:405 #: src/libptouch.c:369 src/libptouch.c:407
#, c-format #, c-format
msgid "read error: %s\n" msgid "read error: %s\n"
msgstr "" msgstr ""
@@ -108,194 +108,229 @@ msgstr ""
msgid "timeout (%i sec) while waiting for status response\n" msgid "timeout (%i sec) while waiting for status response\n"
msgstr "" msgstr ""
#: src/libptouch.c:388 #: src/libptouch.c:390
#, c-format #, c-format
msgid "unknown tape width of %imm, please report this.\n" msgid "unknown tape width of %imm, please report this.\n"
msgstr "" msgstr ""
#: src/libptouch.c:394 #: src/libptouch.c:396
#, c-format #, c-format
msgid "got only 16 bytes... wondering what they are:\n" msgid "got only 16 bytes... wondering what they are:\n"
msgstr "" msgstr ""
#: src/libptouch.c:398 #: src/libptouch.c:400
#, c-format #, c-format
msgid "read error: got %i instead of 32 bytes\n" msgid "read error: got %i instead of 32 bytes\n"
msgstr "" msgstr ""
#: src/libptouch.c:401 #: src/libptouch.c:403
#, c-format #, c-format
msgid "strange status:\n" msgid "strange status:\n"
msgstr "" msgstr ""
#: src/libptouch.c:403 #: src/libptouch.c:405
#, c-format #, c-format
msgid "trying to flush junk\n" msgid "trying to flush junk\n"
msgstr "" msgstr ""
#: src/libptouch.c:408 #: src/libptouch.c:410
#, c-format #, c-format
msgid "got another %i bytes. now try again\n" msgid "got another %i bytes. now try again\n"
msgstr "" msgstr ""
#: src/libptouch.c:415 #: src/libptouch.c:417
#, c-format
msgid "debug: called ptouch_get_dpi() with NULL ptdev\n"
msgstr ""
#: src/libptouch.c:430
#, c-format
msgid "debug: called ptouch_get_max_lines() with NULL ptdev\n"
msgstr ""
#: src/libptouch.c:434
#, c-format
msgid "debug: called ptouch_get_max_lines() with invalid fontsize_px\n"
msgstr ""
#: src/libptouch.c:437
#, c-format
msgid "debug: calculated max lines %d \n"
msgstr ""
#: src/libptouch.c:444
#, c-format #, c-format
msgid "debug: called ptouch_get_tape_width() with NULL ptdev\n" msgid "debug: called ptouch_get_tape_width() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:424 #: src/libptouch.c:453
#, c-format #, c-format
msgid "debug: called ptouch_get_max_width() with NULL ptdev\n" msgid "debug: called ptouch_get_max_width() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/libptouch.c:436 #: src/libptouch.c:465
#, c-format #, c-format
msgid "debug: called ptouch_sendraster() with NULL ptdev\n" msgid "debug: called ptouch_sendraster() with NULL ptdev\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:153 #: src/ptouch-print.c:174
#, c-format #, c-format
msgid "nothing to print\n" msgid "nothing to print\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:161 #: src/ptouch-print.c:182
#, c-format #, c-format
msgid "image is too large (%ipx x %ipx)\n" msgid "image is too large (%ipx x %ipx)\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:162 #: src/ptouch-print.c:183
#, c-format #, c-format
msgid "maximum printing width for this tape is %ipx\n" msgid "maximum printing width for this tape is %ipx\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:165 #: src/ptouch-print.c:186
#, c-format #, c-format
msgid "image size (%ipx x %ipx)\n" msgid "image size (%ipx x %ipx)\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:175 #: src/ptouch-print.c:196
#, c-format #, c-format
msgid "ptouch_rasterstart() failed\n" msgid "ptouch_rasterstart() failed\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:181 #: src/ptouch-print.c:202
#, c-format #, c-format
msgid "send print information command\n" msgid "send print information command\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:187 #: src/ptouch-print.c:208
#, c-format #, c-format
msgid "send PT-D460BT magic commands\n" msgid "send PT-D460BT magic commands\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:194 #: src/ptouch-print.c:215
#, c-format #, c-format
msgid "send precut command\n" msgid "send precut command\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:203 #: src/ptouch-print.c:224
#, c-format #, c-format
msgid "send PT-D460BT chain commands\n" msgid "send PT-D460BT chain commands\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:215 #: src/ptouch-print.c:236
#, c-format #, c-format
msgid "ptouch_sendraster() failed\n" msgid "ptouch_sendraster() failed\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:264 #: src/ptouch-print.c:285
#, c-format #, c-format
msgid "writing image '%s' failed\n" msgid "writing image '%s' failed\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:286 #: src/ptouch-print.c:291
#, c-format #, c-format
msgid "debug: o baseline offset - %d\n" msgid "printing '%s' requires %.1f mm of tape\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:287 #: src/ptouch-print.c:313
#, c-format
msgid "debug: z baseline offset - %d\n"
msgstr ""
#: src/ptouch-print.c:314
#, c-format #, c-format
msgid "debug: text baseline offset - %d\n" msgid "debug: text baseline offset - %d\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:346 #: src/ptouch-print.c:387
#, c-format #, c-format
msgid "render_text(): %i lines, font = '%s', align = '%c'\n" msgid "render_text(): %i lines, font = '%s', align = '%c'\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:349 #: src/ptouch-print.c:390
#, c-format #, c-format
msgid "warning: font config not available\n" msgid "warning: font config not available\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:353 #: src/ptouch-print.c:394
#, c-format #, c-format
msgid "setting font size=%i\n" msgid "setting font size=%i\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:357 #: src/ptouch-print.c:396
#, c-format
msgid "ignoring setting font margin=%i\n"
msgstr ""
#: src/ptouch-print.c:401
#, c-format #, c-format
msgid "could not estimate needed font size\n" msgid "could not estimate needed font size\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:364 #: src/ptouch-print.c:408
#, c-format #, c-format
msgid "choosing font size=%i\n" msgid "choosing font size=%i\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:380 src/ptouch-print.c:414 #: src/ptouch-print.c:424 src/ptouch-print.c:458
#, c-format #, c-format
msgid "error in gdImageStringFT: %s\n" msgid "error in gdImageStringFT_180dpi: %s\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:571 #: src/ptouch-print.c:615
#, c-format #, c-format
msgid "Only up to %d lines are supported" msgid "Only up to %d lines are supported"
msgstr "" msgstr ""
#: src/ptouch-print.c:649 #: src/ptouch-print.c:696
msgid "No arguments supported" msgid "No arguments supported"
msgstr "" msgstr ""
#: src/ptouch-print.c:654 #: src/ptouch-print.c:701
msgid "Option --writepng missing" msgid "Option --writepng missing"
msgstr "" msgstr ""
#: src/ptouch-print.c:657 #: src/ptouch-print.c:704
msgid "Options --force_tape_width and --info can't be used together" msgid "Options --force_tape_width and --info can't be used together"
msgstr "" msgstr ""
#: src/ptouch-print.c:688 #: src/ptouch-print.c:735
#, c-format #, c-format
msgid "ptouch_init() failed\n" msgid "ptouch_init() failed\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:691 #: src/ptouch-print.c:738
#, c-format #, c-format
msgid "ptouch_getstatus() failed\n" msgid "ptouch_getstatus() failed\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:705 #: src/ptouch-print.c:752
#, c-format
msgid "printer has %d dpi\n"
msgstr ""
#: src/ptouch-print.c:753
#, c-format #, c-format
msgid "maximum printing width for this printer is %ldpx\n" msgid "maximum printing width for this printer is %ldpx\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:706 #: src/ptouch-print.c:754
#, c-format #, c-format
msgid "maximum printing width for this tape is %ldpx\n" msgid "maximum printing width for this tape is %ldpx\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:731 #: src/ptouch-print.c:779
#, c-format #, c-format
msgid "failed to load image file\n" msgid "failed to load image file\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:740 #: src/ptouch-print.c:788
#, c-format #, c-format
msgid "could not render text\n" msgid "could not render text\n"
msgstr "" msgstr ""
#: src/ptouch-print.c:779 #: src/ptouch-print.c:827
#, c-format #, c-format
msgid "ptouch_finalize(%d) failed\n" msgid "ptouch_finalize(%d) failed\n"
msgstr "" msgstr ""

View File

@@ -381,6 +381,8 @@ int ptouch_getstatus(ptouch_dev ptdev, int timeout)
ptdev->tape_width_px=0; ptdev->tape_width_px=0;
for (i=0; tape_info[i].mm > 0; ++i) { for (i=0; tape_info[i].mm > 0; ++i) {
if (tape_info[i].mm == buf[10]) { if (tape_info[i].mm == buf[10]) {
/* TODO: should be adjusted according
to printer dpi ! */
ptdev->tape_width_px=tape_info[i].px; ptdev->tape_width_px=tape_info[i].px;
} }
} }
@@ -409,6 +411,33 @@ int ptouch_getstatus(ptouch_dev ptdev, int timeout)
return -1; return -1;
} }
int ptouch_get_dpi(ptouch_dev ptdev)
{
if (!ptdev) {
fprintf(stderr, _("debug: called ptouch_get_dpi() with NULL ptdev\n"));
return 0;
}
return ptdev->devinfo->dpi;
}
/* TODO: The actual number of maximum lines should be calculated according to
printer resolution, tapewidth and fontsize */
/* printer resolution is planned to be taken into account when calculating
tape_width in px */
int ptouch_get_max_lines(ptouch_dev ptdev, int fontsize_px)
{
if (!ptdev) {
fprintf(stderr, _("debug: called ptouch_get_max_lines() with NULL ptdev\n"));
return 0;
}
if (fontsize_px <= 0) {
fprintf(stderr, _("debug: called ptouch_get_max_lines() with invalid fontsize_px\n"));
return 0;
}
fprintf(stderr, _("debug: calculated max lines %d \n"), ptdev->tape_width_px / fontsize_px);
return 4;
}
size_t ptouch_get_tape_width(ptouch_dev ptdev) size_t ptouch_get_tape_width(ptouch_dev ptdev)
{ {
if (!ptdev) { if (!ptdev) {

View File

@@ -35,7 +35,7 @@
#define _(s) gettext(s) #define _(s) gettext(s)
#define MAX_LINES 4 /* maybe this should depend on tape size */ #define MAX_LINES 4 /* this should be calculated depending on tape size */
#define P_NAME "ptouch-print" #define P_NAME "ptouch-print"
@@ -56,6 +56,7 @@ struct arguments {
int verbose; int verbose;
int timeout; int timeout;
}; };
typedef enum { JOB_CUTMARK, JOB_IMAGE, JOB_PAD, JOB_TEXT, JOB_UNDEFINED } job_type_t; typedef enum { JOB_CUTMARK, JOB_IMAGE, JOB_PAD, JOB_TEXT, JOB_UNDEFINED } job_type_t;
typedef struct job { typedef struct job {
@@ -91,7 +92,8 @@ static struct argp_option options[] = {
{ "font", 2, "<file>", 0, "Use font <file> or <name>", 1}, { "font", 2, "<file>", 0, "Use font <file> or <name>", 1},
{ "fontsize", 3, "<size>", 0, "Manually set font size, or ...", 1}, { "fontsize", 3, "<size>", 0, "Manually set font size, or ...", 1},
{ "fontmargin", 4, "<size>", 0, "Manually set font top/bottom margin (in px)", 1}, { "fontmargin", 4, "<size>", 0, "Manually set font top/bottom margin (in px)", 1},
{ "writepng", 5, "<file>", 0, "Instead of printing, write output to png <file>", 1}, { "write-png", 5, "<file>", 0, "Instead of printing, write output to png <file>", 1},
{ "writepng", 5, "<file>", OPTION_ALIAS, "alias for write-png", 1},
{ "force-tape-width", 6, "<px>", 0, "Set tape width in pixels, use together with --writepng without a printer connected", 1}, { "force-tape-width", 6, "<px>", 0, "Set tape width in pixels, use together with --writepng without a printer connected", 1},
{ "copies", 7, "<number>", 0, "Sets the number of identical prints", 1}, { "copies", 7, "<number>", 0, "Sets the number of identical prints", 1},
{ "timeout", 8, "<seconds>", 0, "Set timeout waiting for finishing previous job. Default:1, 0 means infinity", 1}, { "timeout", 8, "<seconds>", 0, "Set timeout waiting for finishing previous job. Default:1, 0 means infinity", 1},
@@ -298,7 +300,11 @@ int get_baselineoffset(char *text, char *font, int fsz)
{ {
int brect[8]; int brect[8];
/* NOTE: This assumes that 'z' is always on the baseline */ /* NOTE: This assumes that 'z' is on the baseline for the selected font.
'z' was choosen instead of 'o' because letters withstraight baseline
are the better choice for the majority of fonts here.
If this makes problems with non-latin fonts with lots of vertically
protruding serifs or decorations, change 'z' to 'o' */
gdImageStringFT_180dpi(NULL, &brect[0], -1, font, fsz, 0.0, 0, 0, "z"); gdImageStringFT_180dpi(NULL, &brect[0], -1, font, fsz, 0.0, 0, 0, "z");
int z_offset = brect[1]; int z_offset = brect[1];
gdImageStringFT_180dpi(NULL, &brect[0], -1, font, fsz, 0.0, 0, 0, text); gdImageStringFT_180dpi(NULL, &brect[0], -1, font, fsz, 0.0, 0, 0, text);
@@ -743,6 +749,7 @@ int main(int argc, char *argv[])
} }
if (arguments.info) { if (arguments.info) {
printf(_("printer has %d dpi\n"), ptouch_get_dpi(ptdev));
printf(_("maximum printing width for this printer is %ldpx\n"), ptouch_get_max_width(ptdev)); printf(_("maximum printing width for this printer is %ldpx\n"), ptouch_get_max_width(ptdev));
printf(_("maximum printing width for this tape is %ldpx\n"), ptouch_get_tape_width(ptdev)); printf(_("maximum printing width for this tape is %ldpx\n"), ptouch_get_tape_width(ptdev));
printf("media type = 0x%02x (%s)\n", ptdev->status->media_type, pt_mediatype(ptdev->status->media_type)); printf("media type = 0x%02x (%s)\n", ptdev->status->media_type, pt_mediatype(ptdev->status->media_type));