BinaryKits / BinaryKits.Zpl

BinaryKits.Zpl a set of .net libraries. The project supports you in the simple creation of zebra labels. It generates the ZPL data, it is a printer description language from Zebra Technologies. ZPL II is now emulated by many label printers from different manufacturers. So with this implementation you can create labels for most printers.
MIT License
291 stars 105 forks source link

^FT Field Typeset is not handled correctly for default x & y values. #252

Open danzk opened 2 weeks ago

danzk commented 2 weeks ago

I noticed that the ^FT command is not rendered correctly when x & y are not specified. It should follow on from the end position of the last field. You can see the following ZPL is rendered correctly on labelary.com.

^XA
^FT50,50^A0N,50,50^FDText Box^FS
^FT^A0R,50,50^FDText Box^FS
^FT^A0I,50,50^FDText Box^FS
^FT^A0B,50,50^FDText Box^FS
^XZ

image

primo-ppcg commented 2 weeks ago

This is relatively significant change, which is not simple to achieve with the current analyze-then-draw paradigm.

I think the following would be required:

  1. The VirtualPrinter will need to keep track of the last drawn position. Every ElementDrawer will need to be responsible for updating this.
  2. PositionX and PositionY of ZplPositionedElementBase will likely need to be nullable. Every Drawer and Renderer will need to be updated to accomodate this. In particular, using (0, 0) as defaults if ^FO is in effect, or (LastDrawnPosition.X, LastDrawPosition.Y) under ^FT.