问题
I'm using the ^A command in ZPL2 to print the Q font, and I want it rotated 90 degrees. I would think this line would print the "00" up against the left edge of the label since the first ^FO parameter is zero:
^XA
^PR2
^MD15
^PW1200
^LL590
^LH0,0
^FB500,14,,^FO0,135^AQR,1,1^FD00^FS
^PQ1
^XZ
. . . but it's not. It's indented about a fourth of the way across the label. Using that same code, I swap out ^AQR with ^AQN and the "00" prints right up against the left edge.
Can anyone tell me what I'm doing wrong? I'm using a GX430t if that makes a difference. I'm not sure it does since labelary displays it the same way.
Thank you,
回答1:
Rotation in ZPL is a bit odd. It does not work like HTML canvas or other modern graphics environments where the size of the drawing surface affects the rotation.
Since you are using labelary, take a look at the following ZPL, which is a simplified version of your example, without the font rotation and label dimensions, and with a box added to show the extent of the ^FB
you defined. (The font Q line height is ~25 dots : 14x25 == 350.)
^XA
^LH0,0
^FPH
^FO0,135^GB500,350^FS
^FB500,14,,^FO0,135^AQ,1,1^FD00^FS
^XZ
Now let's add in the font rotation which causes the ^FB
to rotate as well. Since graphics don't rotate, we will swap the width and height of the ^GB
to show the equivalent rotation of the box:
^XA
^LH0,0
^FPH
^FO0,135^GB350,500^FS
^FB500,14,,^FO0,135^AQR,1,1^FD00^FS
^XZ
I think you can now see how the rotation worked. The ^FB
rotates around the ^FO
point. But there is also some built in x,y translation based on the dimensions of the ^FB
.
来源:https://stackoverflow.com/questions/42660007/zpl2-rotating-text-changes-alignment