Calculate Width of Scalable Font

C Craig Anderson 3 years 7 months ago
521 7 0

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?

Please Register or Login to post a reply

7 Replies

D Duong Geraldo

You can find a solution on https://studenterra.com/, I've always asked for help there.

G George Tziros

OK I understand thanks.
What did you mean by the CG font is the closest i could get?
Thanks

G George Tziros

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

G George Tziros

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

A Anonymous Anonymous

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).

C Craig Anderson

I can't imagine I'm the only person who needs to do this?

Y Yanis Dalabiras

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.

CONTACT
Can’t find what you’re looking for?