Calculate Width of Scalable Font


Audience

I am using font 0 (zero) and cannot figure out how I can pre-determine whether a given font size and phrase will be too long for the badges that I am printing.
 
A good example can be seen here:
 
http://labelary.com/viewer.html?density=8&width=4&height=3&units=inches…
 
Both words are 13 characters long and both have the same font size for height and width - but the "MASSACHUSETTS" line is too long.
 
Is there a way to calculate, ahead of time (meaning before I send the ZPL code to the printer) the total width of Zebra Font 0 with given text and font size?

Submitted by George Tziros on April 27, 2020 Permalink

Thanks Robin, What I'm trying to do is give our customers a virtual printer. This is for testing only where a physical printer is not available. i.e. For testing at home!
To recreate an exact duplicate of the printed label I need the 0 font off the printer and then I can include it in the ZPL for printing to the screen. If that is possible?
Thanks

Submitted by George Tziros on April 24, 2020 Permalink

I would also like to unload the 0 scaleable font from a Zebra printer so that i can include it in the ZPL code using the ~DS command.
Is this possible?
Is the default 0 scaleble font one of the FNT files on the Z drive on the printer?
Thanks

Submitted by Anonymous Anonymous on March 05, 2020 Permalink

I have the same issue.
Is it possible to extract the Font0 from the Printer or download it somewhere from the Internet?
If that is possible, I could read chracter widths from the font file itself and create a function to calculate text wide (and so it would be possible to calculate text size which fits whole text on the label).
Printing and measuring every character manually is not an option as we are using a wide range of chracters (not only a-Z).

Submitted by Anonymous (not verified) on May 04, 2019 Permalink

Hi Craig,
You are not, but we don't really have a good answer for you.  Fonts are much more complicated than most people realize.  Determining the printed width of a string using a scaleable font essentially requires using a font engine to actually create the bitmap and size it.  I can see if we can get you more info on font 0 specifically, but you will essentially have to calculate the width character by character.  It would be easier to use a monospace scaleable font like "Courier New".  Unfortunately we only have monospcace bitmap fonts, which are not fully scalable by default on the printer. 
We do have a few essentially for free.  Let me know if you want one.  You can also convert several of the free Google fonts for use in our printers.