summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/barracuda/test/test-code39
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/barracuda/test/test-code39')
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua6
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdfbin22618 -> 22701 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex44
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdfbin19827 -> 19827 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex19
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdfbin15243 -> 15329 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex16
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua2
8 files changed, 37 insertions, 50 deletions
diff --git a/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua b/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua
index e4a8569e93..a9d8894ba0 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua
+++ b/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua
@@ -1,4 +1,4 @@
--- Copyright (C) 2019 Roberto Giacomelli
+-- Copyright (C) 2020 Roberto Giacomelli
-- test Code 39 encoder
local barracuda = require "barracuda"
@@ -7,7 +7,7 @@ for k, v in pairs(barracuda) do
print(k,v)
end
-local barcode = barracuda:get_barcode_class()
+local barcode = barracuda:barcode()
local c39, err = barcode:new_encoder("code39")
assert(not err, err)
@@ -27,7 +27,7 @@ end
local symb = c39:from_string("123")
print("print internal representation of chars")
-for _, c in ipairs(symb.code) do
+for _, c in ipairs(symb._code_data) do
print(c)
end
print()
diff --git a/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdf b/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdf
index 060a61e892..63ced9a342 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdf
Binary files differ
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
diff --git a/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdf b/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdf
index 66b04e61e3..544a4b34ff 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex b/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex
index a4ba3d6e81..884cdd0df4 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex
@@ -1,20 +1,18 @@
% !TeX program = LuaTeX
-% Copyright (C) 2019 Roberto Giacomelli
+% Copyright (C) 2020 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
-Test 3: the same Code 39 symbol drawing multiple time on the same canvas
+Test 1: the same Code 39 symbol drawing multiple time on the same canvas
\directlua{
local 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_string("ABCDEF12QJ31+")
-assert(not err, err)
+local c39 = assert(
+ barracuda:barcode()
+ :new_encoder("code39")
+)
+local symbol = assert(c39:from_string("ABCDEF12QJ31+"))
local ok, err = c39:set_param("text_vpos", "top")
assert(ok, err)
@@ -46,8 +44,7 @@ symbol:append_ga(canvas, tex.sp "9.0cm", tex.sp "-2.0cm")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\box\mybox
+}\box\mybox
\bye
diff --git a/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdf b/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdf
index 3c96d9233b..0e5bfa42d0 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex b/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex
index 559dc94383..9066d4dee8 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex
@@ -1,14 +1,14 @@
% !TeX program = LuaTeX
-% Copyright (C) 2019 Roberto Giacomelli
+% Copyright (C) 2020 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
-Test 4: check uint costructor:
+Test 1: check uint costructor:
\directlua{
barracuda = require "barracuda"
-local c39, err = barracuda:get_barcode_class()
+local c39, err = barracuda:barcode()
:new_encoder("code39")
assert(not err, err)
local err
@@ -21,11 +21,10 @@ symbol:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\box\mybox
+}\box\mybox
\directlua{
-local c39, err = barracuda:get_barcode_class()
+local c39, err = barracuda:barcode()
:enc_by_name("code39")
assert(c39, err)
local e
@@ -38,9 +37,6 @@ symbol:append_ga(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\box\mybox
+}\box\mybox
\bye
-
-
diff --git a/macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua b/macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua
index d33ad4ffaf..1b8ee9f4a1 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua
+++ b/macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua
@@ -2,7 +2,7 @@
local cm = 1864679.8110236 -- sp
local barracuda = require "barracuda"
-local c39, err = barracuda:get_barcode_class()
+local c39, err = barracuda:barcode()
:new_encoder("code39")
assert(not err, err)
local err