blob: 559dc9438379fe81276f80cc744e3a2ebd47b47d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
% !TeX program = LuaTeX
% Copyright (C) 2019 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
Test 4: check uint costructor:
\directlua{
barracuda = require "barracuda"
local c39, err = barracuda:get_barcode_class()
:new_encoder("code39")
assert(not err, err)
local err
local symbol
symbol, err = c39:from_uint(0, {text_hpos="center"})
assert(not err, err)
local canvas = barracuda:new_canvas()
symbol:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
\box\mybox
\directlua{
local c39, err = barracuda:get_barcode_class()
:enc_by_name("code39")
assert(c39, err)
local e
local symbol
symbol, e = c39:from_uint(0123456789, {text_hpos="spaced",text_star=true})
assert(not e, e)
local canvas = barracuda:new_canvas()
symbol:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
\box\mybox
\bye
|