Make text in ZPL label bold or underlined?

前端 未结 2 458
轻奢々
轻奢々 2021-02-07 09:32

Due to a new EU law every food packaging label has to outline possible allergy-causing ingredients by either styling them bold or underlined in the ingredients

相关标签:
2条回答
  • 2021-02-07 09:38

    To underline - use a monospaced font like AA,AC,AD,AF or AG

    Use

    ^FO350,50^AGR^FDwhatever,milk,butter,salt^FS
    ^FO340,50^AGR^FD         ____ ______^FS
    

    where the underline here is under milk and butter, you can adjust the offset by trimming the FO's X and Y positions by a few dots (10 X here)

    On further investigation, I found

    To bold

    Use an old dot-matrix-printer trick. Still using fixed-pitch font, reprint the text but replacing the non-bold characters with spaces and adjust the X-position by 1 or 2 dots, reprint again with the Y-position adjusted by 1 o2 2 dots.

    ^FO350,50^AGR^FDwhatever,milk,butter,salt^FS
    ^FO348,50^AGR^FD         milk butter^FS
    ^FO350,52^AGR^FD         milk butter^FS
    

    To underline, draw a graphics box below the required letters. This is relatively easy to calculate since the width of each letter is constant.

    ^FO345,490^GB0,160,4^FS
    ^FO345,690^GB0,240,4^FS
    

    I tested using an A300 and 8"*3" labels, so I needed to rotate the text, hence some odd calculations. The manual does not show the ^FS, even in the examples but I found it was required.

    0 讨论(0)
  • 2021-02-07 09:43

    You could also try and make the font width grow a little:

    ^A0N,18,20
    

    "^A" starts the font setting, where "0" is the embedded font, "N" the rotation, "18" the height and "20" the font width. The last one is 10 by default. So you're actually making the font wider, which results in a form of bold...

    It may not affect the lines that are printed horizontally, but you will get a sense of bold.

    (I know it's an 'old' topic, but I just wanted to share)

    0 讨论(0)
提交回复
热议问题