Resize Icons and Print TrueType Text Fonts on Your Labels

  • By Lee Peterson

Edit:

The intent of this article was to help designers of custom labels resize the Rock icon font on labels (previously it wasn't resizeable). After writing it I did more research, and discovered that there is an incompatibility between the fonts Fontello generates and the Zebra Font Downloader. Recreating the icon font on the icomoon website made it work exactly as expected. You can install the (new) complete font (available at http://storage.rockrms.com/resources/rockcheckin.ttf) without selecting the 26-point subset and it prints in the correct place on the labels and is resizeable.

I'm going to leave the rest of this article as is, hoping that it may still be helpful in case you want to use the old icon font or other TrueType fonts.

You can tell the difference between the old and new fonts by looking at the font name in the Windows Fonts control panel (or the Zebra Font Downloader). The new font installs as Rock-Checkin, and the old font as rockcheckin.


>>>

The icons from the Rock icon font are a great addition to labels, conveying important information in a small space that's "readable" from a long distance. Here's a way to make the Rock icon font resizable when printed on labels, conserving space on smaller labels (or maybe you're after big and bold). Another advantage is that we'll install the Rock font in its entirety, which is a little simpler than installing the 26-point subset we've normally used. It also appears to be possible to use certain TrueType fonts on labels.


Here's a sample label of Rock icon font sizes from 125 dots down to 25 dots tall:

IMG_2805.jpg


In addition to a resizable Rock font, it's possible to install and use certain other TrueType fonts in text fields, helping us make our labels more distinctive than if we used only the normal Zebra "Zero" font. This is Comic Sans MS Bold  printed on a label, in sizes from 100 dots to 25 dots tall:

IMG_2806.jpg


One stumbling block to using TrueType fonts lies in the apparent inability of ZebraDesigner to handle them correctly, so we're going to need to edit the ZPL code in our labels manually. Specifically, the ZPL ^FT (Field Typeset) command used by ZebraDesigner to position a text field on a label doesn't work correctly with TrueType fonts. It seems that it prints the text field inverted and off the edge of the label

edit: it was inverted because my label was rotated. What it actually does is print the icons at the top of the label, ignoring the "y" coordinate in the ^FT command.

Playing around with ZPL is kind of fun once you get the hang of it (is that geeky, or what?). A few techniques and commands and you'll be on your way. The ZPL Programming Guide is a reference you'll rely on heavily once you start getting into the ZPL weeds.

A caveat: I only have access to a GX420d printer, so that's what I've done all my testing on. In my research I found an old Zebra document that indicates some differences with ZD-series printers, so be cautious and send feedback if you're using a different setup and have trouble. There may also be differences in firmware--our printers have version V56.17.17Z. Please let me know if you find anything inaccurate or that doesn't work for you. This is a work in progress.

For simplicity's sake, let's assume that you've previously used the Zebra tools and the instructions in Checking Out Check-In to download the Rock font to your computer and printer, and have been using the stock icon label (or have created and customized your own icon label). We're going to use the "Direct Communication" utility in Zebra Setup Utilities to help manage our printer and do some testing. A word to the wise: this is a great tool to use for administering your printer(s), and also for manually designing or tweaking labels. You can make a change in a label's ZPL code and instantly print a label to see the results. Another handy method is to edit the ZPL in the Rock label editor, although you may not be able to print a test label from there (depending on your system configuration).


Here's what we're going to do:

  1. Learn to use the Zebra "Direct Communication" utility
  2. Print a preliminary directory of the E: memory space on your printer (where custom fonts are stored)
  3. Install the entire Rock icon font on your printer
  4. Use the Direct Communication utility to create and test a simple test label
  5. Learn to modify existing labels so they work with the new font

Let's get started.


Zebra Setup Utilities "Direct Communication" utility


Screen Shot 2018-03-12 at 8.39.00 PM.png


Run Zebra Setup Utilities and select the printer you'll be using for this test. Click the "Open Communication With Printer" button. The resulting screen has two windows: you'll enter commands and ZPL code in the top window (you can even paste a whole label format there), hit "F5" (send to printer), and any information returned from the printer will display in the bottom window (or print). Remember, anything in ZPL has to begin with ^XA and end with ^XZ. You can add line breaks for readablility or put everything on one line.


Screen Shot 2018-03-13 at 8.53.14 AM.png


Try ^XA^HH^XZ, then F5. The printer configuration should display in the bottom window.

Try ^XA~WC^XZ (make sure it's a tilde, not a caret before the WC). The printer configuration prints on a series of labels. Cool, huh? You can copy and paste if you're tired of typing carets and tildes.


Print a directory of E:

We need to know and keep track of the names of the fonts on our printer (Zebra Font Downloader renames fonts when it installs them), so we need to get a directory of the E: memory space before we install the new font.

^XA^WDE:^XZ prints a list of all files on the E: drive. ^XA^HWE:^XZ displays a list in the bottom window. In any case, you need to know what the existing Rock font is called. Most likely it's ROC000.FNT, unless you've been playing.


Install the entire Rock icon font

Easy Peasy. Run the Font Downloader (you can run it right from Setup Utilities), open the memory card file you've used previously [Card->Open...] then select [Font->Add...]. In the Download Mode box select "Download all characters". This is where you would have chosen "Download selected characters" when you installed the font the first time around. Choose the rockcheckin font. The number of characters should be 96, and the total space 30452 bytes. Click through the next couple of dialogs to finish installing and downloading the font to the printer. Quit Font Downloader.

Go back to the Direct Communication utility, and get a directory of the E: drive (^XA^WDE:^XZ). Check to make sure that the new font installed correctly, and that you know its name. The size on the printer (assuming it's always the same?) should be 30568 bytes. The next instructions will assume that the new font is named "ROC001.FNT". Substitute your font's name if it's different.


Create and print a test label

Let's test and make sure the new font prints. Clear the top window and enter (or copy and paste)

^XA

^CWZ,ROC001.FNT

^FO50,100

^FB500

^AZN,50,50

^FDA B F^FS

^XZ

All three icons should print, smaller than normal. If not, go back and make sure you specified the new font correctly in the ^CWZ command.

This string uses CWZ to rename the ROC001 font "Z", then creates a Field Block 500 dots wide at the Field Origin 50,100 (this is the upper left corner of the box we'll print in). AZN,50,50 prints characters 50 dots tall by 50 dots wide maximum, Normal rotation. The actual characters we want to print are between ^FD (Field Data) and ^FS (Field Separator). In a nutshell, this will print "A B F" in the font we just installed, which should be the allergy, birthday, and first time icons.

Experiment with the AZN command by changing the size. Try 50,100; 100,50; 200,200. Notice that with 200-dot characters it writes the last icon over the first. This happened because the block wasn't wide enough for three characters. Change the ^FB500 to ^FB600 and try again.

If you have the original 26-point bitmapped font installed, try switching the CWZ command to it (and change the character size back to 75 x 75) and see what happens. Try resizing it (you'll need to change the height and width a bunch). It can double or triple in size, both height and width, but that's all -- nothing in between (or smaller).

That's it! Now you can use a variable-size icon font on your labels. Of course, if you decide to use this on your production labels you'll need to install the font on all your printers. I'm working on a procedure for an easier method than bringing them all to your desk. Most likely it'll involve printing a label containing the new font on every printer.


Modify your existing icon label

To convert an existing icon label to use the new font, it's necessary to change the line of code that prints each icon: replace the ^FT command with ^FO and ^FB, rename the font in the ^CWZ command, and set the character height and width to the same value (or it'll squish the icon a little). You might also need to move the icon vertically a little.

This line from the stock child icon label (which prints the allergy icon)

^CWZ,E:ROC000.FNT^FT605,383^AZN,73,64^FH^FD7^FS

becomes

^CWZ,E:ROC001.FNT^FO605,330^FB100^AZN,73,73^FH^FD7^FS

We renamed the font, changed ^FT to ^FO and ^FB, adjusted the "Y" coordinate slightly and changed the character width to equal the height.

Here's the entire Child icon label adjusted for the new, scalable font (interestingly, this label works fine with the old bitmapped font, except the vertical placement of the icons is slightly off):

CT~~CD,~CC^~CT~
^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR6,6~SD24^JUS^LRN^CI0^XZ
^XA
^MMT
^PW812
^LL0406
^LS0
^FT452,119^A0N,135,134^FB333,1,0,R^FH^FDWWW^FS
^FT12,254^A0N,135,146^FH^FD5^FS
^FT14,309^A0N,45,45^FH^FD6^FS
^CWZ,E:ROC001.FNT^FO293,23^FB75^AZN,73,73
^FH^FDB^FS
^CWZ,E:ROC001.FNT^FO378,23^FB75^AZN,73,73
^FH^FDF^FS
^FT299,120^A0N,28,28^FH^FD4^FS
^FB330,2,0,L^FT8,382^A0N,28,28^FH^FD9^FS
^CWZ,E:ROC001.FNT^FO605,330^FB100^AZN,73,73^FH^FD7^FS
^CWZ,E:ROC001.FNT^FO715,330^FB100^AZN,73,73^FH^FD8^FS
^LRY^FO0,0^GB812,0,136^FS^LRN
^PQ1,0,1,Y^XZ


And here's the result (for demonstration purposes I changed the above format and made the first name Comic Sans, and made the icons 2/3 size). Yes, his last name is "DoNotDeletePlease", because people kept deleting my test family.

IMG_2809.jpg


Notes

Use caution! I have not put this in production (we don't use icons on labels), but I've done a lot of testing (this label was printed from V7.3). Make sure it works for you!

I tested several other Windows TrueType fonts. Arial and Comic Sans work using this method, but Wingdings and Symbol do not (the characters won't position correctly vertically). I'd speculate that most text fonts will work, but most symbol or icon fonts won't. It's possible there might be some positioning issues I haven't uncovered. Research continues...

Please contact me on the Slack forum if you have questions or suggestions.

Thanks so much to the Rock core team for the amazing job you're doing! You're the best! And thanks to the knowledgeable folks on the Slack forum. You’re a real fount of wisdom!


@lee_peterson
Spark Core Team

Spark Core Team. In a previous life I owned an auto repair shop. In the present I serve at Flatirons Community Church in Lafayette, CO as a volunteer fixer of broken things (not people -- that's up to Jesus!).