summaryrefslogtreecommitdiff
path: root/macros/luatex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex')
-rw-r--r--macros/luatex/latex/linebreaker/README.md2
-rw-r--r--macros/luatex/latex/linebreaker/linebreaker-doc.pdfbin49887 -> 49924 bytes
-rw-r--r--macros/luatex/latex/linebreaker/linebreaker-doc.tex6
-rw-r--r--macros/luatex/latex/linebreaker/linebreaker.lua15
4 files changed, 17 insertions, 6 deletions
diff --git a/macros/luatex/latex/linebreaker/README.md b/macros/luatex/latex/linebreaker/README.md
index a418e231b0..9e43302af4 100644
--- a/macros/luatex/latex/linebreaker/README.md
+++ b/macros/luatex/latex/linebreaker/README.md
@@ -1,4 +1,4 @@
-#The Linebreaker package, version v0.1b (2023-03-06)
+#The Linebreaker package, version v0.1c (2023-03-21)
This package tries to prevent overflow lines in paragraphs or boxes.
It changes the LuaTeX's `linebreak` callback, and it re-typesets the paragraph
diff --git a/macros/luatex/latex/linebreaker/linebreaker-doc.pdf b/macros/luatex/latex/linebreaker/linebreaker-doc.pdf
index b47fc0e3e3..f7f59562d4 100644
--- a/macros/luatex/latex/linebreaker/linebreaker-doc.pdf
+++ b/macros/luatex/latex/linebreaker/linebreaker-doc.pdf
Binary files differ
diff --git a/macros/luatex/latex/linebreaker/linebreaker-doc.tex b/macros/luatex/latex/linebreaker/linebreaker-doc.tex
index f94aa33ef0..baf9466c97 100644
--- a/macros/luatex/latex/linebreaker/linebreaker-doc.tex
+++ b/macros/luatex/latex/linebreaker/linebreaker-doc.tex
@@ -191,7 +191,11 @@ under the terms of the LaTeX Project Public License, version 1.3.
\section{Changes}
\begin{description}
- \item[v0.1b, 2023-03-06]\hfill
+ \item[v0.1c, 2023-03-21]\hfill
+ \begin{itemize}
+ \item Pass default parameters to all calls of \verb|tex.linebreak|, in order to support Bidi text in all instances.
+ \end{itemize}
+ \item[v0.1b, 2023-03-08]\hfill
\begin{itemize}
\item Set maximal value of tolerance to 8189, bigger value doesn't have any effect.
\item Added \verb|cubic| method for calculating tolerance.
diff --git a/macros/luatex/latex/linebreaker/linebreaker.lua b/macros/luatex/latex/linebreaker/linebreaker.lua
index 99966ad302..e5fa603dc8 100644
--- a/macros/luatex/latex/linebreaker/linebreaker.lua
+++ b/macros/luatex/latex/linebreaker/linebreaker.lua
@@ -160,8 +160,14 @@ local function find_best(params)
end
end
linebreaker.debug_print "best solution"
+ local ignored_types = {userdata=true, table = true}
for k,v in pairs(n) do
- linebreaker.debug_print(k,v)
+ -- we must ignore some properties in the params table,
+ -- as they produce errors when used in debug_print,
+ -- and they are not interesting for debugging anyway
+ if not ignored_types[type(v)] then
+ linebreaker.debug_print(k,v)
+ end
end
return n
end
@@ -406,7 +412,7 @@ function linebreaker.best_solution(par, parameters, step)
local params = parameters[#parameters] -- newest parameters are last in the
-- table that will be used in recursive invocations of this function
-- it holds updated parameters
- local newparams = {}
+ local newparams = linebreaker.parameters()
-- this value is set by hpack_quality callback that is executed by
-- tex.linebreak when overflow or underflow happens
linebreaker.badness = 0
@@ -474,16 +480,17 @@ local function fix_nest(info)
tex.nest[tex.nest.ptr].prevgraf=info.prevgraf
end
+
-- test whether the current overfull box message occurs inside our linebreaker function
local is_inside_linebreaker = false
function linebreaker.linebreak(head,is_display)
+ local parameters = linebreaker.parameters()
-- we can disable linebreaker processing
if linebreaker.active == false then
- local newhead, info = linebreaker.breaker(head)
+ local newhead, info = linebreaker.breaker(head, parameters)
fix_nest(info)
return newhead
end
- local parameters = linebreaker.parameters()
is_inside_linebreaker = true
local newhead, info = linebreaker.best_solution(head, {parameters})
is_inside_linebreaker = false