drawing a Barcode without a Barcode font

Mike Bonner bonnmike at gmail.com
Thu Jul 19 19:01:06 EDT 2018


Not sure if it will work for your purpose, but as a test I created for
graphic lines, 1 narrow black, 1 wider black, duplicated them and set the
blendlevel of the copies so that they're transparent.

Grcs are named narrowB, wideB, narrowC and wideC (b for black, c for clear)

Then used the following code (and your example string from above with the
WWnNw stuff) to generate a barcode.

on mouseup
   put empty into tLast
   put field 1 into tChars -- the field with your wNnnW string
   set the casesensitive to true -- to differentiate case of course
   repeat for each char tChar in tChars
      switch tChar
         case "N" -- checks the char, and clones the matching bar.
                        --if its the first time through, places it at a
start location
                        -- then uses the id of the most recent bar for
placement purposes
            clone grc "narrowB"
            if tLast is empty then
               set the topleft of the last grc to 10,50
            else
               set the topleft of the last grc to the topright of grc id
tLast
            end if
            break
         case "n"
            clone grc "narrowC"
            if tLast is empty then
               set the topleft of the last grc to 10,50
            else
               set the topleft of the last grc to the topright of grc id
tLast
            end if
            break
         case "W"
            clone grc "wideB"
            if tLast is empty then
               set the topleft of the last grc to 10,50
            else
               set the topleft of the last grc to the topright of grc id
tLast
            end if
            break
         case "w"
            clone grc "widec"
            if tLast is empty then
               set the topleft of the last grc to 10,50
            else
               set the topleft of the last grc to the topright of grc id
tLast
            end if
            break

      end switch
      put the short id of the last grc into tLast -- the id of the most
recently placed bar
   end repeat
end mouseup

Spacing and line size might need to be tweaked, but it seems like this
would be relatively straight forward.

On Thu, Jul 19, 2018 at 4:30 PM Bob Sneidar via use-livecode <
use-livecode at lists.runrev.com> wrote:

> I think the trick will be drawing large graphics one at a time and
> properly spaced at several times their finished size, perhaps off screen,
> then getting a snapshot of the result and scaling it down. Not sure how
> picky the readers will be.
>
> Bob S
>
>
> > On Jul 19, 2018, at 15:06 , Matthias Rebbe via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > Currently i am using a special 2of5i barcode font. The font .has only
> four characters (bars) in its set.
> > The code displays a
> > narrow space (blank) bar when the character is n
> > narrow black bar when N
> > wide space when w
> > wide black bar when W
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list