/* * libptouch — tape width → printable dots (data tables per printer family) * * Author: knb * Email: knb@artif.org */ #ifndef LIBPTOUCH_LAYOUT_H #define LIBPTOUCH_LAYOUT_H #include "libptouch.h" #include #include /** One row: status byte st[10] (media width code) when it matches this tape width slot */ typedef struct ptouch_layout_row { uint8_t media_wbyte; uint16_t left_dots; uint16_t print_dots; uint16_t right_dots; } ptouch_layout_row_t; /** * Printer family: USB PID / status model byte select a profile; tables supply layouts. * New models: add a row to @ref ptouch_layout_profiles or add TZe/HS rows to existing tables. */ typedef struct ptouch_printer_profile { const uint16_t *usb_pids; /* 0-terminated; NULL = do not match on PID */ const uint8_t *model_codes; /* 0-terminated; NULL = do not match on status[4] */ int is_default; /* 1 = fallback when no other profile matches */ unsigned head_width_dots; /* 128 or 560; full raster width for pack/GF payload */ double margin_feed_dpi; /* ESC i d feed dots per inch (PDF) */ unsigned margin_feed_max_dots; const ptouch_layout_row_t *tze; size_t tze_count; const ptouch_layout_row_t *hs; size_t hs_count; const char *doc_ref; } ptouch_printer_profile_t; const ptouch_printer_profile_t *ptouch_layout_resolve_profile(uint16_t usb_pid, uint8_t status_model_byte); libptouch_err_t ptouch_layout_from_status(const ptouch_printer_profile_t *prof, uint8_t media_kind, uint8_t media_wbyte, uint16_t *left_dots, uint16_t *print_dots, uint16_t *right_dots); #endif /* LIBPTOUCH_LAYOUT_H */