summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/barracuda/test
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/generic/barracuda/test')
-rw-r--r--macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdfbin3810 -> 4047 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex17
-rw-r--r--macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex2
-rw-r--r--macros/luatex/generic/barracuda/test/test-code128/001-code128-test.tex (renamed from macros/luatex/generic/barracuda/test/test-code128/001-code128-test.lua)25
-rw-r--r--macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdfbin22132 -> 24385 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex114
-rw-r--r--macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt8
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/001-code39-test.tex (renamed from macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua)26
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/002-code39-test.pdfbin22701 -> 23271 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/002-code39-test.tex35
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/003-code39-test.pdfbin19827 -> 19829 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/003-code39-test.tex18
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/004-code39-test.pdfbin15329 -> 15341 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/004-code39-test.tex11
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/006-code39-test.lua12
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/007-code39-test.pdfbin0 -> 18589 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-code39/007-code39-test.tex39
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdfbin23620 -> 23924 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex29
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdfbin10601 -> 10674 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdfbin3901 -> 3986 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/004-ean-test.tex (renamed from macros/luatex/generic/barracuda/test/test-ean/004-ean-test.lua)11
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdfbin19829 -> 19910 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdfbin14883 -> 15099 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex20
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg16
-rw-r--r--macros/luatex/generic/barracuda/test/test-ean/ars.svg16
-rw-r--r--macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdfbin30290 -> 30029 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex222
-rw-r--r--macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.pdfbin0 -> 15101 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.tex69
-rw-r--r--macros/luatex/generic/barracuda/test/test-ga-pdfliteral/polygon.svg132
-rw-r--r--macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua2
-rw-r--r--macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdfbin19136 -> 20158 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex59
-rw-r--r--macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdfbin16052 -> 16541 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex23
-rw-r--r--macros/luatex/generic/barracuda/test/test-i2of5/02-itf14.svg76
-rw-r--r--macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.pdfbin0 -> 14087 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.tex48
-rw-r--r--macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.pdfbin0 -> 1130 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.tex41
-rw-r--r--macros/luatex/generic/barracuda/test/test-libgeo/test.svg79
-rw-r--r--macros/luatex/generic/barracuda/test/test-upc/001-upca-test.pdfbin0 -> 17692 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-upc/001-upca-test.tex41
-rw-r--r--macros/luatex/generic/barracuda/test/test-upc/002-upca.pdfbin0 -> 3344 bytes
-rw-r--r--macros/luatex/generic/barracuda/test/test-upc/002-upca.tex9
47 files changed, 899 insertions, 301 deletions
diff --git a/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdf b/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdf
index b05ed417eb..9da41b5c50 100644
--- a/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex b/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex
index 8932f9eaaf..ba055eb9d5 100644
--- a/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-barracuda-package/01-barracuda-latex-test.tex
@@ -1,7 +1,7 @@
% !TeX program = LuaLaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
-% test file: make a Code39 barcodes in a LaTeX document
+% test file: make Code39 barcodes in a LaTeX document
\documentclass{article}
\usepackage{barracuda}
@@ -10,6 +10,17 @@
A\barracuda{code39}{123QWE}A
B\barracuda[text_vpos='top']{code39}{123QWE}B
-\end{document}
+%\barracudasetup[option]{ treename }
+
+\directlua{
+local barracuda = require "barracuda"
+local barcode = barracuda:barcode()
+local code39 = assert(barcode:enc_by_name("code39"))
+assert(code39:set_param{debug_bbox = "qz"})
+}\bigskip
+
+A\barracuda{code39}{123QWE}A
+B\barracuda[text_vpos='top']{code39}{123QWE}B
+\end{document}
diff --git a/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex b/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex
index 1b5d6509d4..89236a8bfc 100644
--- a/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-barracuda-package/02-ord_iter-test.tex
@@ -1,5 +1,5 @@
% !TeX program = LuaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
\directlua{
local barracuda = require "barracuda"
diff --git a/macros/luatex/generic/barracuda/test/test-code128/001-code128-test.lua b/macros/luatex/generic/barracuda/test/test-code128/001-code128-test.tex
index 33dd927dc7..335b880d5b 100644
--- a/macros/luatex/generic/barracuda/test/test-code128/001-code128-test.lua
+++ b/macros/luatex/generic/barracuda/test/test-code128/001-code128-test.tex
@@ -1,10 +1,11 @@
--- Copyright (C) 2020 Roberto Giacomelli
+% !TeX program = LuaTeX
+% Copyright (C) 2019-2022 Roberto Giacomelli
+\directlua{
local barracuda = require "barracuda"
local barcode = barracuda:barcode()
-local c128, err = barcode:new_encoder("code128")
-assert(not err, err)
-
+local c128 = assert(barcode:new_encoder("code128"))
+print()
print(c128._NAME)
print(c128._VERSION)
@@ -15,18 +16,24 @@ for k, tp in ipairs(info.param) do
print(k, tp.name, tp.value)
end
-local symb = c128:from_string("123")
+local symb = c128:new("123")
print("Symbol char list:")
-for _, c in ipairs(symb._code_data) do
+for _, c in ipairs(symb:get_code()) do
+ print(c)
+end
+print("Symbol hri char list:")
+for _, c in ipairs(symb:get_hri()) do
print(c)
end
+
local canvas = barracuda:new_canvas()
-symb:append_ga(canvas)
+symb:draw(canvas)
--- driver library
+% driver library
local drv = barracuda:get_driver()
drv:save("svg", canvas, "c128-123")
-
+}
+\bye
diff --git a/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdf b/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdf
index 4cf993a396..731c7ca279 100644
--- a/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex b/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex
index b5c081659e..9bb3915908 100644
--- a/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-code128/002-code128-test.tex
@@ -1,12 +1,12 @@
% !TeX program = LuaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
Code 128 encoder test.
-Test 1: one simple barcode with default parameter:
+Test 1: one simple barcode with default parameters:
\directlua{
barracuda = require "barracuda"
@@ -14,7 +14,7 @@ barracuda = require "barracuda"
\directlua{
local barcode = barracuda:barcode()
-
+barcode:set_param{debug_bbox="symb"}
local c128, err = barcode:new_encoder("code128")
assert(not err, err)
@@ -22,7 +22,7 @@ local symbo, err = c128:from_string("5465468132546812")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
@@ -51,8 +51,8 @@ local s2_ax = s2:get_param("ax")
assert(s2.ax == 0, "0 ax is "..tostring(s2.ax))
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
-s2:append_ga(canvas)
+s1:draw(canvas)
+s2:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
@@ -69,13 +69,13 @@ assert(c128, err)
local s, err = c128:from_string("123456"); assert(s, err)
local canvas = barracuda:new_canvas()
-s:append_ga(canvas)
+s:draw(canvas)
local ok, err = s:set_param("ydim", tex.sp "30mm")
-s:append_ga(canvas, tex.sp "20mm")
+s:draw(canvas, tex.sp "20mm")
local ok, err = s:set_param("ydim", tex.sp "60mm")
-s:append_ga(canvas, tex.sp "40mm")
+s:draw(canvas, tex.sp "40mm")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
@@ -93,14 +93,14 @@ local c128, err = barcode:enc_by_name "code128"; assert(c128, err)
local s, err = c128:from_string("ABCDEFGHI"); assert(s, err)
local canvas = barracuda:new_canvas()
-local _, err = s:append_ga(canvas); assert(not err, err)
+local _, err = s:draw(canvas); assert(not err, err)
% set ay to 0.5 for the encoder
local ok, err = c128:set_param("ay", 0.5); assert(ok, err)
-local _, err = s:append_ga(canvas, tex.sp "30mm"); assert(not err, err)
+local _, err = s:draw(canvas, tex.sp "30mm"); assert(not err, err)
% set locally to the symbol ay to 1.0
local ok, err = s:set_param("ay", 1)
-local _, err = s:append_ga(canvas, tex.sp "60mm"); assert(not err, err)
+local _, err = s:draw(canvas, tex.sp "60mm"); assert(not err, err)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
@@ -114,14 +114,96 @@ local c128, err = barcode:enc_by_name("code128");
assert(c128, err)
local s, e = c128:from_uint(1234567890); assert(s, e)
local canvas = barracuda:new_canvas()
-local _, errc = s:append_ga(canvas); assert(not errc, errc)
+local _, errc = s:draw(canvas); assert(not errc, errc)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
drv:save("native", canvas, "02-05-pdfliteral")
}\box\mybox
-That's all folks!
+Test 6: encode ABC123:
-\bye
+\directlua{
+local barcode = barracuda:barcode()
+local c128, err = barcode:enc_by_name "code128"; assert(c128, err)
+local s, err = c128:from_string("ABC123"); assert(s, err)
+
+local canvas = barracuda:new_canvas()
+local _, err = s:draw(canvas); assert(not err, err)
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}\box\mybox
+
+Test 7: encode ABC123999:
+
+\directlua{
+local barcode = barracuda:barcode()
+local c128, err = barcode:enc_by_name "code128"; assert(c128, err)
+local s, err = c128:from_string("ABC123999"); assert(s, err)
+
+local canvas = barracuda:new_canvas()
+local _, err = s:draw(canvas); assert(not err, err)
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}\box\mybox
+
+Test 8: encode ABC123456789:
+
+\directlua{
+local barcode = barracuda:barcode()
+local c128, err = barcode:enc_by_name "code128"; assert(c128, err)
+local s, err = c128:from_string("ABC123456789"); assert(s, err)
+
+local canvas = barracuda:new_canvas()
+local _, err = s:draw(canvas); assert(not err, err)
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}\box\mybox
+
+Test 9: encode A1B2C3D999:
-function Driver:save(id_drv, ga, filename, ext) --> ok, err \ No newline at end of file
+\directlua{
+local barcode = barracuda:barcode()
+local c128, err = barcode:enc_by_name "code128"; assert(c128, err)
+local s, err = c128:from_string("A1B2C3D999"); assert(s, err)
+
+local canvas = barracuda:new_canvas()
+local _, err = s:draw(canvas); assert(not err, err)
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}\box\mybox
+
+Test 10: encode 123abcedfg:
+
+\directlua{
+local barcode = barracuda:barcode()
+local c128, err = barcode:enc_by_name "code128"; assert(c128, err)
+local s, err = c128:from_string("123abcedfg"); assert(s, err)
+
+local canvas = barracuda:new_canvas()
+local _, err = s:draw(canvas); assert(not err, err)
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}\box\mybox
+
+Test 11: encode 999Aaaa:
+
+\directlua{
+local barcode = barracuda:barcode()
+barcode:set_param{debug_bbox="none"}
+local c128, err = barcode:enc_by_name "code128"; assert(c128, err)
+local s, err = c128:from_string("999Aaaa"); assert(s, err)
+
+local canvas = barracuda:new_canvas()
+local _, err = s:draw(canvas); assert(not err, err)
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}\box\mybox
+
+That's all folks!
+\bye
diff --git a/macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt b/macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt
index fe16d33c50..894b9f1d4a 100644
--- a/macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt
+++ b/macros/luatex/generic/barracuda/test/test-code128/02-05-pdfliteral.txt
@@ -1,4 +1,8 @@
q
+1.000000 w
+0 J
+0 j
+[] 0 d
-53.574521 -14.173154 1.190545 28.346308 re
-51.788704 -14.173154 0.595272 28.346308 re
-50.002887 -14.173154 1.785817 28.346308 re
@@ -40,4 +44,8 @@ S
-1.190545 -14.173154 1.190545 28.346308 re
f
S
+0.100000 w
+[6.000000 3.000000] 3.000000 d
+-53.524521 -14.123154 53.474521 28.246308 re S
+[] 0 d
Q \ No newline at end of file
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.tex
index a9d8894ba0..c08e1f242a 100644
--- a/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.lua
+++ b/macros/luatex/generic/barracuda/test/test-code39/001-code39-test.tex
@@ -1,10 +1,12 @@
--- Copyright (C) 2020 Roberto Giacomelli
--- test Code 39 encoder
+% !TeX program = LuaTeX
+% Copyright (C) 2019-2022 Roberto Giacomelli
+% test Code 39 encoder
+\directlua{
local barracuda = require "barracuda"
for k, v in pairs(barracuda) do
- print(k,v)
+ print(k, v)
end
local barcode = barracuda:barcode()
@@ -19,7 +21,6 @@ local info = c39:info()
print("encoder name = ", info.name)
print("description = ", info.description)
-
for k, tp in ipairs(info.param) do
print(k, tp.name, tp.value)
end
@@ -27,15 +28,12 @@ end
local symb = c39:from_string("123")
print("print internal representation of chars")
-for _, c in ipairs(symb._code_data) do
- print(c)
-end
-print()
+print(table.concat(symb:get_code(), " "))
+print("end")
+assert(symb:get_hri() == nil)
local canvas = barracuda:new_canvas()
-symb:append_ga(canvas)
-
--- native driver
-local drv = barracuda:get_driver()
-
-for _, code in ipairs(canvas._data) do print(code) end
+symb:draw(canvas)
+% canvas:prettyprint_ga()
+}
+\bye
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 63ced9a342..c114e9339f 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 eb1693b5ba..f242fafa4d 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,5 +1,5 @@
% !TeX program = LuaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
@@ -19,10 +19,10 @@ local symbol, err = c39:from_string("ABC12QJ31")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbol:append_ga(canvas)
+symbol:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}\box\mybox
+}\leavevmode\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:
@@ -36,13 +36,13 @@ local s1, err = c39:from_string("ZKPQJ31"); assert(s1, err)
local s2, err = c39:from_string("RTFG746", {text_vpos="top"}); assert(s2, err)
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
+s1:draw(canvas)
local h2 = s2:get_param("height")
-s2:append_ga(canvas, 0.0, h2 + tex.sp "5pt")
+s2:draw(canvas, 0.0, h2 + tex.sp "5pt")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}\box\mybox
+}\leavevmode\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:
@@ -55,17 +55,17 @@ assert(c39, err)
local s1, err = c39:from_string("ZKPQJ31"); assert(s1, err)
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
+s1:draw(canvas)
local h = s1:get_param("height")
c39:set_param("height", 2*h)
c39:set_param {text_vpos = "top"}
-s1:append_ga(canvas, 0.0, h + tex.sp "5pt")
+s1:draw(canvas, 0.0, h + tex.sp "5pt")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}\box\mybox
+}\leavevmode\box\mybox
Test 4: do the same in test 3 but change locally parameters as
height and text properties:
@@ -78,7 +78,7 @@ assert(c39, err)
local s1, err = c39:from_string("0123456789"); assert(s1, err)
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
+s1:draw(canvas)
local h, err = s1:get_param("height"); assert(h, err)
local ok, err = s1:set_param{
height = h/2,
@@ -88,27 +88,30 @@ local ok, err = s1:set_param{
text_star = true,
ay = 1,
}; assert(ok, err)
-s1:append_ga(canvas, 0.0, - tex.sp "5pt")
+s1:draw(canvas, 0.0, - tex.sp "5pt")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}\box\mybox
+}\leavevmode\box\mybox
-Test 5: create a new encoder with a large module value:
+Test 5: create a new encoder with a large module value.
+It's also activeted the debug\_bbox\_on option.
+
+\bigskip
\directlua{
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", debug_bbox_on = true})
assert(c39, err)
local s1, err = c39:from_string("02040608"); assert(s1, err)
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
+s1:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}\box\mybox
+}\leavevmode\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 544a4b34ff..3dcd314a4a 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 884cdd0df4..d9df0e8110 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,5 +1,5 @@
% !TeX program = LuaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
@@ -18,33 +18,35 @@ local ok, err = c39:set_param("text_vpos", "top")
assert(ok, err)
local canvas = barracuda:new_canvas()
-symbol:append_ga(canvas)
+symbol:draw(canvas)
local ok, err = symbol:set_param("text_hpos", "center")
assert(ok, err)
-symbol:append_ga(canvas, tex.sp "4.5cm")
+symbol:draw(canvas, tex.sp "4.5cm")
local ok, err = symbol:set_param("text_hpos", "right")
assert(ok, err)
-symbol:append_ga(canvas, tex.sp "9.0cm")
+symbol:draw(canvas, tex.sp "9.0cm")
local ok, err = c39:set_param("text_vpos", "bottom")
assert(ok, err)
local ok, err = symbol:set_param("text_hpos", "left")
-symbol:append_ga(canvas, 0, tex.sp "-2.0cm")
+symbol:draw(canvas, 0, tex.sp "-2.0cm")
local ok, err = symbol:set_param("text_hpos", "center")
assert(ok, err)
-symbol:append_ga(canvas, tex.sp "4.5cm", tex.sp "-2.0cm")
+symbol:draw(canvas, tex.sp "4.5cm", tex.sp "-2.0cm")
local ok, err = symbol:set_param("text_hpos", "right")
assert(ok, err)
-symbol:append_ga(canvas, tex.sp "9.0cm", tex.sp "-2.0cm")
+symbol:draw(canvas, tex.sp "9.0cm", tex.sp "-2.0cm")
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}\box\mybox
+}
+\bigskip
+\leavevmode\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 0e5bfa42d0..660dd4a1fa 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 9066d4dee8..1af5fdaaa0 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,5 +1,5 @@
% !TeX program = LuaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
@@ -17,11 +17,11 @@ symbol, err = c39:from_uint(0, {text_hpos="center"})
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbol:append_ga(canvas)
+symbol:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}\box\mybox
+}\bigskip\leavevmode\box\mybox
\directlua{
local c39, err = barracuda:barcode()
@@ -33,10 +33,9 @@ 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)
+symbol:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}\box\mybox
-
+}\bigskip\leavevmode\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 1b8ee9f4a1..0ad6169fca 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
@@ -14,29 +14,29 @@ local ok, err = c39:set_param("text_vpos", "top")
assert(ok, err)
local canvas = barracuda:new_canvas()
-symbol:append_ga(canvas)
+symbol:draw(canvas)
local ok, err = symbol:set_param("text_hpos", "center")
assert(ok, err)
-symbol:append_ga(canvas, 4.5*cm)
+symbol:draw(canvas, 4.5*cm)
local ok, err = symbol:set_param("text_hpos", "right")
assert(ok, err)
-symbol:append_ga(canvas, 9.0*cm)
+symbol:draw(canvas, 9.0*cm)
local ok, err = c39:set_param("text_vpos", "bottom")
assert(ok, err)
local ok, err = symbol:set_param("text_hpos", "left")
-symbol:append_ga(canvas, 0, -2.0*cm)
+symbol:draw(canvas, 0, -2.0*cm)
local ok, err = symbol:set_param("text_hpos", "center")
assert(ok, err)
-symbol:append_ga(canvas, 4.5*cm, -2.0*cm)
+symbol:draw(canvas, 4.5*cm, -2.0*cm)
local ok, err = symbol:set_param("text_hpos", "right")
assert(ok, err)
-symbol:append_ga(canvas, 9.0*cm, -2.0*cm)
+symbol:draw(canvas, 9.0*cm, -2.0*cm)
local drv = barracuda:get_driver()
drv:save("svg", canvas, "006-six")
diff --git a/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.pdf b/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.pdf
new file mode 100644
index 0000000000..e49b38b256
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.tex b/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.tex
new file mode 100644
index 0000000000..5090e54058
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-code39/007-code39-test.tex
@@ -0,0 +1,39 @@
+% !TeX program = LuaTeX
+% Copyright (C) 2019-2022 Roberto Giacomelli
+
+\newbox\mybox
+\nopagenumbers
+
+\directlua{
+barracuda = require "barracuda"
+local c39 = assert(
+ barracuda:barcode()
+ :new_encoder("code39", {debug_bbox_on = true})
+)
+
+local bars = c39:new {
+ 123456,
+ "123456",
+ "ABCDEF",
+ 87429,
+ 982398,
+ "HDUHBE"
+}
+
+local canvas = barracuda:new_canvas()
+local tx, ty = 0, 0
+local dh = tex.sp "40pt"
+for _, b in ipairs(bars) do
+ b:draw(canvas, tx, ty)
+ ty = ty + dh
+end
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}
+
+Test 1: check Barcode recursive costructor new():
+\bigskip
+\leavevmode\box\mybox
+\bye
+
diff --git a/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdf
index 12eac36ba1..bc9d8f894b 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex b/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex
index 7c7b373a6c..42850bcd13 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-ean/001-13-ean-test.tex
@@ -1,5 +1,5 @@
% !TeX program = LuaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
@@ -11,6 +11,7 @@ Test 1: one simple barcode EAN13 with default parameter:
\directlua{
barracuda = require "barracuda"
local barcode = barracuda:barcode()
+barcode:set_param{debug_bbox="qz"}
local ean13, err = barcode:new_encoder("ean-13")
assert(not err, err)
@@ -19,7 +20,7 @@ local symbo, err = ean13:from_string("8006194056290")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
@@ -39,7 +40,7 @@ local symbo, err = ean8:from_string("96385074")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
@@ -56,7 +57,7 @@ assert(not err, err)
local symbo, err = ean5:from_string("54495")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
@@ -72,7 +73,7 @@ assert(not err, err)
local symbo, err = ean2:from_string("53")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
@@ -89,7 +90,7 @@ local c = assert(ean:checksum(n))
local symbo, err = ean:from_string(n..c.."12345")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
@@ -107,7 +108,7 @@ local s = n .. c
local symbo, err = ean:from_string(s.."12")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
@@ -125,7 +126,7 @@ local s = n .. c
local symbo, err = ean:from_string(s.."12345")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
@@ -143,7 +144,7 @@ local s = n .. c
local symbo, err = ean:from_string(s.."88")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
@@ -167,10 +168,10 @@ local s = n .. c
local symbo, err = ean:from_string(s); assert(not err, err)
local ok, err = symbo:set_param("height", tex.sp "5mm"); assert(ok, err)
local canvas = barracuda:new_canvas()
-symbo:append_ga(canvas)
+symbo:draw(canvas)
local s2, err = ean:from_uint(8001120972163); assert(not err, err)
-s2:append_ga(canvas, tex.sp "45mm", 0)
+s2:draw(canvas, tex.sp "45mm", 0)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
@@ -191,12 +192,12 @@ local ok, err = ean:set_param("height", tex.sp "5mm"); assert(ok, err)
local n = 758458535897; local c = ean:checksum(n); local s = n .. c
local s1, err = ean:from_string(s); assert(not err, err)
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
+s1:draw(canvas)
local s2, err = ean:from_uint(8001120972163); assert(not err, err)
-s2:append_ga(canvas, tex.sp "40mm", 0)
+s2:draw(canvas, tex.sp "40mm", 0)
local s3, err = ean:from_uint(8000570000310); assert(not err, err)
local ok, e = s3:set_param{height = tex.sp "10mm"}; assert(ok, e)
-s3:append_ga(canvas, tex.sp "90mm", 0)
+s3:draw(canvas, tex.sp "90mm", 0)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
}
diff --git a/macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdf
index 796ad29ab0..54762d4dfc 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-ean/002-ean-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdf
index c52c77a847..cfeea7167f 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-ean/003-ean-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-ean/004-ean-test.lua b/macros/luatex/generic/barracuda/test/test-ean/004-ean-test.tex
index 017e0725b8..4d9b5208e9 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/004-ean-test.lua
+++ b/macros/luatex/generic/barracuda/test/test-ean/004-ean-test.tex
@@ -1,9 +1,6 @@
-
+% !TeX program = LuaTeX
+\directlua{
local barracuda = require "barracuda"
barracuda:save("ean-13", "8006194056290", "8006194056290")
-
-
-
-
-
-
+}
+\bye
diff --git a/macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdf
index d71e87141d..ad4028750c 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-ean/005-isbn-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdf b/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdf
index 57f3739fb7..a40f50669e 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex b/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex
index 576963bd81..61148b0b70 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-ean/006-issn-test.tex
@@ -30,28 +30,30 @@ barracuda:hbox("ean-issn+5", ars_issn.online.."00028", "mybox")
\vskip10pt
\leavevmode
-\directlua{barracuda:hbox("ean-issn", "1828-2350", "mybox")}
+\directlua{
+local barcode = barracuda:barcode()
+barcode:set_param("debug_bbox_on", true)
+barracuda:hbox("ean-issn", "1828-2350", "mybox")
+}
\box\mybox
\vskip10pt
\leavevmode
-\directlua{barracuda:hbox("ean-issn", "1828-2350 [01]", "mybox")}
+\directlua{
+barracuda:hbox("ean-issn+2", "1828-2350 [01] 22", "mybox")
+barracuda:save("ean-issn+2", "1828-2350 [01] 22", "ars")
+}
\box\mybox
\vskip10pt
\leavevmode
-\directlua{barracuda:hbox("ean-issn+5", "1828-2350 [01] 00028", "mybox")}
+\directlua{barracuda:hbox("ean-issn", "1828-2350 [01]", "mybox")}
\box\mybox
\vskip10pt
\leavevmode
-\directlua{
-barracuda:hbox("ean-issn+2", "1828-2350 [01] 22", "mybox")
-barracuda:save("ean-issn+2", "1828-2350 [01] 22", "ars")
-}
+\directlua{barracuda:hbox("ean-issn+5", "1828-2350 [01] 00028", "mybox")}
\box\mybox
-
\bye
-
diff --git a/macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg b/macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg
index f7965e94d4..e553800370 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg
+++ b/macros/luatex/generic/barracuda/test/test-ean/8006194056290.svg
@@ -12,6 +12,14 @@
<path d="M0.824996 -24.499871V-0.000000" style="stroke-width:0.329998"/>
</g>
<g stroke="black">
+ <path d="M15.344919 -24.499871V-0.000000" style="stroke-width:0.329998"/>
+ <path d="M16.004916 -24.499871V-0.000000" style="stroke-width:0.329998"/>
+ </g>
+ <g stroke="black">
+ <path d="M30.524839 -24.499871V-0.000000" style="stroke-width:0.329998"/>
+ <path d="M31.184836 -24.499871V-0.000000" style="stroke-width:0.329998"/>
+ </g>
+ <g stroke="black">
<path d="M2.309988 -24.499871V-1.649991" style="stroke-width:0.659997"/>
<path d="M3.134984 -24.499871V-1.649991" style="stroke-width:0.329998"/>
</g>
@@ -36,10 +44,6 @@
<path d="M14.519924 -24.499871V-1.649991" style="stroke-width:0.659997"/>
</g>
<g stroke="black">
- <path d="M15.344919 -24.499871V-0.000000" style="stroke-width:0.329998"/>
- <path d="M16.004916 -24.499871V-0.000000" style="stroke-width:0.329998"/>
- </g>
- <g stroke="black">
<path d="M16.994911 -24.499871V-1.649991" style="stroke-width:0.989995"/>
<path d="M18.314904 -24.499871V-1.649991" style="stroke-width:0.329998"/>
</g>
@@ -63,10 +67,6 @@
<path d="M28.544850 -24.499871V-1.649991" style="stroke-width:0.989995"/>
<path d="M29.864843 -24.499871V-1.649991" style="stroke-width:0.329998"/>
</g>
- <g stroke="black">
- <path d="M30.524839 -24.499871V-0.000000" style="stroke-width:0.329998"/>
- <path d="M31.184836 -24.499871V-0.000000" style="stroke-width:0.329998"/>
- </g>
<text x="-3.629981" y="0.780007" font-family="Verdana" font-size="2.877000">
8 </text>
<text y="0.780007" font-family="Verdana" font-size="2.877000" text-anchor="middle">
diff --git a/macros/luatex/generic/barracuda/test/test-ean/ars.svg b/macros/luatex/generic/barracuda/test/test-ean/ars.svg
index 5bfc01d0f3..8f48c1054e 100644
--- a/macros/luatex/generic/barracuda/test/test-ean/ars.svg
+++ b/macros/luatex/generic/barracuda/test/test-ean/ars.svg
@@ -12,6 +12,14 @@
<path d="M0.824996 -24.499871V-0.000000" style="stroke-width:0.329998"/>
</g>
<g stroke="black">
+ <path d="M15.344919 -24.499871V-0.000000" style="stroke-width:0.329998"/>
+ <path d="M16.004916 -24.499871V-0.000000" style="stroke-width:0.329998"/>
+ </g>
+ <g stroke="black">
+ <path d="M30.524839 -24.499871V-0.000000" style="stroke-width:0.329998"/>
+ <path d="M31.184836 -24.499871V-0.000000" style="stroke-width:0.329998"/>
+ </g>
+ <g stroke="black">
<path d="M1.814990 -24.499871V-1.649991" style="stroke-width:0.989995"/>
<path d="M2.969984 -24.499871V-1.649991" style="stroke-width:0.659997"/>
</g>
@@ -36,10 +44,6 @@
<path d="M14.354924 -24.499871V-1.649991" style="stroke-width:0.989995"/>
</g>
<g stroke="black">
- <path d="M15.344919 -24.499871V-0.000000" style="stroke-width:0.329998"/>
- <path d="M16.004916 -24.499871V-0.000000" style="stroke-width:0.329998"/>
- </g>
- <g stroke="black">
<path d="M16.829911 -24.499871V-1.649991" style="stroke-width:0.659997"/>
<path d="M17.819906 -24.499871V-1.649991" style="stroke-width:0.659997"/>
</g>
@@ -63,10 +67,6 @@
<path d="M28.379851 -24.499871V-1.649991" style="stroke-width:0.659997"/>
<path d="M29.699844 -24.499871V-1.649991" style="stroke-width:0.659997"/>
</g>
- <g stroke="black">
- <path d="M30.524839 -24.499871V-0.000000" style="stroke-width:0.329998"/>
- <path d="M31.184836 -24.499871V-0.000000" style="stroke-width:0.329998"/>
- </g>
<text x="-3.629981" y="0.780007" font-family="Verdana" font-size="2.877000">
9 </text>
<text y="0.780007" font-family="Verdana" font-size="2.877000" text-anchor="middle">
diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdf b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdf
index b3f3336f43..d741453c5b 100644
--- a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex
index c51fa3dfb0..a40ba4ec8b 100644
--- a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/001-ga-pdfliteral-test.tex
@@ -1,7 +1,7 @@
% !TeX program = LuaTeX
% test for ga-canvas pdfliteral driver
%
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
% see LICENSE.txt file
---ga--- is a binary format as an istruction set similar to
@@ -28,35 +28,36 @@ the PDF output file.
\newbox\mybox
\directlua{
- driver = require [[lib-driver.brcd-driver]] % global Lua variables
+ brcd = require "barracuda"
+ driver = brcd:get_driver() % global Lua variables
pt = tex.sp [[1pt]] % 1pt = 65536sp
}
Let's start drawing an horizontal line 100pt long:
\directlua{
- local ga = {_data = {33, 0*pt, 100*pt, 0*pt}}
+ local ga = {33, 0*pt, 100*pt, 0*pt}
driver:ga_to_hbox(ga, [[mybox]])
}\box\mybox
or two different parallel lines 24pt long:
\directlua{
- local ga = {_data = {33, 0*pt, 24*pt, 0*pt, 33, 0*pt, 24*pt, 5*pt}}
+ local ga = {33, 0*pt, 24*pt, 0*pt, 33, 0*pt, 24*pt, 5*pt}
driver:ga_to_hbox(ga, [[mybox]])
}\box\mybox
and again two horizontal lines 10pt thick, touching a corner:
\directlua{
- local ga = {_data = {
+ local ga = {
1, 10*pt,
33, -24*pt, 0*pt, -5*pt,
33, 0*pt, 24*pt, 5*pt,
- }}
+ }
driver:ga_to_hbox(ga, [[mybox]])
}\box\mybox
Several vertical lines with its horizontal limits:
\directlua{
- local ga = { _data = {
+ local ga = {
34, -20*pt, 20*pt, 0*pt,
34, -15*pt, 15*pt, 5*pt,
34, -10*pt, 10*pt, 10*pt,
@@ -69,16 +70,16 @@ Several vertical lines with its horizontal limits:
1, .05*pt,
33, 0*pt, 40*pt, -20*pt,
33, 0*pt, 40*pt, 20*pt,
- }}
+ }
driver:ga_to_hbox(ga, [[mybox]])
}\box\mybox
Finally a little rectangle:
\directlua{
- local ga = {_data = {
+ local ga = {
1, 5*pt,
48, 0*pt, 0*pt, 15*pt, 10*pt,
- }}
+ }
driver:ga_to_hbox(ga, [[mybox]])
}\box\mybox
@@ -86,7 +87,7 @@ Finally a little rectangle:
Test number 1: a vbar 2pt width, 20pt height:
\directlua{
% vbar: <36> y1 y2 <nbars> x1 w1 x2 w2 ... xn wn
- local ga = {_data = {36, 0, 20*pt, 1, 0.0, 2*pt}}
+ local ga = {36, 0, 20*pt, 1, 0.0, 2*pt}
driver:ga_to_hbox(ga, [[mybox]])
}\box\mybox
@@ -98,7 +99,7 @@ Test number 2: ten vbars in a row equally spaced by 10pt:
ga[i*2 + 5] = 5*pt + i*20*pt
ga[i*2 + 6] = 10*pt
end
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
@@ -117,7 +118,7 @@ Test number 3: two series of vbars 10pt and 5pt large:
ga[i*2 + 29] = 15*pt + i*20*pt
ga[i*2 + 30] = 5*pt
end
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
@@ -132,7 +133,7 @@ Test number 4: a bunch of thin vertical bars (25):
ga[i*2 + 5] = 1*pt + i*4*pt
ga[i*2 + 6] = 2*pt
end
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule A\box\mybox A\vrule
\bigskip
@@ -155,7 +156,7 @@ Test number 5: two rows of a bunch of thin bars:
ga[i*2 + 59] = 3*pt + i*4*pt
ga[i*2 + 60] = 2*pt
end
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
@@ -181,7 +182,7 @@ Test number 6: staircase of Vbars (manually data definition):
25*pt, % x
10*pt, % w
}
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
@@ -219,7 +220,7 @@ Test number 7: vbars with spaced text, in three different rows:
ga[52] = 71 % G
ga[53] = 72 % H
ga[54] = 0
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
@@ -271,7 +272,7 @@ Test number 8: spaced text (checking the correct vertical alignment):
ga[66] = 55 % 7
ga[67] = 56 % 8
ga[68] = 0
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
@@ -323,7 +324,7 @@ Test number 9: spaced text, check correct vertical alignment:
ga[66] = 55 % 7
ga[67] = 56 % 8
ga[68] = 0
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
@@ -356,11 +357,11 @@ Test number 10: two centered texts aligned to the baseline:
ga[23] = 56 % 8
ga[24] = 57 % 9
ga[25] = 0
- driver:ga_to_hbox({_data = ga}, [[mybox]])
+ driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
-So far, we have manually build data for ga stream. Next we are going to
+So far, we have manually build data for ga stream. For now on, we are going to
use the ga-canvas library.
\bigskip
@@ -368,26 +369,22 @@ In fact, all the previous tests are rebuild with the ga-canvas library.
Test 1: a vbar 2pt width, 20pt height:
\directlua{
- gacanvas = require "lib-geo.brcd-gacanvas"
- local ga = gacanvas:new()
- local vbar = {_yline = {0.0, 2*pt}}
- local err = ga:encode_Vbar(vbar, 0.0, 0.0, 20*pt) % x, w
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ local vbar = {0.0, 2*pt}
+ assert(ga:encode_vbar(vbar, 0.0, 0.0, 20*pt)) % x, w
driver:ga_to_hbox(ga, [[mybox]])
}\box\mybox
\bigskip
Test 2: ten vbars equally spaced by 10pt:
\directlua{
- local ga = gacanvas:new()
- local data = {}
+ local ga = brcd:new_canvas()
+ local bars = {}
for i = 0, 9 do
- data[i*2 + 1] = 5*pt + i*20*pt % x
- data[i*2 + 2] = 10*pt % w
+ bars[i*2 + 1] = 5*pt + i*20*pt % x
+ bars[i*2 + 2] = 10*pt % w
end
- local bars = {_yline = data}
- local err = ga:encode_Vbar(bars, 0.0, 0.0, 10*pt)
- assert(not err, err)
+ assert(ga:encode_vbar(bars, 0.0, 0.0, 10*pt))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -404,11 +401,9 @@ Test 3: two series of vbars 10pt and 5pt large:
b2[i*2 + 1] = i*20*pt
b2[i*2 + 2] = 5*pt
end
- local ga = gacanvas:new()
- local err = ga:encode_Vbar({_yline=b1}, 0.0, 0.0, 10*pt)
- assert(not err, err)
- err = ga:encode_Vbar({_yline=b2}, 10.0*pt, 2.5*pt, 7.5*pt)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_vbar(b1, 0.0, 0.0, 10*pt))
+ assert(ga:encode_vbar(b2, 10.0*pt, 2.5*pt, 7.5*pt))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -420,9 +415,8 @@ Test 4: a bunch of thin bars:
b[i*2 + 1] = 1*pt + i*4*pt
b[i*2 + 2] = 2*pt
end
- local ga = gacanvas:new()
- local err = ga:encode_Vbar({_yline=b}, 0.0, 5*pt, 25*pt)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_vbar(b, 0.0, 5*pt, 25*pt))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule{ }\box\mybox{ }\vrule
@@ -434,42 +428,34 @@ Test 5: two levels of a bunch of thin bars:
b[i*2 + 1] = i*4*pt
b[i*2 + 2] = 2*pt
end
- local b = {_yline=b}
- local ga = gacanvas:new()
- local err = ga:encode_Vbar(b, 0.0, 5*pt, 25*pt)
- assert(not err, err)
- err = ga:encode_Vbar(b, 2*pt, 25*pt, 45*pt, b)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_vbar(b, 0.0, 5*pt, 25*pt))
+ assert(ga:encode_vbar(b, 2*pt, 25*pt, 45*pt, b))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
Test number 6: staircase of bars (manual insertion of data):
\directlua{
- local b = {_yline={0.0, 10*pt}}
- local ga = gacanvas:new()
- local err = ga:encode_Vbar(b, 0.0, 0.0, 20*pt)
- assert(not err, err)
- err = ga:encode_Vbar(b, 10*pt, 20*pt, 40*pt)
- assert(not err, err)
- err = ga:encode_Vbar(b, 20*pt, 40*pt, 60*pt)
- assert(not err, err)
+ local b = {0.0, 10*pt}
+ local ga = brcd:new_canvas()
+ assert(ga:encode_vbar(b, 0.0, 0.0, 20*pt))
+ assert(ga:encode_vbar(b, 10*pt, 20*pt, 40*pt))
+ assert(ga:encode_vbar(b, 20*pt, 40*pt, 60*pt))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
\bigskip
Test number 7: vbars with spaced text, all in three rows:
\directlua{
- local b = {}
+ local vb = {}
for i = 0,7 do
- b[i*2+1] = i*10*pt
- b[i*2+2] = 5*pt
+ vb[i*2+1] = i*10*pt
+ vb[i*2+2] = 5*pt
end
- local vb = {_yline=b}
- local ga = gacanvas:new()
- local err = ga:encode_Vbar(vb, 0.0, 0.0, 20*pt)
- assert(not err, err)
- local err = ga:encode_Vbar(vb, 0.0, 30*pt, 50*pt)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_vbar(vb, 0.0, 0.0, 20*pt))
+ assert(ga:encode_vbar(vb, 0.0, 30*pt, 50*pt))
local txt = {codepoint = {
65, % A
66, % B
@@ -480,8 +466,7 @@ Test number 7: vbars with spaced text, all in three rows:
71, % G
72, % H
}}
- err = ga:encode_Text_xspaced(txt, 0.0, 10*pt, 25*pt, 0.5)
- assert(not err, err)
+ assert(ga:encode_Text_xspaced(txt, 0.0, 10*pt, 25*pt, 0.5))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -493,12 +478,9 @@ Test 8: spaced text, check correct vertical alignment:
b[i*2+1] = i*10*pt
b[i*2+2] = 2*pt
end
- b = {_yline=b}
- local ga = gacanvas:new()
- local err = ga:encode_Vbar(b, 0.0, 0.0, 20*pt)
- assert(not err, err)
- local err = ga:encode_Vbar(b, 0.0, 40*pt, 60*pt)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_vbar(b, 0.0, 0.0, 20*pt))
+ assert(ga:encode_vbar(b, 0.0, 40*pt, 60*pt))
local c = { codepoint = {
65, % A
66, % B
@@ -509,8 +491,7 @@ Test 8: spaced text, check correct vertical alignment:
71, % G
72, % H
}}
- err = ga:encode_Text_xspaced(c, 0.0, 10*pt, 30*pt, 0.0)
- assert(not err, err)
+ assert(ga:encode_Text_xspaced(c, 0.0, 10*pt, 30*pt, 0.0))
local n = { codepoint = {
49, % 1
50, % 2
@@ -521,8 +502,7 @@ Test 8: spaced text, check correct vertical alignment:
55, % 7
56, % 8
}}
- err = ga:encode_Text_xspaced(n, 0.0, 10*pt, 30*pt, 1.0)
- assert(not err, err)
+ assert(ga:encode_Text_xspaced(n, 0.0, 10*pt, 30*pt, 1.0))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -534,12 +514,9 @@ Test number 9: spaced text, check correct vertical alignment:
b[i*2+1] = i*10*pt
b[i*2+2] = 8*pt
end
- b = {_yline = b}
- local ga = gacanvas:new()
- local err = ga:encode_Vbar(b, 0.0, 0.0, 20*pt)
- assert(not err, err)
- local err = ga:encode_Vbar(b, 0.0, 40*pt, 60*pt)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_vbar(b, 0.0, 0.0, 20*pt))
+ assert(ga:encode_vbar(b, 0.0, 40*pt, 60*pt))
local c = { codepoint = {
65, % A
66, % B
@@ -550,8 +527,7 @@ Test number 9: spaced text, check correct vertical alignment:
71, % G
72, % H
}}
- err = ga:encode_Text_xspaced(c, 0.0, 10*pt, 20*pt, 0.0)
- assert(not err, err)
+ assert(ga:encode_Text_xspaced(c, 0.0, 10*pt, 20*pt, 0.0))
local n = { codepoint = {
49, % 1
50, % 2
@@ -562,8 +538,7 @@ Test number 9: spaced text, check correct vertical alignment:
55, % 7
56, % 8
}}
- err = ga:encode_Text_xspaced(n, 0.0, 10*pt, 40*pt, 1.0)
- assert(not err, err)
+ assert(ga:encode_Text_xspaced(n, 0.0, 10*pt, 40*pt, 1.0))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule{ }\box\mybox{ }\vrule
@@ -582,16 +557,14 @@ Test number 10: two centered texts and baseline aligned:
56, % 8
57, % 9
}}
- local ga = gacanvas:new()
- local err = ga:encode_Text(n, 0, 0, 0.5, 0)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_Text(n, 0, 0, 0.5, 0))
local a = { codepoint = {
65, % A
string.byte("Q"), % Q
67, % C
}}
- err = ga:encode_Text(a, 0, 0, 0.5, 1)
- assert(not err, err)
+ assert(ga:encode_Text(a, 0, 0, 0.5, 1))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -610,16 +583,14 @@ Test number 11: two centered texts aligned:
56, % 8
57, % 9
}}
- local ga = gacanvas:new()
- local err = ga:encode_Text(n, 0, 0, 0.5, 1)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_Text(n, 0, 0, 0.5, 1))
local a = { codepoint = {
65, % A
string.byte("Q"), % Q
67, % C
}}
- err = ga:encode_Text(a, 0, 0, 0.5, 0)
- assert(not err, err)
+ assert(ga:encode_Text(a, 0, 0, 0.5, 0))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -639,9 +610,8 @@ Test number 12: text\_xwidth opcode:
56, % 8
57, % 9
}}
- local ga = gacanvas:new()
- local err = ga:encode_Text_xwidth(n, 0, tex.sp "5cm", 0, 0)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ assert(ga:encode_Text_xwidth(n, 0, tex.sp "5cm", 0, 0))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -664,20 +634,14 @@ Test number 13: text\_xwidth with different size:
56, % 8
57, % 9
}}
- local ga = gacanvas:new()
- % (txt, x1, x2, ypos, ay) --> err
- local err = ga:encode_Text_xwidth(n, tex.sp "0mm", tex.sp "50mm", 0, 0)
- assert(not err, err)
- local err = ga:encode_Text_xwidth(n, tex.sp "5mm", tex.sp "45mm", tex.sp "3mm", 0)
- assert(not err, err)
- local err = ga:encode_Text_xwidth(n, tex.sp "10mm", tex.sp "40mm", tex.sp "6mm", 0)
- assert(not err, err)
- local err = ga:encode_Text_xwidth(n, tex.sp "15mm", tex.sp "35mm", tex.sp "9mm", 0)
- assert(not err, err)
- local err = ga:encode_Text_xwidth(n, tex.sp "20mm", tex.sp "30mm", tex.sp "12mm", 0)
- assert(not err, err)
- local err = ga:encode_Text_xwidth(n, tex.sp "24mm", tex.sp "26mm", tex.sp "15mm", 0)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ % (txt, x1, x2, ypos, ay) --> ok, err
+ assert(ga:encode_Text_xwidth(n, tex.sp "0mm", tex.sp "50mm", 0, 0))
+ assert(ga:encode_Text_xwidth(n, tex.sp "5mm", tex.sp "45mm", tex.sp "3mm", 0))
+ assert(ga:encode_Text_xwidth(n, tex.sp "10mm", tex.sp "40mm", tex.sp "6mm", 0))
+ assert(ga:encode_Text_xwidth(n, tex.sp "15mm", tex.sp "35mm", tex.sp "9mm", 0))
+ assert(ga:encode_Text_xwidth(n, tex.sp "20mm", tex.sp "30mm", tex.sp "12mm", 0))
+ assert(ga:encode_Text_xwidth(n, tex.sp "24mm", tex.sp "26mm", tex.sp "15mm", 0))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -691,16 +655,12 @@ Test number 14: place bars and text as text\_xwidth:
b[i*2 + 1] = i*12*pt
b[i*2 + 2] = 0.4*pt
end
- b = {_yline = b}
local n = {codepoint = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,}}
- local ga = gacanvas:new()
- % (vbar, x0, y1, y2) --> err
- local err = ga:encode_Vbar(b, 0.0, 0*pt, 25*pt)
- local err = ga:encode_Vbar(b, 0.0, 32*pt, 42*pt)
- assert(not err, err)
- % (txt, x1, x2, ypos, ay) --> err
- local err = ga:encode_Text_xwidth(n, 0*pt, 108*pt, 25*pt, 0)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ % (vbar, x0, y1, y2) --> ok, err
+ assert(ga:encode_vbar(b, 0.0, 0*pt, 25*pt))
+ % (txt, x1, x2, ypos, ay) --> ok, err
+ assert(ga:encode_Text_xwidth(n, 0*pt, 108*pt, 25*pt, 0))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -711,17 +671,14 @@ Test number 14: place bars and text as text\_xwidth:
b[i*2 + 1] = i*12*pt
b[i*2 + 2] = 0.2*pt
end
- b = {_yline = b}
local n = { 48, 49, 50, 51, string.byte([[x]]), 53, 54, 55, 56,}
n = {codepoint = n}
- local ga = gacanvas:new()
+ local ga = brcd:new_canvas()
% x0, y1, y2, bars
- local err = ga:encode_Vbar(b, 0.0, 0*pt, 25*pt)
- local err = ga:encode_Vbar(b, 0.0, 32*pt, 42*pt)
- assert(not err, err)
- % (txt, x1, x2, ypos, ay) --> err
- local err = ga:encode_Text_xwidth(n, 0*pt, 96*pt, 25*pt, 0)
- assert(not err, err)
+ assert(ga:encode_vbar(b, 0.0, 0*pt, 25*pt))
+ assert(ga:encode_vbar(b, 0.0, 32*pt, 42*pt))
+ % (txt, x1, x2, ypos, ay) --> ok, err
+ assert(ga:encode_Text_xwidth(n, 0*pt, 96*pt, 25*pt, 0))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
@@ -730,10 +687,9 @@ Test number 15: place text\_xwidth when text is only two chars long:
\directlua{
local n = {codepoint = { 48, 56,}} % 0 and 8
- local ga = gacanvas:new()
- % (txt, x1, x2, ypos, ay) --> err
- local err = ga:encode_Text_xwidth(n, 0*pt, 32*pt, 25*pt, 0)
- assert(not err, err)
+ local ga = brcd:new_canvas()
+ % (txt, x1, x2, ypos, ay) --> ok, err
+ assert(ga:encode_Text_xwidth(n, 0*pt, 32*pt, 25*pt, 0))
driver:ga_to_hbox(ga, [[mybox]])
}\vrule\box\mybox\vrule
diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.pdf b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.pdf
new file mode 100644
index 0000000000..72d4eddc05
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.tex b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.tex
new file mode 100644
index 0000000000..14a713dee9
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/002-polyline.tex
@@ -0,0 +1,69 @@
+% !TeX program = LuaTeX
+
+\directlua{
+ brcd = require "barracuda"
+}
+\newbox\mybox
+
+Test 1: a simple polyline:
+\directlua{
+ local Polyline = brcd._libgeo.Polyline
+ local p = Polyline:new()
+ p:add_point(0, 0)
+ p:add_point(tex.sp "32pt", 0)
+ p:add_relpoint(tex.sp "16pt", tex.sp "16pt")
+
+ local gaCanvas = brcd._gacanvas
+ local ga = gaCanvas:new()
+ assert(ga:encode_polyline(p))
+
+ local driver = brcd:get_driver()
+ driver:ga_to_hbox(ga, [[mybox]])
+}\vrule\box\mybox\vrule
+
+
+Test 2: a staircase:
+\directlua{
+ local h = tex.sp "18pt"
+ local b = tex.sp "36pt"
+ local Polyline = brcd._libgeo.Polyline
+ local p = Polyline:new()
+ p:add_point(0, 0)
+ for _ = 1, 5 do
+ p:add_relpoint(0, h)
+ p:add_relpoint(b, 0)
+ end
+
+ local gaCanvas = brcd._gacanvas
+ local ga = gaCanvas:new()
+ assert(ga:encode_polyline(p))
+
+ local driver = brcd:get_driver()
+ driver:ga_to_hbox(ga, [[mybox]])
+}\vrule\box\mybox\vrule
+
+Test 3: several regular polygons:
+\directlua{
+ local Polyline = brcd._libgeo.Polyline
+ local l = tex.sp "36pt" % side length
+ local gaCanvas = brcd._gacanvas
+ local ga = gaCanvas:new()
+ ga:encode_linewidth(tex.sp "0.4pt")
+ for n = 3, 13 do
+ local p = Polyline:new()
+ p:add_point(0, 0)
+ local alpha = 2*math.pi/n % angle
+ local a = alpha/2 % regular angles sum
+ for _ = 1, n do
+ local x, y = l * math.cos(a), l * math.sin(a)
+ a = a + alpha
+ p:add_relpoint(x, y)
+ end
+ assert(ga:encode_polyline(p))
+ end
+ local driver = brcd:get_driver()
+ driver:ga_to_hbox(ga, [[mybox]])
+ driver:save("svg", ga, "polygon")
+}\vrule\box\mybox\vrule
+
+\bye
diff --git a/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/polygon.svg b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/polygon.svg
new file mode 100644
index 0000000000..fd00ed2912
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-ga-pdfliteral/polygon.svg
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Barracuda package (https://github.com/robitex/barracuda) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="52.484243mm" height="52.101574mm"
+ viewBox="-26.242122 -52.101574 52.484243 52.101574"
+>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 6.326276,-10.957432
+ -6.326276,-10.957432
+ -0.000000,0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 8.946706,-8.946706
+ 0.000000,-17.893412
+ -8.946706,-8.946706
+ -0.000000,0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 10.236130,-7.436984
+ 6.326276,-19.470277
+ -6.326276,-19.470277
+ -10.236130,-7.436984
+ -0.000000,-0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 10.957432,-6.326276
+ 10.957432,-18.978829
+ 0.000000,-25.305106
+ -10.957432,-18.978829
+ -10.957432,-6.326276
+ -0.000000,0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 11.399556,-5.489737
+ 14.215014,-17.825064
+ 6.326276,-27.717228
+ -6.326276,-27.717228
+ -14.215014,-17.825064
+ -11.399556,-5.489737
+ -0.000000,0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 11.689435,-4.841922
+ 16.531357,-16.531357
+ 11.689435,-28.220792
+ 0.000000,-33.062714
+ -11.689435,-28.220792
+ -16.531357,-16.531357
+ -11.689435,-4.841922
+ -0.000000,0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 11.889511,-4.327428
+ 18.215787,-15.284860
+ 16.018694,-27.745192
+ 6.326276,-35.878097
+ -6.326276,-35.878097
+ -16.018694,-27.745192
+ -18.215787,-15.284860
+ -11.889511,-4.327428
+ 0.000000,-0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 12.033293,-3.909854
+ 19.470277,-14.145984
+ 19.470277,-26.798537
+ 12.033293,-37.034667
+ 0.000000,-40.944521
+ -12.033293,-37.034667
+ -19.470277,-26.798537
+ -19.470277,-14.145984
+ -12.033293,-3.909854
+ -0.000000,0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 12.140036,-3.564636
+ 20.425696,-13.126798
+ 22.226342,-25.650566
+ 16.970281,-37.159733
+ 6.326276,-44.000219
+ -6.326276,-44.000219
+ -16.970281,-37.159733
+ -22.226342,-25.650566
+ -20.425696,-13.126798
+ -12.140036,-3.564636
+ -0.000000,0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 12.221428,-3.274722
+ 21.168134,-12.221428
+ 24.442855,-24.442855
+ 21.168134,-36.664283
+ 12.221428,-45.610989
+ 0.000000,-48.885711
+ -12.221428,-45.610989
+ -21.168134,-36.664283
+ -24.442855,-24.442855
+ -21.168134,-12.221428
+ -12.221428,-3.274722
+ -0.000000,-0.000000"/>
+ </g>
+ <g stroke="black" stroke-width="0.140582" fill="none">
+ <polyline points="0.000000,-0.000000
+ 12.284893,-3.027954
+ 21.755465,-11.418149
+ 26.242122,-23.248491
+ 24.717025,-35.808793
+ 17.529556,-46.221640
+ 6.326276,-52.101574
+ -6.326276,-52.101574
+ -17.529556,-46.221640
+ -24.717025,-35.808793
+ -26.242122,-23.248491
+ -21.755465,-11.418149
+ -12.284893,-3.027954
+ -0.000000,0.000000"/>
+ </g>
+</svg>
+
diff --git a/macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua b/macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua
index b5a2e3c4ae..e116fe75f4 100644
--- a/macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua
+++ b/macros/luatex/generic/barracuda/test/test-ga-svg/002-ga-svg-test.lua
@@ -13,6 +13,6 @@ local symbol, err = c39:from_string("ABC000Z")
assert(not err, err)
local canvas = barracuda:new_canvas()
-symbol:append_ga(canvas)
+symbol:draw(canvas)
driver:save("svg", canvas, "test-code39") \ No newline at end of file
diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdf b/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdf
index f2dbd6f9ea..5bf43e574b 100644
--- a/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex b/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex
index 0062b74d3e..3f5a4dff75 100644
--- a/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-i2of5/001-i2of5-test.tex
@@ -1,10 +1,14 @@
% !TeX program = LuaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
-\directlua{barracuda = require "barracuda"}
+\directlua{
+barracuda = require "barracuda"
+local barcode = barracuda:barcode()
+barcode:set_param("debug_bbox", "symb")
+}
Interleaved 2 of 5 encoder test.
@@ -12,14 +16,13 @@ Test 1: one simple barcode with default parameters:
\directlua{
local barcode = barracuda:barcode()
-
local enc, err = barcode:new_encoder("i2of5"); assert(not err, err)
local symbo, err = enc:from_uint(54654681); assert(not err, err)
-local canvas = barracuda:new_canvas(); symbo:append_ga(canvas)
+local canvas = barracuda:new_canvas(); symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\vrule A\vrule\box\mybox \vrule A\vrule
+}%
+input code 54654681: \vrule A\vrule\box\mybox \vrule A\vrule
\bigskip
Test 2: one simple barcode with default parameter:
@@ -28,11 +31,11 @@ Test 2: one simple barcode with default parameter:
local barcode = barracuda:barcode()
local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err)
local symbo, err = enc:from_uint(1234567895); assert(not err, err)
-local canvas = barracuda:new_canvas(); symbo:append_ga(canvas)
+local canvas = barracuda:new_canvas(); symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\vrule A\vrule\box\mybox \vrule A\vrule
+}%
+input code 1234567895: \vrule A\vrule\box\mybox \vrule A\vrule
% check digit tests
@@ -104,11 +107,11 @@ local barcode = barracuda:barcode()
local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err)
local symbo, err = enc:from_uint(454473, {check_digit_policy="add"})
assert(not err, err)
-local canvas = barracuda:new_canvas(); symbo:append_ga(canvas)
+local canvas = barracuda:new_canvas(); symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\vrule A\vrule\box\mybox \vrule A\vrule
+}%
+input code 454473: \vrule A\vrule\box\mybox \vrule A\vrule
\bigskip
Test 4: a second simple barcode with check digit automatically added:
@@ -118,11 +121,11 @@ local barcode = barracuda:barcode()
local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err)
local symbo, err = enc:from_uint(74223, {check_digit_policy="add"})
assert(not err, err)
-local canvas = barracuda:new_canvas(); symbo:append_ga(canvas)
+local canvas = barracuda:new_canvas(); symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\vrule A\vrule\box\mybox \vrule A\vrule
+}%
+input code 74223: \vrule A\vrule\box\mybox \vrule A\vrule
\bigskip
Test 5: a symbol with native check digits:
@@ -132,11 +135,11 @@ local barcode = barracuda:barcode()
local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err)
local symbo, err = enc:from_uint(121891259, {check_digit_policy="verify"})
assert(not err, err)
-local canvas = barracuda:new_canvas(); symbo:append_ga(canvas)
+local canvas = barracuda:new_canvas(); symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\vrule A\vrule\box\mybox \vrule A\vrule
+}%
+input code 121891259: \vrule A\vrule\box\mybox \vrule A\vrule
\bigskip
Test 6: bearer bars please:
@@ -144,13 +147,13 @@ Test 6: bearer bars please:
\directlua{
local barcode = barracuda:barcode()
local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err)
-local symbo, err = enc:from_uint(747867239, {bearer_bars_enabled = true})
+local symbo, err = enc:from_string("747867239", {bearer_bars_enabled = true})
assert(not err, err)
-local canvas = barracuda:new_canvas(); symbo:append_ga(canvas)
+local canvas = barracuda:new_canvas(); symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\vrule A\vrule\box\mybox \vrule A\vrule
+}%
+input string "747867239": \vrule A\vrule\box\mybox \vrule A\vrule
\bigskip
Test 7: bearer bars all around the symbol:
@@ -160,11 +163,11 @@ local barcode = barracuda:barcode()
local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err)
local symbo, err = enc:from_uint(986790868, {bearer_bars_enabled = true, bearer_bars_layout="frame"})
assert(not err, err)
-local canvas = barracuda:new_canvas(); symbo:append_ga(canvas)
+local canvas = barracuda:new_canvas(); symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\vrule A\vrule\box\mybox \vrule A\vrule
+}%
+input code 986790868: \vrule A\vrule\box\mybox \vrule A\vrule
\bigskip
Test 8: bearer bars all around the symbol (with string costructor):
@@ -174,11 +177,11 @@ local barcode = barracuda:barcode()
local enc, err = barcode:enc_by_name("i2of5"); assert(not err, err)
local symbo, err = enc:from_string("986790868", {bearer_bars_enabled = true, bearer_bars_layout="frame"})
assert(not err, err)
-local canvas = barracuda:new_canvas(); symbo:append_ga(canvas)
+local canvas = barracuda:new_canvas(); symbo:draw(canvas)
local drv = barracuda:get_driver()
drv:ga_to_hbox(canvas, "mybox")
-}
-\vrule A\vrule\box\mybox \vrule A\vrule
+}%
+input string "986790868": \vrule A\vrule\box\mybox \vrule A\vrule
That's all folks!
diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdf b/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdf
index 79a05eca42..449a7b63a8 100644
--- a/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdf
+++ b/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex b/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex
index 52784b66bb..7b6229b483 100644
--- a/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex
+++ b/macros/luatex/generic/barracuda/test/test-i2of5/002-ITF14-test.tex
@@ -1,5 +1,5 @@
% !TeX program = LuaTeX
-% Copyright (C) 2020 Roberto Giacomelli
+% Copyright (C) 2019-2022 Roberto Giacomelli
\newbox\mybox
\nopagenumbers
@@ -15,9 +15,8 @@ local enc = assert(barcode:new_encoder("i2of5-ITF14"))
local s1 = assert(enc:from_uint(1234567890123))
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
-local drv = barracuda:get_driver()
-drv:ga_to_hbox(canvas, "mybox")
+s1:draw(canvas)
+canvas:ga_to_hbox("mybox")
}
\vskip 10pt
12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule
@@ -28,9 +27,8 @@ local enc = assert(barcode:enc_by_name("i2of5-ITF14"))
local s1 = assert(enc:from_string("1234567890123"))
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
-local drv = barracuda:get_driver()
-drv:ga_to_hbox(canvas, "mybox")
+s1:draw(canvas)
+canvas:ga_to_hbox("mybox")
}
\vskip 10pt
12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule
@@ -39,15 +37,12 @@ drv:ga_to_hbox(canvas, "mybox")
local barcode = barracuda:barcode()
local enc = assert(barcode:enc_by_name("i2of5-ITF14"))
local s1 = assert(enc:from_string("(12) 34 56 78 90 12 3"))
-
+s1:set_param("debug_bbox_on", true)
local canvas = barracuda:new_canvas()
-s1:append_ga(canvas)
-local drv = barracuda:get_driver()
-drv:ga_to_hbox(canvas, "mybox")
+s1:draw(canvas)
+canvas:ga_to_hbox("mybox")
+canvas:save("svg", "02-itf14")
}
\vskip 10pt
12345678901231 is \vrule A\vrule\box\mybox \vrule A\vrule
-
\bye
-
-
diff --git a/macros/luatex/generic/barracuda/test/test-i2of5/02-itf14.svg b/macros/luatex/generic/barracuda/test/test-i2of5/02-itf14.svg
new file mode 100644
index 0000000000..2f8ee06996
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-i2of5/02-itf14.svg
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Barracuda package (https://github.com/robitex/barracuda) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="74.497108mm" height="20.349904mm"
+ viewBox="-7.424961 -15.174920 74.497108 20.349904"
+>
+ <g stroke="black">
+ <path d="M0.247499 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M1.237493 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ </g>
+ <g stroke="black">
+ <path d="M2.598736 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M3.959979 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M5.692470 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M6.682465 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M8.043708 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ </g>
+ <g stroke="black">
+ <path d="M10.518695 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M12.251186 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M13.612428 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M15.344919 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M16.334914 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ </g>
+ <g stroke="black">
+ <path d="M18.438653 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M19.799896 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M21.903635 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M24.007374 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M24.997368 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ </g>
+ <g stroke="black">
+ <path d="M25.987363 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M27.719854 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M28.709849 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M30.071092 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M32.546079 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ </g>
+ <g stroke="black">
+ <path d="M33.907322 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M35.268564 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M36.629807 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M38.733546 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M40.837285 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ </g>
+ <g stroke="black">
+ <path d="M42.198528 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M43.559771 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M45.292262 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M46.282256 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M47.643499 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ </g>
+ <g stroke="black">
+ <path d="M50.118486 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M52.593473 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M53.954716 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M54.944711 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ <path d="M55.934706 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ </g>
+ <g stroke="black">
+ <path d="M58.038445 -12.699933V-0.000000" style="stroke-width:1.237493"/>
+ <path d="M59.399687 -12.699933V-0.000000" style="stroke-width:0.494997"/>
+ </g>
+ <rect x="-6.187467" y="-13.937427" width="72.022121" height="15.174920" fill="none" stroke="black" stroke-width="2.474987"
+ />
+ <text x="29.823593" y="5.174984" font-family="Verdana" font-size="2.877000" text-anchor="middle">
+ (12) 34 56 78 90 12 31 </text>
+ <rect x="-7.407322" y="-15.157281" width="74.461830" height="17.614629" fill="none" stroke="black" stroke-width="0.035278"
+ stroke-dasharray="2.116667 1.058333"
+ stroke-dashoffset="1.058333"
+ />
+</svg>
+
diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.pdf b/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.pdf
new file mode 100644
index 0000000000..46c326513a
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.tex b/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.tex
new file mode 100644
index 0000000000..ec43ad0091
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-libgeo/001-libgeo-test.tex
@@ -0,0 +1,48 @@
+% !TeX program = LuaTeX
+% test for ga-canvas pdfliteral driver
+%
+% Copyright (C) 2019-2022 Roberto Giacomelli
+% see LICENSE.txt file
+
+\newbox\mybox
+\directlua{
+ barracuda = require [[barracuda]]
+ pt = tex.sp [[1pt]] % 1pt = 65536sp
+}
+
+Test 1: test Archive class and Vbar arithmetic:
+
+\medskip
+\directlua{
+ % retrive the Vbar class
+ local libgeo = barracuda:libgeo()
+ local Vbar = libgeo.Vbar
+ % create three Vbar objects
+ local b1 = Vbar:from_int(22556, 2*pt)
+ local b2 = Vbar:from_int(3134563, 2*pt)
+ local b3 = Vbar:from_int(1111111, 2*pt)
+ % retrive the Archive class
+ local Archive = libgeo.Archive
+ % create a new instance of an archive and insert vbars
+ local archive = Archive:new()
+ assert(archive:insert(b1, 1))
+ assert(archive:insert(b2, 2))
+ assert(archive:insert(b3, 3))
+ % fill a queue (an array) two times
+ local queue = assert(archive:get(1)) + 20*pt
+ queue = queue + assert(archive:get(2)) + 20*pt
+ queue = queue + assert(archive:get(3)) + 20*pt
+ queue = queue + assert(archive:get(1)) + 20*pt
+ queue = queue + assert(archive:get(2)) + 20*pt
+ queue = queue + assert(archive:get(3))
+ % retrive a canvas instance
+ local ga = barracuda:new_canvas()
+ % draw the canvas with the driver component
+ assert(ga:encode_vbar_queue(queue, 0, 0, 30*pt))
+ local driver = barracuda:get_driver()
+ driver:ga_to_hbox(ga, [[mybox]])
+}A\box\mybox A
+
+\bye
+
+ \ No newline at end of file
diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.pdf b/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.pdf
new file mode 100644
index 0000000000..1465413c8a
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.tex b/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.tex
new file mode 100644
index 0000000000..c3692c282e
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-libgeo/003-ga-svg-test.tex
@@ -0,0 +1,41 @@
+% !TeX program = LuaTeX
+
+\newbox\mybox
+\nopagenumbers
+\directlua{
+local barracuda = require "barracuda"
+local barcode = barracuda:barcode()
+local driver = barracuda:get_driver()
+local mm = driver.mm
+
+local canvas = barracuda:new_canvas()
+canvas:encode_linewidth(1*mm)
+
+canvas:encode_dash_pattern(0, 2*mm)
+canvas:encode_hline(0, 30*mm, 5*mm)
+
+canvas:encode_dash_pattern(0, 2*mm, 4*mm)
+canvas:encode_hline(0, 30*mm, 10*mm)
+
+canvas:encode_dash_pattern(1*mm, 2*mm, 2*mm, 4*mm)
+canvas:encode_hline(0, 30*mm, 15*mm)
+
+canvas:encode_linewidth(0.05*mm)
+canvas:encode_reset_pattern()
+for i=0, 15 do
+ canvas:encode_vline(0, 20*mm, i*2*mm)
+end
+
+canvas:encode_dash_pattern(0.5*mm, 1*mm)
+canvas:encode_polyline{
+ 1*mm, 1*mm,
+ 29*mm, 1*mm,
+ 29*mm, 19*mm,
+ 1*mm, 19*mm,
+ 1*mm, 1*mm
+}
+
+driver:save("svg", canvas, "test")
+assert(driver:ga_to_hbox(canvas, [[mybox]]))
+}\leavevmode\box\mybox
+\bye \ No newline at end of file
diff --git a/macros/luatex/generic/barracuda/test/test-libgeo/test.svg b/macros/luatex/generic/barracuda/test/test-libgeo/test.svg
new file mode 100644
index 0000000000..d9614096c4
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-libgeo/test.svg
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Barracuda package (https://github.com/robitex/barracuda) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="30.050000mm" height="20.000000mm"
+ viewBox="-0.025000 -20.000000 30.050000 20.000000"
+>
+ <path d="M0.000000 -5.000000H30.000000"
+ stroke="black" stroke-width="1.000000"
+ stroke-dasharray="2.000000"
+ />
+ <path d="M0.000000 -10.000000H30.000000"
+ stroke="black" stroke-width="1.000000"
+ stroke-dasharray="2.000000 4.000000"
+ />
+ <path d="M0.000000 -15.000000H30.000000"
+ stroke="black" stroke-width="1.000000"
+ stroke-dasharray="2.000000 2.000000 4.000000"
+ stroke-dashoffset="1.000000"
+ />
+ <path d="M0.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M2.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M4.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M6.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M8.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M10.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M12.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M14.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M16.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M18.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M20.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M22.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M24.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M26.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M28.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <path d="M30.000000 -20.000000V-0.000000"
+ stroke="black" stroke-width="0.050000"
+ />
+ <g stroke="black" stroke-width="0.050000" fill="none" stroke-dasharray="1.000000" stroke-dashoffset="0.500000">
+ <polyline points="1.000000,-1.000000
+ 29.000000,-1.000000
+ 29.000000,-19.000000
+ 1.000000,-19.000000
+ 1.000000,-1.000000"/>
+ </g>
+</svg>
+
diff --git a/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.pdf b/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.pdf
new file mode 100644
index 0000000000..c4637e681a
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.tex b/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.tex
new file mode 100644
index 0000000000..3be12aa502
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-upc/001-upca-test.tex
@@ -0,0 +1,41 @@
+% !TeX program = LuaTeX
+% Copyright (C) 2019-2022 Roberto Giacomelli
+
+\newbox\mybox
+\nopagenumbers
+
+UPC encoder test.
+
+Test 1: one simple barcode UPC-A with default parameter:
+
+\directlua{
+barracuda = require "barracuda"
+local barcode = barracuda:barcode()
+barcode:set_param("debug_bbox", "qz")
+local upca, err = barcode:new_encoder("upc-A")
+assert(not err, err)
+
+local symbo, err = upca:from_string("042100005264")
+assert(not err, err)
+
+local canvas = barracuda:new_canvas()
+symbo:draw(canvas)
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}
+\vrule A\box\mybox A\vrule
+
+\bigskip\directlua{
+local barcode = barracuda:barcode()
+barcode:set_param("debug_bbox", "none")
+local upca = assert(barcode:enc_by_name("upc-A"))
+
+local symbo = assert(upca:new("012345678905"))
+local canvas = barracuda:new_canvas()
+symbo:draw(canvas)
+
+local drv = barracuda:get_driver()
+drv:ga_to_hbox(canvas, "mybox")
+}\leavevmode\box\mybox
+\bye
diff --git a/macros/luatex/generic/barracuda/test/test-upc/002-upca.pdf b/macros/luatex/generic/barracuda/test/test-upc/002-upca.pdf
new file mode 100644
index 0000000000..ed5363d1de
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-upc/002-upca.pdf
Binary files differ
diff --git a/macros/luatex/generic/barracuda/test/test-upc/002-upca.tex b/macros/luatex/generic/barracuda/test/test-upc/002-upca.tex
new file mode 100644
index 0000000000..5196ecbc7a
--- /dev/null
+++ b/macros/luatex/generic/barracuda/test/test-upc/002-upca.tex
@@ -0,0 +1,9 @@
+% !TeX program = LuaLaTeX
+% Copyright (C) 2019-2022 Roberto Giacomelli
+
+\documentclass[border=5pt]{standalone}
+\usepackage{barracuda}
+
+\begin{document}
+\barracuda[debug_bbox="qz"]{upc-A}{121212343430}
+\end{document} \ No newline at end of file