libptouch: P700/P900 families, optional JSON config, ESC i z and print sequencing

- Add printer_family and profile flags; load overrides from printer_families.json
- Set ESC i z page byte from profile; pass prof into ptouch_fill_esc_iz
- End print with 0x1A only (drop FF prefix); extend Ruby FFI and CLI media info
- Add reference/ptp_raster_ref.adoc; install config under share/ptouch_label

Made-with: Cursor
This commit is contained in:
knb
2026-04-19 12:20:21 +09:00
parent 3f2eb464aa
commit bfd6adda42
18 changed files with 456 additions and 47 deletions

View File

@@ -3,6 +3,14 @@
#include <stdio.h>
#include <stdlib.h>
static const ptouch_printer_profile_t prof_fixture_p700 = {
.family = LIBPTOUCH_FAMILY_P700,
};
static const ptouch_printer_profile_t prof_fixture_p900 = {
.family = LIBPTOUCH_FAMILY_P900,
};
static int expect_int(const char *name, int got, int want)
{
if (got == want)
@@ -30,7 +38,7 @@ int main(void)
fail |= expect_int("gf70_n2", gf[2], 0x00);
uint8_t iz[13];
ptouch_fill_esc_iz(iz, 0x01u, 0x0Cu, 70u);
ptouch_fill_esc_iz(iz, &prof_fixture_p700, 0x01u, 0x0Cu, 70u);
fail |= expect_int("iz_cmd_0", iz[0], 0x1B);
fail |= expect_int("iz_cmd_1", iz[1], 0x69);
fail |= expect_int("iz_cmd_2", iz[2], 0x7A);
@@ -38,9 +46,12 @@ int main(void)
fail |= expect_int("iz_media_kind_passthrough", iz[4], 0x01);
fail |= expect_int("iz_media_width", iz[5], 0x0C);
fail |= expect_int("iz_lines_lsb", iz[7], 70);
fail |= expect_int("iz_page_index", iz[11], 0x00);
fail |= expect_int("iz_page_control_p700", iz[11], 0x00);
fail |= expect_int("iz_last_fixed", iz[12], 0x00);
ptouch_fill_esc_iz(iz, &prof_fixture_p900, 0x01u, 0x0Cu, 70u);
fail |= expect_int("iz_page_control_p900_single", iz[11], 0x02);
/* ESC i K mode byte: 128-dot vs 560-dot families */
fail |= expect_int("esc_ik_128", ptouch_esc_ik_value(128u), 0x08);
fail |= expect_int("esc_ik_560", ptouch_esc_ik_value(560u), 0x0C);