| 1 |
% !TeX program = LuaTeX |
| 2 |
% Copyright (C) 2019-2022 Roberto Giacomelli |
| 3 |
|
| 4 |
\newbox\mybox |
| 5 |
\nopagenumbers |
| 6 |
|
| 7 |
\directlua{ |
| 8 |
barracuda = require "barracuda" |
| 9 |
local c39 = assert( |
| 10 |
barracuda:barcode() |
| 11 |
:new_encoder("code39", {debug_bbox_on = true}) |
| 12 |
) |
| 13 |
|
| 14 |
local bars = c39:new { |
| 15 |
123456, |
| 16 |
"123456", |
| 17 |
"ABCDEF", |
| 18 |
87429, |
| 19 |
982398, |
| 20 |
"HDUHBE" |
| 21 |
} |
| 22 |
|
| 23 |
local canvas = barracuda:new_canvas() |
| 24 |
local tx, ty = 0, 0 |
| 25 |
local dh = tex.sp "40pt" |
| 26 |
for _, b in ipairs(bars) do |
| 27 |
b:draw(canvas, tx, ty) |
| 28 |
ty = ty + dh |
| 29 |
end |
| 30 |
|
| 31 |
local drv = barracuda:get_driver() |
| 32 |
drv:ga_to_hbox(canvas, "mybox") |
| 33 |
} |
| 34 |
|
| 35 |
Test 1: check Barcode recursive costructor new(): |
| 36 |
\bigskip |
| 37 |
\leavevmode\box\mybox |
| 38 |
\bye |
| 39 |
|