1

I am quite new to the ZPL II language and have some trouble with writing text in reverse mode with the ^GB and ^FR commands. As far as I understood the ZPL language, when I want to print a text in reverse mode (white over black) I have to first draw a graphic box with the ^GB command and then set the field to be written to in reverse mode with the special ^FR command.

The problem I have is that I would like to fit the graphic box's width to the text's width. With the font I use, the ^A0 font, I couldn't find out the algorithm to calculate the correct width of the graphic box. Depending on the text, if there are numbers or letters or both, the graphic box's width is not just (number of caracters)*(width of one caracter)...

Here is the code I use :

^XA ^FO64,0,^GB70,20,10^FS ^FO64,0,^FR^A0N,32,37^FD0001^FS ^XZ

When using a mix of numbers and letters the graphic box doesn't fit anymore :

^XA ^FO64,0,^GB70,20,10^FS ^FO64,0,^FR^A0N,32,37^FDAW01^FS ^XZ

I would be very grateful to anyone who could give me the correct approach to my problem .

ThomasZ
  • 11
  • 1
  • 3

1 Answers1

0

I do not believe that there is a way to make the graphic box auto size based on the actual length of the text. I'd recommend using a mono-spaced font. That should easily allow you to calculate the width of the box based on the number of characters. Use Zebra Utilities to download a mono-spaced font to he printer.

Elton Saunders
  • 1,238
  • 1
  • 12
  • 23
  • Thank you very much for you answer. In the mean time I found a similar post to mine and it definitevely seems that there is no solution using scalable fonts. (see [link](http://stackoverflow.com/questions/24603194/how-to-calculate-zebra-font-0-text-width)) – ThomasZ Sep 03 '15 at 09:07