zpl.tools
Fields

^FT - Field Typeset

Positions the next field by its text baseline rather than its top edge.

^FT positions a field by the line its characters sit on, not by the top of the character cell. Use it whenever fields of different sizes must line up, because the anchor does not move when the font does. A ^FT at y=100 keeps the baseline at 100 whether the text is 20 dots tall or 80. ^FT is not tied to proportional or TrueType fonts, and accepts exactly the same fields as ^FO.

Syntax

^FTx,y,z

Support

Partially supportedparsed: full · state: full · rendered: partial

The command renders, with the caveat below.

An omitted coordinate continues from the previous field, the guide's default. Only text and ^GS fields move that position. — pinned by test_ft_bare_concatenates_after_previous_field, test_ft_missing_coordinates_stay_absent

Labelary renders this command.

Parameters

xX-axis positionoptional · dots

Distance right from label home.

Default
the right edge of the previous field, which is what makes fields concatenate
Accepted range
0 to 32000 dots
Invalid value
clamped to the nearest allowed value. The renderer clamps a value above 32000 to 32000, and reports an invalid argument. A non-numeric value reads as 0.
Test coverage
Bounds pinned: maximum (32000), above the maximum (33000). No test at the minimum. The invalid-value rule is pinned by 1 test.
yY-axis positionoptional · dots

Distance down from label home to the text baseline, the line the characters sit on, excluding descenders. For a barcode it is the bottom of the bars; for a graphic box or an image, its bottom-left corner.

Default
the baseline of the previous field
Accepted range
0 to 32000 dots
Invalid value
clamped to the nearest allowed value. The renderer clamps a value above 32000 to 32000, and reports an invalid argument. A non-numeric value reads as 0.
Test coverage
Bounds pinned: maximum (32000), above the maximum (33000). No test at the minimum. The invalid-value rule is pinned by 3 tests, including the diagnostic it emits.
zJustificationoptional · one of a set

Which side of the field the x coordinate pins.

Default
the justification last set by ^FW, or 0
Invalid value
discarded, and the default applies. Any other value uses the current ^FW justification.
Test coverage
Values exercised: 0, 1. Not exercised: 2. The invalid-value rule is not pinned by a test.
0
Left justify (default)
1
Right justify
2
Auto justify, chosen from the field's rotation

Behavior

The baseline depends on the field. For text it is the line under the characters, without descenders, so a y and a p hang below the coordinate. For a bar code it is the bottom of the bars, and for a graphic box or an image it is the bottom-left corner. ^FO anchors the top-left corner in every case.

A field has one origin: ^FO and ^FT overwrite each other, and the last one before ^FS wins.

The guide concatenates fields through omitted coordinates. A bare ^FT continues from the previous field, at its right edge horizontally and its baseline vertically, which builds a line of mixed sizes without a width calculation. The renderer does not implement this: it reads an omitted coordinate as 0, so a bare ^FT puts the field at label home. Give both coordinates explicitly.

Known issues

Tested behavior

Differences from the specification

Labelary against the ZPL II guide

Where Labelary — our compatibility target — behaves differently from the printed specification.

  • The 2006 guide's format is ^FTx,y: the justification argument z appears in Labelary's reference and in later firmware, not in the guide. — pinned by test_ft_right_justified_fs

zpl.tools against the ZPL II guide

Where our renderer behaves differently from the specification.

  • An omitted coordinate continues from the previous field: x from its right edge, trailing spaces included, y from its baseline. Only text and ^GS fields advance that position; a barcode field leaves it unchanged. — pinned by test_ft_bare_concatenates_after_previous_field, test_ft_missing_coordinates_stay_absent

Example

The rule marks y=100. The ^FT baseline sits on it at any font size, while the ^FO field starts there and grows downwards:

^XA
^FO40,100^GB700,1,1^FS
^FT40,100^A0N,50,50^FDbaseline^FS
^FT300,100^A0N,25,25^FDsmaller, same line^FS
^FO520,100^A0N,50,50^FDFO here^FS
^XZ

Open in viewer