zpl.tools
Label geometry

^LS - Label Shift

Shifts every field left by a fixed number of dots.

^LS exists for one narrow reason. The Z-130 and Z-220 printers measured ^FO from the media edge, not the printhead edge. A format written for them lands too far right on any later Zebra printer, and ^LS shifts it back. The sign is the trap: a positive argument moves content left, the opposite of every other coordinate in ZPL, and a negative argument moves it right.

Syntax

^LSa

Support

Supportedparsed: full · state: full · rendered: full

Every documented parameter renders the same output Labelary produces.

Labelary renders this command.

Parameters

aShift left valueoptional · dots

Dots to move subsequent fields left. A negative value moves them right. Applies on top of ^LH.

Default
0
Accepted range
-9999 to 9999 dots
Invalid value
clamped to the nearest allowed value. A value beyond ±9999 clamps to the nearest bound. Under ^MU the bound applies to the converted value, so ^MUI^LS60 clamps to 9999 dots.
Test coverage
Bounds pinned: maximum (9999), above the maximum (32000). No test at the minimum. The invalid-value rule is pinned by 3 tests.

Behavior

The renderer applies the shift as it places each field, so the shift reaches only the fields that follow it. Two ^LS commands in one format therefore give two coordinate systems rather than one cumulative shift, and the last ^LS before a field counts for that field. ^LT works the other way round and moves the finished label, including a field written earlier, so the two are not symmetric.

^LS stacks with ^LH, which pushes content the other way: the horizontal position of a field is ^FO.x + ^LH.x - ^LS. The renderer clamps nothing in that sum until the end, so a large ^LH and a large ^LS cancel out cleanly.

A field pushed off the left edge does not disappear. The renderer clamps the composed coordinate to 0 for each drawn object. The object sits against the left edge at its full size, and the renderer neither drops nor crops it. ^LS200 with ^FO100,50 and a 200-dot-wide box puts the box at 0 to 200, not at −100 to 100. We measured this against Labelary, and it matches.

Under ^MU the argument takes the current unit, and the ±9999 limit applies to the converted value, so ^MUI^LS60 asks for 12,000 dots and clamps to 9999.

For general layout use ^LH. ^LS is a compatibility shim, and the guide notes that the firmware decides whether it survives a power cycle, so a format must not depend on it.

Tested behavior

Example

Three lines at the same ^FO200, with the shift changed between them. Only the lines after each ^LS move, and the positive one moves left:

^XA
^FO200,40^A0N,40,40^FDno shift^FS
^LS60
^FO200,120^A0N,40,40^FDLS60 left^FS
^LS-60
^FO200,200^A0N,40,40^FDLS-60 right^FS
^XZ

Open in viewer