Hi Wim, At 2022-12-08T15:51:07+0100, Wim Stockman wrote: > I am making a simple cash register with a ticket printer. and I want > to figure out how I can detect how long my physical paper should be > without cutting some text off. So I can set it for the device. The > width is fixed so that is no issue. Eventually I can run it in some > loop and detect when it stops having more than one page.
I reckon I would have a couple of macros that open and close a
diversion, then measure against an argument that specifies the limit
imposed by the hardware (i.e., length of paper roll remaining).
Here's a conceptual sketch.
.de StartTicket
. br
. di Ticket
..
.
.de EndTicket
. di
..
.
.while 1 \{\
. StartTicket
.\" input for ticket text goes here
. EndTicket
. if (\n[dn] > \n[ticket-printer-paper-length]) \
. ab ticket too long for remaining paper; aborting
.\}
Please clarify if I've overlooked a requirement.
Regards,
Branden
signature.asc
Description: PGP signature
