I've had this issue before, and across printer manufacturers, firmwares and languages. First, some paraphrased explanations straight out of the 2014 ZPL II Programming Guide (P1012728-009 Rev. A). "The ^TB command prints a text block with defined width and height. The text block has an automatic word-wrap function. If the text exceeds the block height, the text is truncated." "The ^FB (Field Block) command allows you to print text into a defined block type format. It can format a ^FD (Field Data) string into a block of text using the origin, font, and rotation specified for the text string, and it contains an automatic word-wrap function." Technically, the difference between a text block and a field block is that height is in dots for the former and in lines for the latter. Also notice that although not mentioned, the ^FB command also truncates text that does not fit in the number of lines specified, and here's where the font size of the A0 command and the line spacing of the FB command now play an important role in determining whether to show or truncate that second or third line. Incidentally, in other languages such as TSPL there is no truncation of text blocks--if you tell the block to be 3 lines in height but there's enough text for 4 lines, line 4 overlaps line 3 to indicate this--which may seem awful, but it is better than the data loss of truncation, which is not obvious. For both commands: "Using ^FT (Field Typeset) for your data takes the baseline origin of the last possible line of text, meaning that the field block will be filled from bottom to top." "Using ^FO (Field Origin) means that the field block will be filled from top to bottom." In reality, I have only been able to make the ^FB command work as expected, but that may be because ^TB is not implemented in the firmware I've worked with (ZPL II "compliant" Bluetooth printers). You can test the following snippet for a 2x2 label in the Labelary Viewer: ^XA ~TA0 ^MTD ^MNW ^MMT ^MFN ~SD15 ^PR6 ^PON ^PMN ^PW406 ^LS0 ^LRN ^LL406 ^LT0 ^LH0,0 ^CI0 ^XZ ^XA ^FO324,10,0^FB386,2,0,C,0^A0R,36,28.8^FH^FD"The King" Cupcake^FS ^FO278,10,0^FB386,1,0,C,0^A0R,28,22.4^FH^FDUse By 11/24/2015 02:45 PM^FS ^FO152,10,0^FB386,1,0,C,0^A0R,24,19.2^FH^FD11/24/2015 02:45 PM^FS ^FO62,140,0^FB250,1,0,R,0^A0R,24,19.2^FH^FDSL: 4 hours^FS ^FO38,10,0^FB386,1,0,L,0^A0R,18,14.4^FH^FDPREP DATE:^FS ^FO8,10,0^FB386,1,0,L,0^A0R,28,22.4^FH^FD11/24/2015 10:45 AM^FS ^FO62,10,0^FB50,1,0,L,0^A0R,24,19.2^FH^FDEMP:^FS ^FO92,10,0^FB376,3,0,J,0^A0R,18,14.4^FH^FDIngredients: 1 1/2 cups all-purpose flour, 1 teaspoon baking powder, 1/2 teaspoon salt, 8 tablespoons (1 stick) unsalted butter, room temperature, 1 cup sugar, 3 large eggs, 1 1/2 teaspoons pure vanilla extract, 3/4 cup milk.^FS ^PQ3,,,Y ^XZIn particular, I've preceeded the A0 and FD commands with FB. Using the viewer, you can quickly test the effects of changing from FT and FO in the ingredients line, the effects of changing the A0 font sizes and the effects of changing the FB number of lines from say 3 to 2 (the viewer does not truncate text btw). Of course there is no match for actually printing a label, for your ZPL II "compliant" printer may or may not truncate text according to its manufacturer and firmware version. (责任编辑:) |