% !TeX program = LuaTeX
% Copyright (C) 2020 Roberto Giacomelli

\newbox\mybox
\nopagenumbers

\directlua{barracuda = require "barracuda"}


Test 2: Interleaved 2 of 5 encoder test for ITF14 variant.

\directlua{
local barcode = barracuda:barcode()
local enc = assert(barcode:new_encoder("i2of5-ITF14"))
local s1 = assert(enc:from_uint(1234567890123))

local canvas = barracuda:new_canvas()
s1:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
\vskip 10pt
12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule

\directlua{
local barcode = barracuda:barcode()
local enc = assert(barcode:enc_by_name("i2of5-ITF14"))
local s1 = assert(enc:from_string("1234567890123"))

local canvas = barracuda:new_canvas()
s1:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
\vskip 10pt
12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule

\directlua{
local barcode = barracuda:barcode()
local enc = assert(barcode:enc_by_name("i2of5-ITF14"))
local s1 = assert(enc:from_string("(12) 34 56 78 90 12 3"))

local canvas = barracuda:new_canvas()
s1:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
\vskip 10pt
12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule

\bye


