summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex')
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex44
1 files changed, 19 insertions, 25 deletions
diff --git a/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex b/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex
index 73f91aac43..eb1693b5ba 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex
@@ -1,14 +1,17 @@
% !TeX program = LuaTeX
-% Copyright (C) 2019 Roberto Giacomelli
+% Copyright (C) 2020 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
+\directlua{
+barracuda = require "barracuda"
+}
+
Test 1: Code 39 symbol with default parameters:
\directlua{
-local barracuda = require "barracuda"
-local c39, err = barracuda:get_barcode_class()
+local c39, err = barracuda:barcode()
:new_encoder("code39")
assert(not err, err)
@@ -19,17 +22,15 @@ local canvas = barracuda:new_canvas()
symbol:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\box\mybox
+}\box\mybox
Test 2: get the reference of the previous encoder and typeset two
Code 39 symbols on the same canvas, one above to the other:
\directlua{
-local barracuda = require "barracuda"
-local c39, err = barracuda:get_barcode_class()
+local c39, err = barracuda:barcode()
:enc_by_name("code39")
- assert(c39, err)
+assert(c39, err)
local s1, err = c39:from_string("ZKPQJ31"); assert(s1, err)
local s2, err = c39:from_string("RTFG746", {text_vpos="top"}); assert(s2, err)
@@ -41,17 +42,15 @@ local h2 = s2:get_param("height")
s2:append_ga(canvas, 0.0, h2 + tex.sp "5pt")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\box\mybox
+}\box\mybox
Test 3: with the same encoder print a symbol, change globally the height,
and reprint the same symbol again on the same canvas:
\directlua{
-local barracuda = require "barracuda"
-local c39, err = barracuda:get_barcode_class()
+local c39, err = barracuda:barcode()
:enc_by_name("code39")
- assert(c39, err)
+assert(c39, err)
local s1, err = c39:from_string("ZKPQJ31"); assert(s1, err)
@@ -66,17 +65,15 @@ s1:append_ga(canvas, 0.0, h + tex.sp "5pt")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\box\mybox
+}\box\mybox
Test 4: do the same in test 3 but change locally parameters as
height and text properties:
\directlua{
-local barracuda = require "barracuda"
-local c39, err = barracuda:get_barcode_class()
+local c39, err = barracuda:barcode()
:enc_by_name("code39")
- assert(c39, err)
+assert(c39, err)
local s1, err = c39:from_string("0123456789"); assert(s1, err)
@@ -95,16 +92,14 @@ s1:append_ga(canvas, 0.0, - tex.sp "5pt")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\box\mybox
+}\box\mybox
Test 5: create a new encoder with a large module value:
\directlua{
-local barracuda = require "barracuda"
-local barcode = barracuda:get_barcode_class()
+local barcode = barracuda:barcode()
-local c39, err = barcode:new_encoder("code39", "e2", {module = tex.sp "0.5mm"})
+local c39, err = barcode:new_encoder("code39:e2", {module = tex.sp "0.5mm"})
assert(c39, err)
local s1, err = c39:from_string("02040608"); assert(s1, err)
@@ -114,7 +109,6 @@ s1:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\box\mybox
+}\box\mybox
\bye