import argparse

def makeBarcode(label, print_bc):
    print("^XA") #start of label
    print("^DFFORMAT^FS") #download and store format, name of format, end of field data (FS = field stop)
    print("^LH0,0") # label home position (label home = LH) 
    if print_bc:
        print("^FO400,20^AFN,60,20^FN1^FS") #AF = assign font F, field number 1 (FN1), print text at position field origin (FO) rel. to home
        print("^FO120,5^BCN,70,N,N^FN2^FS") #BC=barcode 128, field number 2, Normal orientation, height 70, no interpreation line.
    else:
        if len(label) > 21:
            print("^FO20,20^AEN,60,20^FN1^FS") #AF = assign font F, field number 1 (FN1), print text at position field origin (FO) rel. to home
        else:
            print("^FO20,20^ADN,60,20^FN1^FS") #AF = assign font F, field number 1 (FN1), print text at position field origin (FO) rel. to home
    print("^XZ") #end format
    print("^XA") #start of label format
    print("^XFFORMAT^FS") #label home posision
    print("^FN1^FD{}^FS".format(label)) #this is readable
    if print_bc:
        print("^FN2^FD{}^FS".format(label)) #this is the barcode
    print("^XZ")

def main(args):
    n = args.num
    if n > 0 and n < 20:
        for _ in range(n):
            makeBarcode(args.label, args.bc)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Format a label with barcode for the Zebra printer")
    parser.add_argument("label", help="The text to print as barcode and text")
    parser.add_argument("-t", "--text-only", help="Skip barcode and only print label in text",
                        action="store_false", default=True, dest="bc")
    parser.add_argument("-n", "--num", help="Number of copies to print",
                        action="store", type=int, default=1, dest="num")
    args = parser.parse_args()
    main(args)

@@ -54,32 +54,33 @@
   print(%22%5EXA%22) #
+ 
 start of label%0A 
@@ -105,16 +105,17 @@
 T%5EFS%22) #
+ 
 download
@@ -300,32 +300,33 @@
 60,20%5EFN1%5EFS%22) #
+ 
 AF = assign font
@@ -450,16 +450,17 @@
 2%5EFS%22) #
+ 
 BC=barco
@@ -483,17 +483,17 @@
 mber 2, 
-N
+n
 ormal or
@@ -525,16 +525,17 @@
 interpre
+t
 ation li
@@ -540,32 +540,53 @@
 line.%0A    else:%0A
+        ch_size=%2232%22%0A
         if len(l
@@ -597,10 +597,10 @@
 ) %3E 
+4
 2
-1
 :%0A  
@@ -613,158 +613,161 @@
     
-print(%22%5EFO20,20%5EAEN,60,20%5EFN1%5EFS%22) #AF = assign font F, field number 1 (FN1), print text at position field origin (FO) rel. to home%0A        else:%0A    
+ch_size = 24%0A        elif len(label) %3C 20:%0A            ch_size = 40%0A        # Scalable font %5EA0N,32,32 should fit roughly 42 chars on our current labels%0A
     
@@ -787,126 +787,176 @@
 O20,
-20%5EADN,60,20%5EFN1%5EFS%22) #AF = assign font F, field number 1 (FN1), print text at position field origin (FO) rel. to home
+40%5EA0N,%7B0%7D,%7B0%7D%5EFB640,1,0,C,0%5EFN1%5EFS%22.format(ch_size)) # FO = x,y relative field origin; A0N = scalable font height,width; FB = make into one line field block and center
 %0A   
@@ -970,16 +970,17 @@
 %22%5EXZ%22) #
+ 
 end form
@@ -1000,16 +1000,17 @@
 %22%5EXA%22) #
+ 
 start of
@@ -1050,16 +1050,17 @@
 T%5EFS%22) #
+ 
 label ho
@@ -1104,32 +1104,33 @@
 format(label)) #
+ 
 this is readable
@@ -1192,16 +1192,17 @@
 abel)) #
+ 
 this is 

Use scalable font for text-only labels