| 1 |
% !TeX program = LuaTeX |
| 2 |
% Copyright (C) 2019-2022 Roberto Giacomelli |
| 3 |
% test Code 39 encoder |
| 4 |
|
| 5 |
\directlua{ |
| 6 |
local barracuda = require "barracuda" |
| 7 |
|
| 8 |
for k, v in pairs(barracuda) do |
| 9 |
print(k, v) |
| 10 |
end |
| 11 |
|
| 12 |
local barcode = barracuda:barcode() |
| 13 |
|
| 14 |
local c39, err = barcode:new_encoder("code39") |
| 15 |
assert(not err, err) |
| 16 |
|
| 17 |
print(c39._NAME) |
| 18 |
print(c39._VERSION) |
| 19 |
|
| 20 |
local info = c39:info() |
| 21 |
|
| 22 |
print("encoder name = ", info.name) |
| 23 |
print("description = ", info.description) |
| 24 |
for k, tp in ipairs(info.param) do |
| 25 |
print(k, tp.name, tp.value) |
| 26 |
end |
| 27 |
|
| 28 |
local symb = c39:from_string("123") |
| 29 |
|
| 30 |
print("print internal representation of chars") |
| 31 |
print(table.concat(symb:get_code(), " ")) |
| 32 |
print("end") |
| 33 |
assert(symb:get_hri() == nil) |
| 34 |
|
| 35 |
local canvas = barracuda:new_canvas() |
| 36 |
symb:draw(canvas) |
| 37 |
% canvas:prettyprint_ga() |
| 38 |
} |
| 39 |
\bye |