Scalable text size to fit inputted font onto label


Not sure if this is possible, but I'm writing a light Windows application in C# to generate labels based on what the user types in. It's meant to circumvent having to use ZDesigner to get the positioning and measurements in place every time the user wants to create a simple text label. I generated the ZPL for the template with a $(text) field in place of the content and whatever the user types replaces it.

The only issue I'm having is accounting for various user inputs of different string sizes. Is there a ZPL command to do this with? Font doesn't matter so if a specific font is required then that's okay too. The edge cases wouldn't be ridiculous where they type absurdly long text, but to account for differences in strings like "Sample 184 FAM CPG 11/20/21" vs "Samples 220-280 Yakima Yellow 11/20/21" where the former is slightly shorter than the latter, and hopefully you can get the idea of how the text can vary without being too unrelated. I know the ^FB command exists but it doesn't seem to scale the text size itself.

Submitted by SSi1 on November 22, 2021 Permalink

The ^FB doesn't scale the size. Instead, it wraps around the text into multi-lines within the box to accommodate the variable length of string. In ZPL, there is no auto scale. The font and the size are prespecified by the ^A command. You can change the font by issuing a new ^A command with new font and size. The best bet to accommodate the variable length of string is the ^FB.