% !TeX program = LuaTeX
% Copyright (C) 2019-2022 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:draw(canvas)
canvas:ga_to_hbox("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:draw(canvas)
canvas:ga_to_hbox("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"))
s1:set_param("debug_bbox_on", true)
local canvas = barracuda:new_canvas()
s1:draw(canvas)
canvas:ga_to_hbox("mybox")
canvas:save("svg", "02-itf14")
}
\vskip 10pt
12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule
\bye
