[barcode] Buglet in no-ascii PS output

Cloyce D. Spradling cloyce@headgear.org
Fri, 9 Nov 2001 18:27:32 -0600


I forgot to mention in my last message that the strings patch also fixes
a small buglet in the PostScript output when BARCODE_NO_ASCII is selected.
Basically, the opening square bracket and comments for the text are output
before the check for BARCODE_NO_ASCII.  It didn't make ghostscript or my
printer puke, but it does make the PS source look strange.

Here's a patch against vanilla 0.97 to fix it:

diff -ur barcode-0.97/ps.c barcode-0.97.ps/ps.c
--- barcode-0.97/ps.c   Sat Aug 11 12:52:24 2001
+++ barcode-0.97.ps/ps.c        Fri Nov  9 18:26:50 2001
@@ -214,13 +214,13 @@
        xpos += j * scalef;
     }
     fprintf(f,"\n]\t{ {} forall setlinewidth moveto 0 exch rlineto stroke} "
-           "bind forall\n"
-           "[\n%%   char    xpos   ypos fontsize\n");
+           "bind forall\n");
 
     /* Then, the text */
 
     mode = '-'; /* reinstantiate default */
     if (!(bc->flags & BARCODE_NO_ASCII)) {
+       fprintf(f, "[\n%%   char    xpos   ypos fontsize\n");
         k=0; /* k is the "previous font size" */
         for (ptr = bc->textinfo; ptr; ptr = strchr(ptr, ' ')) {
             while (*ptr == ' ') ptr++;

--
Cloyce