Salta al contenuto

ZPL text overlaps or runs off the label

ZPL text overlaps when the gap between two ^FO y positions is smaller than the font height, and runs off the label when a line is wider than the space left. Space lines by at least the font height, and wrap long data with ^FB and more than one line.

Aggiornato 2026-10-20 · Renders made with the OpenZPL engine

Open in the viewer

What you see

Two lines print on top of each other, or a long address is cut at the right edge.

30 dots between 50 dot lines; long line cut

A name and a street line printed on top of each other, and a long address cut at the right edge
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^FO40,30^A0N,50,50^FDALEX MORGAN^FS
^FO40,60^A0N,40,40^FD1234 East 6th Street^FS
^FO40,150^A0N,40,40^FDBuilding 7, Riverside Industrial Park, Gate C, Dock 4^FS
^XZ

Spaced lines; long line wrapped

Name and street on separate lines, and the long address wrapped onto two lines
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^FO40,30^A0N,50,50^FDALEX MORGAN^FS
^FO40,95^A0N,40,40^FD1234 East 6th Street^FS
^FO40,150^A0N,40,40^FB733,2,5,L^FDBuilding 7, Riverside Industrial Park, Gate C, Dock 4^FS
^XZ

Why it happens

  • Vertical gap smaller than the font. ZPL places each field independently at its ^FO position and never moves one to make room for another. A 50 dot font at y = 30 occupies 30 to 80, so a field at y = 60 lands inside it.
  • Variable data longer than the space. A template tested with John Smith breaks with a longer name or address. ZPL doesn't wrap plain fields: the text continues past the edge and the part off the label isn't printed.
  • A different density than designed. Text designed at 203 dpi and printed at 300 dpi stays the same number of dots but the positions keep their dots too; mixing scaled and unscaled values in a template causes overlaps.

The fix

Make the gap between two lines at least the height of the first one, plus a few dots of air. For a 50 dot line at y = 30, the next one starts at y = 95 or lower.

For data whose length you don't control, use a field block: ^FB with a width, a maximum number of lines and a line spacing. The text wraps inside the block:

^FO40,150^A0N,40,40^FB733,2,5,L^FDBuilding 7, Riverside Industrial Park, Gate C, Dock 4^FS

Reserve the height of every line the block can use (here 2 × 40 + 5 dots) before the next field. If the text needs more lines than allowed, a printer overprints the extra text on the last line, so size the block for your longest real value or shorten the data.

With too few lines, the OpenZPL engine drops the extra text instead of overprinting it on the last line as a printer does. Either way the data is not readable: test the longest value.

How to check

  • Render the template with the longest values in your data, not with sample values.
  • In the ZPL viewer, the preview at the printer's density shows overlaps exactly: positions and sizes are in dots, so they don't change between preview and print.

Domande

Does ZPL move a field when it overlaps another?

No. Every field is drawn at its own position; ZPL has no layout engine. Overlaps are always a matter of coordinates and sizes.

How do I know how wide a line of text will be?

Roughly 0.5 to 0.6 times the font height per character for font 0. Render the longest value to be sure, and leave a margin.

Sources