summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context/data/scite/context/scite-ctx.lua271
-rw-r--r--doc/context/documents/general/manuals/columnsets.pdfbin4512620 -> 4509576 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-cs.pdfbin834423 -> 834408 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-de.pdfbin836226 -> 836210 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-en.pdfbin839570 -> 839557 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-fr.pdfbin832480 -> 832459 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-it.pdfbin836929 -> 836899 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-nl.pdfbin829841 -> 829823 bytes
-rw-r--r--doc/context/documents/general/qrcs/setup-ro.pdfbin830964 -> 830937 bytes
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets-000.tex3
-rw-r--r--doc/context/sources/general/manuals/columnsets/columnsets.tex169
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv5
-rw-r--r--tex/context/base/mkiv/grph-inc.lua48
-rw-r--r--tex/context/base/mkiv/lang-rep.lua37
-rw-r--r--tex/context/base/mkiv/luat-cnf.lua2
-rw-r--r--tex/context/base/mkiv/page-cst.lua32
-rw-r--r--tex/context/base/mkiv/page-cst.mkiv402
-rw-r--r--tex/context/base/mkiv/page-flt.lua103
-rw-r--r--tex/context/base/mkiv/page-flt.mkiv9
-rw-r--r--tex/context/base/mkiv/page-one.mkiv48
-rw-r--r--tex/context/base/mkiv/page-pcl.mkiv556
-rw-r--r--tex/context/base/mkiv/publ-aut.lua6
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25817 -> 25795 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin248731 -> 250550 bytes
-rw-r--r--tex/context/base/mkiv/strc-flt.mkvi16
-rw-r--r--tex/context/base/mkiv/task-ini.lua4
-rw-r--r--tex/context/base/mkiv/typo-ovl.lua183
-rw-r--r--tex/context/base/mkiv/typo-ovl.mkiv115
-rw-r--r--tex/context/base/mkiv/typo-prc.lua4
-rw-r--r--tex/context/fonts/mkiv/stix-two-math.lfg3
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin839570 -> 839557 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60776 -> 60775 bytes
-rw-r--r--tex/context/modules/mkiv/m-typesetting.mkiv149
-rw-r--r--tex/context/modules/mkiv/s-evohome.mkiv2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
38 files changed, 1422 insertions, 753 deletions
diff --git a/context/data/scite/context/scite-ctx.lua b/context/data/scite/context/scite-ctx.lua
index 271a7581a..ad768d73b 100644
--- a/context/data/scite/context/scite-ctx.lua
+++ b/context/data/scite/context/scite-ctx.lua
@@ -75,17 +75,89 @@ props = props or { } -- setmetatable(props,{ __index = function(k,v) props[k] =
local byte, lower, upper, gsub, sub, find, rep, match, gmatch, format, char = string.byte, string.lower, string.upper, string.gsub, string.sub, string.find, string.rep, string.match, string.gmatch, string.format, string.char
local sort, concat = table.sort, table.concat
-local crlf = "\n"
+-- helpers : utf
-if not trace then
- trace = print
+local magicstring = rep("<ctx-crlf/>", 2)
+
+local l2 = char(0xC0)
+local l3 = char(0xE0)
+local l4 = char(0xF0)
+
+local function utflen(str)
+ local n = 0
+ local l = 0
+ for s in gmatch(str,".") do
+ if l > 0 then
+ l = l - 1
+ else
+ n = n + 1
+ if s >= l4 then
+ l = 3
+ elseif s >= l3 then
+ l = 2
+ elseif s >= l2 then
+ l = 1
+ end
+ end
+ end
+ return n
+end
+
+-- helpers: system
+
+function io.exists(filename)
+ local ok, result, message = pcall(io.open,filename)
+ if result then
+ io.close(result)
+ return true
+ else
+ return false
+ end
end
-function traceln(str)
- trace(str .. crlf)
- io.flush()
+function os.envvar(str)
+ local s = os.getenv(str)
+ if s ~= '' then
+ return s
+ end
+ s = os.getenv(upper(str))
+ if s ~= '' then
+ return s
+ end
+ s = os.getenv(lower(str))
+ if s ~= '' then
+ return s
+ end
end
+-- helpers: reporting
+
+local crlf = "\n"
+local report = nil
+local trace = trace
+
+if trace then
+ report = function(fmt,...)
+ if fmt then
+ trace(format(fmt,...))
+ end
+ trace(crlf)
+ io.flush()
+ end
+else
+ trace = print
+ report = function(fmt,...)
+ if fmt then
+ trace(format(fmt,...))
+ else
+ trace("")
+ end
+ io.flush()
+ end
+end
+
+-- helpers: whatever (old code, we should use our libs)
+
local function grab(str,delimiter)
local list = { }
for snippet in gmatch(str,delimiter) do
@@ -116,32 +188,7 @@ local function alphasort(list,i)
end
end
-function io.exists(filename)
- local ok, result, message = pcall(io.open,filename)
- if result then
- io.close(result)
- return true
- else
- return false
- end
-end
-
-function os.envvar(str)
- local s = os.getenv(str)
- if s ~= '' then
- return s
- end
- s = os.getenv(upper(str))
- if s ~= '' then
- return s
- end
- s = os.getenv(lower(str))
- if s ~= '' then
- return s
- end
-end
-
--- support functions, maybe editor namespace
+-- helpers: editor
-- function column_of_position(position)
-- local line = editor:LineFromPosition(position)
@@ -234,6 +281,53 @@ function get_dir_list(mask)
return files
end
+--helpers : utf from editor
+
+local cat -- has to be set to editor.CharAt
+
+local function toutfcode(pos) -- if needed we can cache
+ local c1 = cat[pos]
+ if c1 < 0 then
+ c1 = 256 + c1
+ end
+ if c1 < 128 then
+ return c1, 1
+ end
+ if c1 < 224 then
+ local c2 = cat[pos+1]
+ if c2 < 0 then
+ c2 = 256 + c2
+ end
+ return c1 * 64 + c2 - 12416, 2
+ end
+ if c1 < 240 then
+ local c2 = cat[pos+1]
+ local c3 = cat[pos+2]
+ if c2 < 0 then
+ c2 = 256 + c2
+ end
+ if c3 < 0 then
+ c3 = 256 + c3
+ end
+ return (c1 * 64 + c2) * 64 + c3 - 925824, 3
+ end
+ if c1 < 245 then
+ local c2 = cat[pos+1]
+ local c3 = cat[pos+2]
+ local c4 = cat[pos+3]
+ if c2 < 0 then
+ c2 = 256 + c2
+ end
+ if c3 < 0 then
+ c3 = 256 + c3
+ end
+ if c4 < 0 then
+ c4 = 256 + c4
+ end
+ return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168, 4
+ end
+end
+
-- banner
do
@@ -276,8 +370,8 @@ do
end
print("\n- recognized first lines:\n")
- print("xml <?xml version='1.0' language='nl'")
- print("tex % language=nl")
+ print("xml <?xml version='1.0' language='..'")
+ print("tex % language=..")
end
@@ -285,32 +379,6 @@ end
-- written while listening to Talk Talk
-local magicstring = rep("<ctx-crlf/>", 2)
-
-local l2 = char(0xC0)
-local l3 = char(0xE0)
-local l4 = char(0xF0)
-
-local function utflen(str)
- local n = 0
- local l = 0
- for s in gmatch(str,".") do
- if l > 0 then
- l = l - 1
- else
- n = n + 1
- if s >= l4 then
- l = 3
- elseif s >= l3 then
- l = 2
- elseif s >= l2 then
- l = 1
- end
- end
- end
- return n
-end
-
function wrap_text()
-- We always go to the end of a line, so in fact some of
@@ -589,7 +657,7 @@ end
-- for key, val in gmatch(firstline,"(%w+)=(%w+)") do
-- if key == "language" then
-- language = val
--- traceln("auto document language " .. "'" .. language .. "' (tex)")
+-- report("auto document language '%s' (%s)",language,"tex")
-- end
-- end
-- skipfirst = true
@@ -600,7 +668,7 @@ end
-- for key, val in gmatch(firstline,"(%w+)=[\"\'](.-)[\"\']") do
-- if key == "language" then
-- language = val
--- traceln("auto document language " .. "'" .. language .. "' (xml)")
+-- report("auto document language '%s' (%s)",language."xml")
-- end
-- end
-- skipfirst = true
@@ -619,7 +687,7 @@ end
-- filename = expand(wordpath) .. '/' .. filename
-- end
-- if io.exists(filename) then
--- traceln("loading " .. filename)
+-- report("loading " .. filename)
-- for line in io.lines(filename) do
-- if not find(line,"^[%#-]") then
-- str = gsub(line,"%s*$", '')
@@ -628,20 +696,20 @@ end
-- end
-- end
-- else
--- traceln("unknown file '" .. filename .."'")
+-- report("unknown file '%s'",filename)
-- end
-- end
--- traceln(worddone .. " words loaded")
+-- report("%i words loaded",worddone)
-- end
--
-- reset_text()
--
-- if worddone == 0 then
--- traceln("no (valid) language or wordfile specified")
+-- report("no (valid) language or wordfile specified")
-- else
--- traceln("start checking")
+-- report("start checking")
-- if wordskip ~= '' then
--- traceln("ignoring " .. wordskip .. "..." .. wordgood)
+-- report("ignoring %s ... %s",wordskip,wordgood)
-- end
-- local i, j, lastpos, startpos, endpos, snippet, len, first = 0, 0, -1, 0, 0, '', 0, 0
-- local ok, skip, ch = false, false, ''
@@ -680,7 +748,7 @@ end
-- skip = (ch == wordskip)
-- end
-- end
--- traceln(i .. " words checked, " .. (i-j) .. " errors")
+-- report("%i words checked, %i errors found",i,i-j)
-- end
--
-- end
@@ -706,70 +774,23 @@ function add_text()
if m then
n = n + 1
sum = sum + m
- traceln(format("%4i : %s",n,m))
+ report("%4i : %s",n,m)
end
end
if n > 0 then
- traceln("")
- traceln(format("sum : %s",sum))
+ report()
+ report("sum : %s",sum)
else
- traceln("no numbers selected")
+ report("no numbers selected")
end
end
-- test
-local bidi
-local cat
-
+local bidi = nil
local dirty = { }
--- if needed we can cache
-
-local function toutfcode(pos)
- local c1 = cat[pos]
- if c1 < 0 then
- c1 = 256 + c1
- end
- if c1 < 128 then
- return c1, 1
- end
- if c1 < 224 then
- local c2 = cat[pos+1]
- if c2 < 0 then
- c2 = 256 + c2
- end
- return c1 * 64 + c2 - 12416, 2
- end
- if c1 < 240 then
- local c2 = cat[pos+1]
- local c3 = cat[pos+2]
- if c2 < 0 then
- c2 = 256 + c2
- end
- if c3 < 0 then
- c3 = 256 + c3
- end
- return (c1 * 64 + c2) * 64 + c3 - 925824, 3
- end
- if c1 < 245 then
- local c2 = cat[pos+1]
- local c3 = cat[pos+2]
- local c4 = cat[pos+3]
- if c2 < 0 then
- c2 = 256 + c2
- end
- if c3 < 0 then
- c3 = 256 + c3
- end
- if c4 < 0 then
- c4 = 256 + c4
- end
- return ((c1 * 64 + c2) * 64 + c3) * 64 + c4 - 63447168, 4
- end
-end
-
local mapping = {
l = 0, -- "Left-to-Right",
lre = 7, -- "Left-to-Right Embedding",
@@ -902,7 +923,7 @@ function UserListShow(menutrigger, menulist)
end
local menustring = concat(menuentries,'|')
if menustring == "" then
- traceln("There are no templates defined for this file type.")
+ report("there are no templates defined for this file type")
else
editor.AutoCSeparator = byte('|')
editor:UserListShow(menutrigger,menustring)
@@ -1548,8 +1569,8 @@ local usedlists = {
}
local function make_strip()
- local used = usedlists[enabled]
- local lists = used.lists
+ local used = usedlists[enabled]
+ local lists = used.lists
local alphabet = lists[used.current]
local selector = "(hide)(" .. concat(used.selector,")(") .. ")"
local alphabet = "(" .. used.current .. ":)(" .. concat(alphabet,")(") .. ")"
@@ -1596,7 +1617,7 @@ end
-- parsing
function OnOpen(filename)
- -- print("opening: " .. filename .. " (size: " .. editor.TextLength .. ")")
+ -- report("opening '%s' of %i bytes",filename,editor.TextLength)
editor:Colourise(0,editor.TextLength)
end
diff --git a/doc/context/documents/general/manuals/columnsets.pdf b/doc/context/documents/general/manuals/columnsets.pdf
index 32a7f8b06..e0be48ec5 100644
--- a/doc/context/documents/general/manuals/columnsets.pdf
+++ b/doc/context/documents/general/manuals/columnsets.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf
index 3b3b7a33f..421bb6fa7 100644
--- a/doc/context/documents/general/qrcs/setup-cs.pdf
+++ b/doc/context/documents/general/qrcs/setup-cs.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf
index 55c5a2bf2..420b07a80 100644
--- a/doc/context/documents/general/qrcs/setup-de.pdf
+++ b/doc/context/documents/general/qrcs/setup-de.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf
index 8c8249219..35b8810b8 100644
--- a/doc/context/documents/general/qrcs/setup-en.pdf
+++ b/doc/context/documents/general/qrcs/setup-en.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf
index 358285012..be181d883 100644
--- a/doc/context/documents/general/qrcs/setup-fr.pdf
+++ b/doc/context/documents/general/qrcs/setup-fr.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf
index af879734a..56914364e 100644
--- a/doc/context/documents/general/qrcs/setup-it.pdf
+++ b/doc/context/documents/general/qrcs/setup-it.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf
index 9495e9598..bcc7963ce 100644
--- a/doc/context/documents/general/qrcs/setup-nl.pdf
+++ b/doc/context/documents/general/qrcs/setup-nl.pdf
Binary files differ
diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf
index a913fa7e5..431fbba29 100644
--- a/doc/context/documents/general/qrcs/setup-ro.pdf
+++ b/doc/context/documents/general/qrcs/setup-ro.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets-000.tex b/doc/context/sources/general/manuals/columnsets/columnsets-000.tex
index 429a067de..4f254e2ae 100644
--- a/doc/context/sources/general/manuals/columnsets/columnsets-000.tex
+++ b/doc/context/sources/general/manuals/columnsets/columnsets-000.tex
@@ -40,6 +40,9 @@
\setupfooter
[style=\tttf]
+\setupheader
+ [style=\tttf]
+
\setuptolerance
[verytolerant,stretch]
diff --git a/doc/context/sources/general/manuals/columnsets/columnsets.tex b/doc/context/sources/general/manuals/columnsets/columnsets.tex
index 0cb95229d..6df706d90 100644
--- a/doc/context/sources/general/manuals/columnsets/columnsets.tex
+++ b/doc/context/sources/general/manuals/columnsets/columnsets.tex
@@ -107,6 +107,11 @@
\definecolor[color-5][.5(white,color-4)]
\definecolor[color-6][.2(white,color-4)]
+\usemodule[typesetting]
+
+\setupcombination
+ [style=mono]
+
\startuseMPgraphic{page}
StartPage ;
path p ;
@@ -143,144 +148,6 @@ StopPage ;
\defineoverlay[frame] [\useMPgraphic{frame}]
\defineoverlay[contrast][\useMPgraphic{contrast}]
-\setupexternalfigures
- [background=frame]
-
-\definecombination
- [sixpages]
- [%inbetween=\blank,
- style=mono,
- distance=.5\bodyfontsize,
- width=\textwidth]
-
-\definecombination
- [fourpages]
- [%inbetween=\blank,
- style=mono,
- distance=.5\bodyfontsize,
- width=\textwidth]
-
-\definecombination
- [twopages]
- [style=mono]
-
-\definemeasure[twopages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
-\definemeasure[fourpages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
-\definemeasure[eightpages][\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
-\definemeasure[sixpages] [\dimexpr\dimexpr\textwidth-2.5\bodyfontsize\relax/6\relax]
-
-\starttexdefinition unexpanded OnePage #1
- \startlinecorrection[blank]
- \startcombination[twopages][1*1]
- {\typesetfile[#1.tex][page=1,lines=15]} {1}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded OneSpread #1
- \startlinecorrection[blank]
- \startcombination[twopages][1*1]
- {\typesetfile[#1.tex][page=2,lines=15]} {2}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded TwoPages #1
- \startlinecorrection[blank]
- \startcombination[twopages][2*1]
- {\typesetfile[#1.tex][page=1,width=\measure{twopages}]} {1}
- {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded TwoSpread #1
- \startlinecorrection[blank]
- \startcombination[twopages][2*1]
- {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{twopages}]} {3}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded FourPages #1
- \startlinecorrection[blank]
- \startcombination[fourpages][4*1]
- {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]} {1}
- {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{fourpages}]} {3}
- {\typesetfile[#1.tex][page=4,width=\measure{fourpages}]} {4}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded FourSpread #1
- \startlinecorrection[blank]
- \startcombination[fourpages][4*1]
- {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{fourpages}]} {3}
- {\typesetfile[#1.tex][page=4,width=\measure{fourpages}]} {4}
- {\typesetfile[#1.tex][page=5,width=\measure{fourpages}]} {5}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded SixPages #1
- \startlinecorrection[blank]
- \startcombination[sixpages][6*1]
- {\typesetfile[#1.tex][page=1,width=\measure{sixpages}]} {1}
- {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{sixpages}]} {3}
- {\typesetfile[#1.tex][page=4,width=\measure{sixpages}]} {4}
- {\typesetfile[#1.tex][page=5,width=\measure{sixpages}]} {5}
- {\typesetfile[#1.tex][page=6,width=\measure{sixpages}]} {6}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded SixSpread #1
- \startlinecorrection[blank]
- \startcombination[sixpages][6*1]
- {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{sixpages}]} {3}
- {\typesetfile[#1.tex][page=4,width=\measure{sixpages}]} {4}
- {\typesetfile[#1.tex][page=5,width=\measure{sixpages}]} {5}
- {\typesetfile[#1.tex][page=6,width=\measure{sixpages}]} {6}
- {\typesetfile[#1.tex][page=7,width=\measure{sixpages}]} {7}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded EightPages #1
- \startlinecorrection[blank]
- \startcombination[fourpages][4*2]
- {\typesetfile[#1.tex][page=1,width=\measure{eightpages}]} {#1 / 1}
- {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
- {\typesetfile[#1.tex][page=3,width=\measure{eightpages}]} {#1 / 3}
- {\typesetfile[#1.tex][page=4,width=\measure{eightpages}]} {#1 / 4}
- {\typesetfile[#1.tex][page=5,width=\measure{eightpages}]} {#1 / 5}
- {\typesetfile[#1.tex][page=6,width=\measure{eightpages}]} {#1 / 6}
- {\typesetfile[#1.tex][page=7,width=\measure{eightpages}]} {#1 / 7}
- {\typesetfile[#1.tex][page=8,width=\measure{eightpages}]} {#1 / 8}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
-\starttexdefinition unexpanded EightSpread #1
- \startlinecorrection[blank]
- \startcombination[fourpages][4*2]
- {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
- {\typesetfile[#1.tex][page=3,width=\measure{eightpages}]} {#1 / 3}
- {\typesetfile[#1.tex][page=4,width=\measure{eightpages}]} {#1 / 4}
- {\typesetfile[#1.tex][page=5,width=\measure{eightpages}]} {#1 / 5}
- {\typesetfile[#1.tex][page=6,width=\measure{eightpages}]} {#1 / 6}
- {\typesetfile[#1.tex][page=7,width=\measure{eightpages}]} {#1 / 7}
- {\typesetfile[#1.tex][page=8,width=\measure{eightpages}]} {#1 / 8}
- {\typesetfile[#1.tex][page=9,width=\measure{eightpages}]} {#1 / 9}
- \stopcombination
- \stoplinecorrection
-\stoptexdefinition
-
\setuphead
[chapter]
[style=\QuiteLarge,
@@ -352,23 +219,15 @@ StartPage ;
fill p shifted sh withcolor \MPcolor{color-3} withtransparency(1,.5) ;
draw q xysized (bbwidth(p),bbheight(p)) shifted sh ;
enddef ;
- if true :
- do_it ((2w/10,17d),(.1w,20d)) ;
- do_it ((2w/10,15d),(.1w,56d)) ;
- do_it ((2w/10,21d),(.4w,66d)) ;
- do_it ((2w/10,13d),(.7w,38d)) ;
- do_it ((5w/10,13d),(.4w,13d)) ;
- draw textext.urt("\ssbf Hans Hagen")
- xysized (5w/10,5d)
- shifted (.4w,6d)
- withcolor \MPcolor{color-5} ;
- else :
- do_it ((2w/10,17d),(.1w,15d)) ;
- do_it ((2w/10,15d),(.1w,51d)) ;
- do_it ((2w/10,21d),(.4w,61d)) ;
- do_it ((2w/10,13d),(.7w,31d)) ;
- do_it ((5w/10,13d),(.4w, 7d)) ;
- fi ;
+ do_it ((2w/10,17d),(.1w,20d)) ;
+ do_it ((2w/10,15d),(.1w,56d)) ;
+ do_it ((2w/10,21d),(.4w,66d)) ;
+ do_it ((2w/10,13d),(.7w,38d)) ;
+ do_it ((5w/10,13d),(.4w,13d)) ;
+ draw textext.urt("\ssbf Hans Hagen")
+ xysized (5w/10,5d)
+ shifted (.4w,6d)
+ withcolor \MPcolor{color-5} ;
StopPage ;
\stopMPpage
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 2ae75dd8b..0b056f401 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.11.15 22:08}
+\newcontextversion{2017.11.19 20:15}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index 6f3b9eb1b..a659bad96 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.11.15 22:08}
+\edef\contextversion{2017.11.19 20:15}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 2710731e3..5d7d41a9d 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.11.15 22:08}
+\newcontextversion{2017.11.19 20:15}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 01921f8ff..580304e12 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.11.15 22:08}
+\edef\contextversion{2017.11.19 20:15}
\edef\contextkind {beta}
%D For those who want to use this:
@@ -321,6 +321,7 @@
\loadmarkfile{page-mul} % partly overloaded
\loadmarkfile{page-mix} % new
\loadmarkfile{page-set}
+\loadmarkfile{page-pcl} % new
\loadmarkfile{pack-lyr}
\loadmarkfile{pack-pos}
\loadmkvifile{page-mak}
@@ -522,6 +523,8 @@
\loadmarkfile{lang-spa} % will become obsolete
+\loadmarkfile{typo-ovl} % fuzzy project (tracing) code
+
% old bibtex support: (will be m-oldbibtex.mkiv)
% \loadmarkfile{bibl-bib}
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index be6d365f1..8df33f73c 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -50,6 +50,7 @@ local todimen = string.todimen
local collapsepath = file.collapsepath
local formatters = string.formatters
local formatcolumns = utilities.formatters.formatcolumns
+local max, odd = math.max, math.odd
local P, R, S, Cc, C, Cs, Ct, lpegmatch = lpeg.P, lpeg.R, lpeg.S, lpeg.Cc, lpeg.C, lpeg.Cs, lpeg.Ct, lpeg.match
@@ -112,7 +113,9 @@ local ctx_stopfoundexternalfigure = context.stopfoundexternalfigure
local ctx_dosetfigureobject = context.dosetfigureobject
local ctx_doboxfigureobject = context.doboxfigureobject
-function images.check(figure)
+-- extensions
+
+function checkimage(figure)
if figure then
local width = figure.width
local height = figure.height
@@ -160,8 +163,6 @@ local function imagetotable(imgtable)
return result
end
-images.totable = imagetotable
-
function images.serialize(i,...)
return table.serialize(imagetotable(i),...)
end
@@ -180,7 +181,7 @@ end
local validsizes = table.tohash(images.boxes())
local validtypes = table.tohash(images.types())
-function images.checksize(size)
+local function checkimagesize(size)
if size then
size = gsub(size,"box","")
return validsizes[size] and size or "crop"
@@ -189,6 +190,17 @@ function images.checksize(size)
end
end
+local newimage = images.new
+local scanimage = images.scan
+local copyimage = images.copy
+local cloneimage = images.clone
+local imagetonode = images.node
+
+images.check = checkimage
+images.checksize = checkimagesize
+images.tonode = imagetonode
+images.totable = imagetotable
+
local indexed = { }
function images.ofindex(n)
@@ -549,8 +561,8 @@ function figures.initialize(request)
request.width = w > 0 and w or nil
request.height = h > 0 and h or nil
--
- request.page = math.max(tonumber(request.page) or 1,1)
- request.size = images.checksize(request.size)
+ request.page = max(tonumber(request.page) or 1,1)
+ request.size = checkimagesize(request.size)
request.object = request.object == v_yes
request["repeat"] = request["repeat"] == v_yes
request.preview = request.preview == v_yes
@@ -1338,7 +1350,7 @@ local function checktransform(figure,forced)
local orientation = (forced ~= "" and forced ~= v_auto and forced) or figure.orientation or 0
local transform = transforms["orientation-"..orientation]
figure.transform = transform
- if math.odd(transform) then
+ if odd(transform) then
return figure.height, figure.width
else
return figure.width, figure.height
@@ -1346,6 +1358,8 @@ local function checktransform(figure,forced)
end
end
+local pagecount = { }
+
function checkers.generic(data)
local dr, du, ds = data.request, data.used, data.status
local name = du.fullname or "unknown generic"
@@ -1377,7 +1391,7 @@ function checkers.generic(data)
)
local figure = figures_loaded[hash]
if figure == nil then
- figure = images.new {
+ figure = newimage {
filename = name,
page = page,
pagebox = dr.size,
@@ -1386,7 +1400,15 @@ function checkers.generic(data)
codeinjections.setfigurecolorspace(data,figure)
codeinjections.setfiguremask(data,figure)
if figure then
- local f, comment = images.check(images.scan(figure))
+if page and page > 1 then
+ local f = scanimage{ filename = name }
+ if f.page and f.pages < page then
+ report_inclusion("no page %i in %a, using page 1",page,name)
+ page = 1
+ figure.page = page
+ end
+end
+ local f, comment = checkimage(scanimage(figure))
if not f then
ds.comment = comment
ds.found = false
@@ -1448,8 +1470,8 @@ function includers.generic(data)
if figure == nil then
figure = ds.private
if figure then
- figure = images.copy(figure)
- figure = figure and images.clone(figure,data.request) or false
+ figure = copyimage(figure)
+ figure = figure and cloneimage(figure,data.request) or false
end
figures_used[hash] = figure
end
@@ -1457,13 +1479,13 @@ function includers.generic(data)
local nr = figures.boxnumber
nofimages = nofimages + 1
ds.pageindex = nofimages
- local image = images.node(figure)
+ local image = imagetonode(figure)
local pager = new_latelua(function()
pofimages[nofimages] = pofimages[nofimages] or tex.count.realpageno -- so when reused we register the first one only
end)
image.next = pager
pager.prev = image
- local box = hpack(image) -- images.node(figure) not longer valid
+ local box = hpack(image) -- imagetonode(figure) not longer valid
indexed[figure.index] = figure
box.width, box.height, box.depth = figure.width, figure.height, 0 -- new, hm, tricky, we need to do that in tex (yet)
diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua
index a09574ef4..d4d16f6a3 100644
--- a/tex/context/base/mkiv/lang-rep.lua
+++ b/tex/context/base/mkiv/lang-rep.lua
@@ -77,6 +77,9 @@ local v_reset = interfaces.variables.reset
local implement = interfaces.implement
+local processors = typesetters.processors
+local splitprocessor = processors.split
+
local replacements = languages.replacements or { }
languages.replacements = replacements
@@ -102,7 +105,8 @@ lists[v_reset].attribute = unsetvalue -- so we discard 0
-- todo: glue kern attr
local function add(root,word,replacement)
- local replacement = lpegmatch(stripper,replacement) or replacement
+ local processor, replacement = splitprocessor(replacement,true) -- no check
+ replacement = lpegmatch(stripper,replacement) or replacement
local list = utfsplit(word,true)
local size = #list
for i=1,size do
@@ -111,16 +115,12 @@ local function add(root,word,replacement)
root[l] = { }
end
if i == size then
- -- local newlist = utfsplit(replacement,true)
- -- for i=1,#newlist do
- -- newlist[i] = utfbyte(newlist[i])
- -- end
local special = find(replacement,"{",1,true)
local newlist = lpegmatch(splitter,replacement)
- --
root[l].final = {
word = word,
replacement = replacement,
+ processor = processor,
oldlength = size,
newcodes = newlist,
special = special,
@@ -170,7 +170,10 @@ local function hit(a,head)
local lastrun = false
local lastfinal = false
while current do
- local char = isglyph(current)
+ local char, id = isglyph(current)
+ -- if not char and id == glue_code then
+ -- char = " " -- if needed we can also deal with spaces and special nbsp and such
+ -- end
if char then
local newroot = root[char]
if not newroot then
@@ -213,20 +216,21 @@ local function tonodes(list,template)
return head
end
-
function replacements.handler(head)
head = tonut(head)
- local current = head
- local done = false
+ local current = head
+ local done = false
+ local overload = attributes.applyoverloads
while current do
if getid(current) == glyph_code then
local a = getattr(current,a_replacements)
if a then
local last, final = hit(a,current)
if last then
- local oldlength = final.oldlength
- local newcodes = final.newcodes
- local newlength = #newcodes
+ local precurrent = getprev(current) or head
+ local oldlength = final.oldlength
+ local newcodes = final.newcodes
+ local newlength = newcodes and #newcodes or 0
if trace_replacement then
report_replacement("replacing word %a by %a",final.word,final.replacement)
end
@@ -288,6 +292,9 @@ function replacements.handler(head)
i = i + 1
end
flush_list(list)
+ elseif newlength == 0 then
+ -- nothing gets replaced
+ current = getnext(last)
elseif oldlength == newlength then -- #old == #new
if final.word == final.replacement then
-- nothing to do but skip
@@ -317,10 +324,14 @@ function replacements.handler(head)
current = getnext(current)
end
end
+ if overload then
+ overload(final,getnext(precurrent),getprev(current))
+ end
done = true
end
end
end
+ -- we're one ahead now but we need to because we handle words
current = getnext(current)
end
return tonode(head), done
diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua
index 46294741f..b6ee15083 100644
--- a/tex/context/base/mkiv/luat-cnf.lua
+++ b/tex/context/base/mkiv/luat-cnf.lua
@@ -19,7 +19,7 @@ texconfig.shell_escape = 't'
luatex = luatex or { }
local luatex = luatex
-texconfig.error_line = 79 -- frozen
+texconfig.error_line = 79 -- frozen / large values can crash
texconfig.expand_depth = 10000
texconfig.half_error_line = 50 -- frozen
texconfig.hash_extra = 100000
diff --git a/tex/context/base/mkiv/page-cst.lua b/tex/context/base/mkiv/page-cst.lua
index 1b537b288..ec59045a1 100644
--- a/tex/context/base/mkiv/page-cst.lua
+++ b/tex/context/base/mkiv/page-cst.lua
@@ -236,7 +236,7 @@ function columnsets.define(t)
end
end
--
- texsetdimen("d_page_grid_column_width",dataset.width)
+ texsetdimen("d_page_grd_column_width",dataset.width)
--
setstate(dataset,true)
--
@@ -342,15 +342,15 @@ function columnsets.prepareflush(name)
columns[c] = new_vlist(column[1],widths[c],height,0) -- linedepth
end
--
- texsetcount("c_page_grid_first_column",firstcolumn)
- texsetcount("c_page_grid_last_column",lastcolumn)
+ texsetcount("c_page_grd_first_column",firstcolumn)
+ texsetcount("c_page_grd_last_column",lastcolumn)
end
function columnsets.flushcolumn(name,column)
local dataset = data[name]
local columns = dataset.columns
local packed = columns[column]
- setbox("b_page_grid_column",packed)
+ setbox("b_page_grd_column",packed)
columns[column] = nil
end
@@ -637,7 +637,7 @@ function columnsets.check(t)
r = dataset.currentrow
end
if c == 0 or r == 0 or c > nofcolumns or r > nofrows then
- texsetcount("c_page_grid_reserved_state",5)
+ texsetcount("c_page_grd_reserved_state",5)
return
end
-- report("checking width %p, height %p, depth %p, slot (%i,%i)",boxwidth,boxheight,boxdepth,c,r)
@@ -666,9 +666,9 @@ function columnsets.check(t)
dataset.reserved_r = rfound
dataset.reserved_nc = nc
dataset.reserved_nr = nr
- texsetcount("c_page_grid_reserved_state",0)
- texsetdimen("d_page_grid_reserved_height",ht)
- texsetdimen("d_page_grid_reserved_width",wd)
+ texsetcount("c_page_grd_reserved_state",0)
+ texsetdimen("d_page_grd_reserved_height",ht)
+ texsetdimen("d_page_grd_reserved_width",wd)
-- report("using (%i,%i) x (%i,%i) @ (%p,%p)",cfound,rfound,nc,nr,wd,ht)
else
dataset.reserved_ht = false
@@ -677,9 +677,9 @@ function columnsets.check(t)
dataset.reserved_r = false
dataset.reserved_nc = false
dataset.reserved_nr = false
- texsetcount("c_page_grid_reserved_state",4)
- -- texsetdimen("d_page_grid_reserved_height",0)
- -- texsetdimen("d_page_grid_reserved_width",0)
+ texsetcount("c_page_grd_reserved_state",4)
+ -- texsetdimen("d_page_grd_reserved_height",0)
+ -- texsetdimen("d_page_grd_reserved_width",0)
-- report("no slot found")
end
end
@@ -1130,14 +1130,14 @@ function columnsets.setvsize(name)
n = 0
end
local gap = n*(dataset.lineheight+dataset.linedepth)
- texsetdimen("d_page_grid_gap_height",gap)
+ texsetdimen("d_page_grd_gap_height",gap)
-- can be integrated
-- report("state %a, n %a, column %a, row %a",dataset.state,n,dataset.currentcolumn,dataset.currentrow)
end
function columnsets.sethsize(name)
local dataset = data[name]
- texsetdimen("d_page_grid_column_width",dataset.widths[dataset.currentcolumn])
+ texsetdimen("d_page_grd_column_width",dataset.widths[dataset.currentcolumn])
end
function columnsets.sethspan(name,span)
@@ -1150,7 +1150,7 @@ function columnsets.sethspan(name,span)
span = available
end
local width = dataset.spans[column][span]
- texsetdimen("d_page_grid_span_width",width)
+ texsetdimen("d_page_grd_span_width",width)
end
function columnsets.setlines(t)
@@ -1179,7 +1179,7 @@ end
-- state : repeat | start
-local ctx_page_grid_set_area = context.protected.page_grid_set_area
+local ctx_page_grd_set_area = context.protected.page_grd_set_area
function columnsets.flushareas(name)
local nofareas = #areas
@@ -1218,7 +1218,7 @@ function columnsets.flushareas(name)
local used = nofcolumns - overflow
left = dataset.spreads[column][used] + getdimen("backspace")
end
- ctx_page_grid_set_area(name,area.name,column,row,width,height,start,left) -- or via counters / dimens
+ ctx_page_grd_set_area(name,area.name,column,row,width,height,start,left) -- or via counters / dimens
if area.state ~= v_repeat then
area = nil
end
diff --git a/tex/context/base/mkiv/page-cst.mkiv b/tex/context/base/mkiv/page-cst.mkiv
index e71da688b..26cb4ea98 100644
--- a/tex/context/base/mkiv/page-cst.mkiv
+++ b/tex/context/base/mkiv/page-cst.mkiv
@@ -71,41 +71,41 @@
}%
\to \everydefinepagegrid
-\newdimen \d_page_grid_column_width
-\newdimen \d_page_grid_max_height
-\newdimen \d_page_grid_max_width
-\newdimen \d_page_grid_distance
+\newdimen \d_page_grd_column_width
+\newdimen \d_page_grd_max_height
+\newdimen \d_page_grd_max_width
+\newdimen \d_page_grd_distance
-\newdimen \d_page_grid_reserved_height
-\newdimen \d_page_grid_reserved_width
-\newcount \c_page_grid_reserved_state
+\newdimen \d_page_grd_reserved_height
+\newdimen \d_page_grd_reserved_width
+\newcount \c_page_grd_reserved_state
-\newdimen \d_page_grid_gap_height
+\newdimen \d_page_grd_gap_height
-\newcount \c_page_grid_n_of_left
-\newcount \c_page_grid_n_of_right
-\newcount \c_page_grid_n_of_rows
-\newcount \c_page_grid_first_column
-\newcount \c_page_grid_last_column
+\newcount \c_page_grd_n_of_left
+\newcount \c_page_grd_n_of_right
+\newcount \c_page_grd_n_of_rows
+\newcount \c_page_grd_first_column
+\newcount \c_page_grd_last_column
-\newbox \b_page_grid_collected
-\newbox \b_page_grid_column_rest
-\newbox \b_page_grid_column
+\newbox \b_page_grd_collected
+\newbox \b_page_grd_column_rest
+\newbox \b_page_grd_column
-\unexpanded\def\setuppagegridlines{\doquadrupleempty\page_grid_setup_lines}
-\unexpanded\def\setuppagegridstart{\doquadrupleempty\page_grid_setup_start}
+\unexpanded\def\setuppagegridlines{\doquadrupleempty\page_grd_setup_lines}
+\unexpanded\def\setuppagegridstart{\doquadrupleempty\page_grd_setup_start}
-\def\page_grid_setup_lines[#1][#2][#3][#4]% id page col value
+\def\page_grd_setup_lines[#1][#2][#3][#4]% id page col value
{\clf_setcolumnsetlines{name {#1} page #2 column #3 value #4}}
-\def\page_grid_setup_start[#1][#2][#3][#4]% id page col value
+\def\page_grd_setup_start[#1][#2][#3][#4]% id page col value
{\clf_setcolumnsetstart{name {#1} page #2 column #3 value #4}}
-\unexpanded\def\page_grid_check
+\unexpanded\def\page_grd_check
{\dorecurse{\numexpr\pagegridparameter\c!nleft+\pagegridparameter\c!nright}
- {\page_grid_check_column{##1}}}
+ {\page_grd_check_column{##1}}}
-\unexpanded\def\page_grid_check_column#1%
+\unexpanded\def\page_grd_check_column#1%
{\chaintocurrentpagegrid{\currentpagegrid:#1}%
\edef\p_distance{\namedpagegridparameter{\currentpagegrid:#1}\c!distance}%
\edef\p_width {\namedpagegridparameter{\currentpagegrid:#1}\c!width}%
@@ -127,13 +127,13 @@
\unexpanded\def\startpagegrid
{\bgroup
- \dodoubleempty\page_grid_start}
+ \dodoubleempty\page_grd_start}
-\def\page_grid_start_dummy[#1][#2]%
- {\let\page_grid_stop\egroup}
+\def\page_grd_start_dummy[#1][#2]%
+ {\let\page_grd_stop\egroup}
-\def\page_grid_start[#1][#2]%
- {\let\page_grid_start\page_grid_start_dummy
+\def\page_grd_start[#1][#2]%
+ {\let\page_grd_start\page_grd_start_dummy
\ifsecondargument
\edef\currentpagegrid{#1}%
\setupcurrentpagegrid[#2]%
@@ -146,52 +146,52 @@
\let\currentpagegrid\empty
\fi\fi
\usepageparameter\pagegridparameter
- \c_page_grid_n_of_left \pagegridparameter\c!nleft\relax
- \c_page_grid_n_of_right\pagegridparameter\c!nright\relax
- \c_page_grid_n_of_rows \pagegridparameter\c!lines\relax
- \d_page_grid_max_width \pagegridparameter\c!maxwidth\relax
- \d_page_grid_max_height\pagegridparameter\c!maxheight\relax
- \d_page_grid_distance \pagegridparameter\c!distance\relax
+ \c_page_grd_n_of_left \pagegridparameter\c!nleft\relax
+ \c_page_grd_n_of_right\pagegridparameter\c!nright\relax
+ \c_page_grd_n_of_rows \pagegridparameter\c!lines\relax
+ \d_page_grd_max_width \pagegridparameter\c!maxwidth\relax
+ \d_page_grd_max_height\pagegridparameter\c!maxheight\relax
+ \d_page_grd_distance \pagegridparameter\c!distance\relax
%
- \ifcase\c_page_grid_n_of_rows
- \getrawnoflines{\dimexpr\d_page_grid_max_height-\strutheight+\topskip\relax}%
- \c_page_grid_n_of_rows\noflines
+ \ifcase\c_page_grd_n_of_rows
+ \getrawnoflines{\dimexpr\d_page_grd_max_height-\strutheight+\topskip\relax}%
+ \c_page_grd_n_of_rows\noflines
\fi
\edef\p_width{\pagegridparameter\c!width}%
\insidecolumnstrue % will be different flag in addition
\clf_resetcolumnset {
name {\currentpagegrid}
- nofrows \c_page_grid_n_of_rows
- nofleft \c_page_grid_n_of_left
- nofright \c_page_grid_n_of_right
+ nofrows \c_page_grd_n_of_rows
+ nofleft \c_page_grd_n_of_left
+ nofright \c_page_grd_n_of_right
lineheight \strutht
linedepth \strutdp
\ifx\p_width\v!auto
- % sets \d_page_grid_column_width
+ % sets \d_page_grd_column_width
\else
width \p_width
\fi
- distance \d_page_grid_distance
- maxwidth \d_page_grid_max_width
+ distance \d_page_grd_distance
+ maxwidth \d_page_grd_max_width
}%
%
- \page_grid_check
+ \page_grd_check
%
\clf_flushcolumnsetareas{\currentpagegrid}\relax
\setupoutputroutine[\s!pagegrid]%
- \page_grid_command_set_hsize
- \page_grid_command_set_vsize
+ \page_grd_command_set_hsize
+ \page_grd_command_set_vsize
}%\begingroup}
\unexpanded\def\stoppagegrid
- {\page_grid_stop}
+ {\page_grd_stop}
-\def\page_grid_stop
+\def\page_grd_stop
{\endgraf % needed, else wrong vsize in one par case
\vfill % otherwise weird \placenotes[endnotes]
\page_otr_command_set_vsize % needed
\penalty\c_page_otr_eject_penalty
- \page_grid_command_flush_page
+ \page_grd_command_flush_page
\page_otr_fill_and_eject_page
\page_otr_command_set_vsize % needed
\egroup
@@ -215,17 +215,17 @@
\endgroup}
\unexpanded\def\setpagegrid
- {\dosingleempty\page_grid_set}
+ {\dosingleempty\page_grd_set}
-\unexpanded\def\page_grid_set[#1]%
+\unexpanded\def\page_grd_set[#1]%
{\begingroup
\letdummyparameter\c!c\zerocount
\letdummyparameter\c!r\zerocount
\letdummyparameter\c!option\v!none
\getdummyparameters[#1]%
- \dowithnextboxcs\page_grid_set_indeed\hbox}
+ \dowithnextboxcs\page_grd_set_indeed\hbox}
-\def\page_grid_set_indeed
+\def\page_grd_set_indeed
{\clf_checkcolumnset {
name {\currentpagegrid}
c \dummyparameter\c!c
@@ -233,16 +233,16 @@
box \nextbox
option {\dummyparameter\c!option}
}%
- \ifcase\c_page_grid_reserved_state
- \setbox\nextbox\vpack to \d_page_grid_reserved_height \bgroup
+ \ifcase\c_page_grd_reserved_state
+ \setbox\nextbox\vpack to \d_page_grd_reserved_height \bgroup
\vss
- \hpack to \d_page_grid_reserved_width \bgroup
+ \hpack to \d_page_grd_reserved_width \bgroup
\box\nextbox
\hss
\egroup
\vss
\egroup
- \wd\nextbox\d_page_grid_reserved_width
+ \wd\nextbox\d_page_grd_reserved_width
\clf_putincolumnset {
name {\currentpagegrid}
box \nextbox
@@ -250,31 +250,31 @@
\fi
\endgroup}
-\unexpanded\def\page_grid_command_set_vsize
+\unexpanded\def\page_grd_command_set_vsize
{\clf_setvsizecolumnset{\currentpagegrid}%
- \ifdim\d_page_grid_gap_height<\lineheight
- \page_grid_command_flush_page
+ \ifdim\d_page_grd_gap_height<\lineheight
+ \page_grd_command_flush_page
\page_otr_fill_and_eject_page
\fi
- \global\vsize\d_page_grid_gap_height
+ \global\vsize\d_page_grd_gap_height
\pagegoal\vsize}
-\unexpanded\def\page_grid_command_set_hsize
+\unexpanded\def\page_grd_command_set_hsize
{\clf_sethsizecolumnset{\currentpagegrid}%
- \hsize\d_page_grid_column_width
- \textwidth\d_page_grid_column_width}
+ \hsize\d_page_grd_column_width
+ \textwidth\d_page_grd_column_width}
-\unexpanded\def\page_grid_command_routine
+\unexpanded\def\page_grd_command_routine
{\ifvoid\normalpagebox \else
\clf_addtocolumnset{\currentpagegrid}\normalpagebox
\fi
- \page_grid_command_set_vsize
- \page_grid_command_flush_saved_floats
- \page_grid_command_set_vsize
- \ifdim\d_page_grid_gap_height<\lineheight
- \page_grid_command_flush_page
+ \page_grd_command_set_vsize
+ \page_grd_command_flush_saved_floats
+ \page_grd_command_set_vsize
+ \ifdim\d_page_grd_gap_height<\lineheight
+ \page_grd_command_flush_page
\fi
- \page_grid_command_set_vsize
+ \page_grd_command_set_vsize
\clf_flushcolumnsetrest {\currentpagegrid}\normalpagebox
\ifvoid\normalpagebox \else
\unvbox\normalpagebox
@@ -283,7 +283,7 @@
\installoutputroutine\synchronizepagegrid
{\ifvoid\normalpagebox\else
\clf_addtocolumnset{\currentpagegrid}\normalpagebox
- \page_grid_command_set_vsize
+ \page_grd_command_set_vsize
\clf_flushcolumnsetrest{\currentpagegrid}\normalpagebox
\ifvoid\normalpagebox \else
\unvbox\normalpagebox
@@ -292,82 +292,82 @@
% todo line numbers and marks
-\unexpanded\def\page_grid_command_flush_page_column#1%
+\unexpanded\def\page_grd_command_flush_page_column#1%
{\privatescratchcounter#1\relax
\clf_flushcolumnsetcolumn{\currentpagegrid}\privatescratchcounter
- \anch_mark_column_box\b_page_grid_column
- \page_marks_synchronize_column\c_page_grid_first_column\c_page_grid_last_column\privatescratchcounter\b_page_grid_column
- \ifnum\privatescratchcounter>\c_page_grid_n_of_left
- \advance\privatescratchcounter-\c_page_grid_n_of_left
- \page_lines_add_numbers_to_box\b_page_grid_column\privatescratchcounter\c_page_grid_n_of_right\plustwo
+ \anch_mark_column_box\b_page_grd_column
+ \page_marks_synchronize_column\c_page_grd_first_column\c_page_grd_last_column\privatescratchcounter\b_page_grd_column
+ \ifnum\privatescratchcounter>\c_page_grd_n_of_left
+ \advance\privatescratchcounter-\c_page_grd_n_of_left
+ \page_lines_add_numbers_to_box\b_page_grd_column\privatescratchcounter\c_page_grd_n_of_right\plustwo
\else
- \page_lines_add_numbers_to_box\b_page_grid_column\privatescratchcounter\c_page_grid_n_of_left\plustwo
+ \page_lines_add_numbers_to_box\b_page_grd_column\privatescratchcounter\c_page_grd_n_of_left\plustwo
\fi
\begingroup
\edef\currentpagegrid{\currentpagegrid:#1}%
- \inheritedpagegridframedbox\box\b_page_grid_column
+ \inheritedpagegridframedbox\box\b_page_grd_column
\endgroup}
-\unexpanded\def\page_grid_command_flush_page
+\unexpanded\def\page_grd_command_flush_page
{\deactivatecolor % puzzling, try ungrouped color \red or so
- \setbox\b_page_grid_collected\hpack\bgroup
+ \setbox\b_page_grd_collected\hpack\bgroup
\clf_preparecolumnsetflush{\currentpagegrid}%
\letpagegridparameter\c!region\currentpagegrid
\doifelse{\pagegridparameter\c!direction}\v!reverse
- {\dostepwiserecurse\c_page_grid_last_column\c_page_grid_first_column\minusone
- {\page_grid_command_flush_page_column{##1}%
+ {\dostepwiserecurse\c_page_grd_last_column\c_page_grd_first_column\minusone
+ {\page_grd_command_flush_page_column{##1}%
\ifnum##1>\plusone
\kern\namedpagegridparameter{\currentpagegrid:##1}\c!distance\relax
\fi}}%
- {\dostepwiserecurse\c_page_grid_first_column\c_page_grid_last_column\plusone
- {\page_grid_command_flush_page_column{##1}%
- \ifnum##1<\c_page_grid_last_column
+ {\dostepwiserecurse\c_page_grd_first_column\c_page_grd_last_column\plusone
+ {\page_grd_command_flush_page_column{##1}%
+ \ifnum##1<\c_page_grd_last_column
\kern\namedpagegridparameter{\currentpagegrid:##1}\c!distance\relax
\fi}}%
\clf_finishcolumnsetflush{\currentpagegrid}%
\egroup
- \page_otr_construct_and_shipout\box\b_page_grid_collected\zerocount % three arguments
+ \page_otr_construct_and_shipout\box\b_page_grd_collected\zerocount % three arguments
\clf_flushcolumnsetareas{\currentpagegrid}\relax
- \page_grid_command_flush_saved_floats}
+ \page_grd_command_flush_saved_floats}
% slow but robust
-\unexpanded\def\page_grid_command_next_progress
+\unexpanded\def\page_grd_command_next_progress
{\strut
\page_otr_flush_all_floats
\page_otr_eject_page
\ifcase\clf_columnsetnoto\else
- \expandafter\page_grid_command_next_progress
+ \expandafter\page_grd_command_next_progress
\fi}
-\unexpanded\def\page_grid_command_handle_column
+\unexpanded\def\page_grd_command_handle_column
{\ifcase\clf_columnsetgoto{\currentpagegrid}{\page_breaks_columns_current_option}\relax\else
- \expandafter\page_grid_command_next_progress
+ \expandafter\page_grd_command_next_progress
\fi}
-\installcolumnbreakmethod\s!pagegrid\s!unknown {\page_grid_command_handle_column}
-\installcolumnbreakmethod\s!pagegrid\v!yes {\page_grid_command_handle_column}
+\installcolumnbreakmethod\s!pagegrid\s!unknown {\page_grd_command_handle_column}
+\installcolumnbreakmethod\s!pagegrid\v!yes {\page_grd_command_handle_column}
-\unexpanded\def\page_grid_command_next_page
+\unexpanded\def\page_grd_command_next_page
{\ifcase\clf_columnsetgoto{\currentpagegrid}{\v!page}\relax\else
- \page_grid_command_flush_page
+ \page_grd_command_flush_page
\fi}
-\unexpanded\def\page_grid_command_next_page_and_inserts
+\unexpanded\def\page_grd_command_next_page_and_inserts
% {\page_otr_eject_page_and_flush_inserts}
{\page_otr_flush_all_floats
- \page_grid_command_next_page}
+ \page_grd_command_next_page}
-\let\page_grid_command_package_contents\page_one_command_package_contents
+\let\page_grd_command_package_contents\page_one_command_package_contents
-\unexpanded\def\page_grid_command_flush_saved_floats
+\unexpanded\def\page_grd_command_flush_saved_floats
{\ifconditional\c_page_floats_flushing \else
\ifconditional\c_page_floats_some_waiting
- \page_grid_command_flush_saved_floats_indeed
+ \page_grd_command_flush_saved_floats_indeed
\fi
\fi}
-\unexpanded\def\page_grid_command_flush_saved_floats_indeed
+\unexpanded\def\page_grd_command_flush_saved_floats_indeed
{\page_floats_flush\s!text\plusone
\clf_checkcolumnset {
name {\currentpagegrid}
@@ -375,11 +375,11 @@
width \wd\floatbox
height \ht\floatbox
}%
- \ifcase\c_page_grid_reserved_state
- \page_grid_place_float_here_indeed
- \page_grid_command_set_vsize % needed
+ \ifcase\c_page_grd_reserved_state
+ \page_grd_place_float_here_indeed
+ \page_grd_command_set_vsize % needed
\ifconditional\c_page_floats_some_waiting
- \doubleexpandafter\page_grid_command_flush_saved_floats_indeed
+ \doubleexpandafter\page_grd_command_flush_saved_floats_indeed
\fi
\else
\page_floats_resave\s!text
@@ -387,48 +387,52 @@
% needs checking
-\unexpanded\def\page_grid_command_flush_floats
+\unexpanded\def\page_grd_command_flush_floats
{\wait\global\settrue\c_page_floats_flushing
\ifconditional\c_page_floats_some_waiting
\par
- \page_grid_command_flush_floats_indeed
+ \page_grd_command_flush_floats_indeed
\fi
\global\savednoffloats\zerocount
\global\setfalse\c_page_floats_some_waiting
\global\setfalse\c_page_floats_flushing}
-\def\page_grid_command_flush_floats_indeed % much in common with OTRSET
+\def\page_grd_command_flush_floats_indeed % much in common with OTRSET
{\wait\ifconditional\c_page_floats_some_waiting
\ifconditional\c_page_floats_pack_flushed
- \setfalse\c_page_floats_center_box % not needed as we do call directly
\page_floats_collect\s!text\hsize\emwidth
- \global\setbox\floatbox\hbox to \hsize
- {\hfil
- \dorecurse\nofcollectedfloats
- {\ifcase\columndirection % nog document wide
- \page_floats_flush\s!text\plusone
- \else
- \page_floats_flush\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}%
- \fi
- \ifdim\wd\floatbox>\makeupwidth % \hsize
- \hbox to \makeupwidth{\hss\box\floatbox\hss}%
- \else
- \box\floatbox
- \fi
- \ifnum\recurselevel<\nofcollectedfloats
- \hfil
- \fi}%
- \hfil}%
+ \ifcase\nofcollectedfloats
+ \page_floats_get
+ \else
+ \setfalse\c_page_floats_center_box % not needed as we do call directly
+ \global\setbox\floatbox\hbox to \hsize
+ {\hfil
+ \dorecurse\nofcollectedfloats
+ {\ifcase\columndirection % nog document wide
+ \page_floats_flush\s!text\plusone
+ \else
+ \page_floats_flush\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}%
+ \fi
+ \ifdim\wd\floatbox>\makeupwidth % \hsize
+ \hbox to \makeupwidth{\hss\box\floatbox\hss}%
+ \else
+ \box\floatbox
+ \fi
+ \ifnum\recurselevel<\nofcollectedfloats
+ \hfil
+ \fi}%
+ \hfil}%
+ \fi
\else
\page_floats_get
\fi
\doplacefloatbox
- \expandafter\page_grid_command_flush_floats_indeed
+ \expandafter\page_grd_command_flush_floats_indeed
\fi}
% so far
-\unexpanded\def\page_grid_command_check_if_float_fits
+\unexpanded\def\page_grd_command_check_if_float_fits
{\clf_checkcolumnset {
name {\currentpagegrid}
method {\floatmethod}
@@ -436,16 +440,16 @@
% r \zerocount
box \floatbox
}%
- \ifcase\c_page_grid_reserved_state
+ \ifcase\c_page_grd_reserved_state
\global\settrue\c_page_floats_room
\else
\global\setfalse\c_page_floats_room
\fi}
-\unexpanded\def\page_grid_place_float_here_indeed
- {\setbox\floatbox\vpack to \d_page_grid_reserved_height \bgroup
+\unexpanded\def\page_grd_place_float_here_indeed
+ {\setbox\floatbox\vpack to \d_page_grd_reserved_height \bgroup
\vss
- \hpack to \d_page_grid_reserved_width \bgroup
+ \hpack to \d_page_grd_reserved_width \bgroup
% \hss % no
\box\floatbox
\hss
@@ -457,7 +461,7 @@
box \floatbox
}}
-\def\page_grid_place_float_slot
+\def\page_grd_place_float_slot
{% safeguard
\ifx\floatmethod\empty
\let\floatmethod\v!here
@@ -466,7 +470,7 @@
\penalty\c_page_otr_eject_penalty
% push
\setbox\savedfloatbox\box\floatbox
- \page_grid_command_flush_saved_floats
+ \page_grd_command_flush_saved_floats
\setbox\floatbox\box\savedfloatbox
% pop
\ifconditional\c_page_floats_some_waiting
@@ -484,15 +488,15 @@
\fi
box \floatbox
}%
- \ifcase\c_page_grid_reserved_state
- \page_grid_place_float_here_indeed
+ \ifcase\c_page_grd_reserved_state
+ \page_grd_place_float_here_indeed
\else
\page_floats_save\s!text
\nonoindentation
\fi
\fi}
-\def\page_grid_place_float_fixed % todo: fallback on here
+\def\page_grd_place_float_fixed % todo: fallback on here
{\ifx\floatcolumn\empty
\let\floatmethod\v!here
\else\ifx\floatrow\empty
@@ -500,9 +504,9 @@
\else
\let\floatmethod\v!fixed
\fi\fi
- \page_grid_place_float_slot}
+ \page_grd_place_float_slot}
-\def\page_grid_place_float_force
+\def\page_grd_place_float_force
{% synchronize
\penalty\c_page_otr_eject_penalty
\clf_checkcolumnset {
@@ -510,30 +514,30 @@
method {\floatmethod}
box \floatbox
}%
- \ifcase\c_page_grid_reserved_state
- \page_grid_place_float_here_indeed
+ \ifcase\c_page_grd_reserved_state
+ \page_grd_place_float_here_indeed
\else
\page_floats_save\s!text
\nonoindentation
\fi}
-\def\page_grid_place_float_page {\page_grid_place_float_slot} % todo: fallback on here
+\def\page_grd_place_float_page {\page_grd_place_float_slot} % todo: fallback on here
-\def\page_grid_place_float_here {\let\floatmethod\v!here\page_grid_place_float_slot}
-\def\page_grid_place_float_top {\page_grid_place_float_slot}
-\def\page_grid_place_float_bottom{\page_grid_place_float_slot}
+\def\page_grd_place_float_here {\let\floatmethod\v!here\page_grd_place_float_slot}
+\def\page_grd_place_float_top {\page_grd_place_float_slot}
+\def\page_grd_place_float_bottom{\page_grd_place_float_slot}
-\installfloatmethod \s!pagegrid \v!here \page_grid_place_float_here
-\installfloatmethod \s!pagegrid \v!force \page_grid_place_float_force % todo
+\installfloatmethod \s!pagegrid \v!here \page_grd_place_float_here
+\installfloatmethod \s!pagegrid \v!force \page_grd_place_float_force % todo
%installfloatmethod \s!pagegrid \v!left
%installfloatmethod \s!pagegrid \v!right
%installfloatmethod \s!pagegrid \v!text
-\installfloatmethod \s!pagegrid \v!top \page_grid_place_float_top
-\installfloatmethod \s!pagegrid \v!bottom \page_grid_place_float_bottom
+\installfloatmethod \s!pagegrid \v!top \page_grd_place_float_top
+\installfloatmethod \s!pagegrid \v!bottom \page_grd_place_float_bottom
%installfloatmethod \s!pagegrid \v!auto
%installfloatmethod \s!pagegrid \v!margin
%installfloatmethod \s!pagegrid \v!opposite
-\installfloatmethod \s!pagegrid \v!page \page_grid_place_float_page
+\installfloatmethod \s!pagegrid \v!page \page_grd_place_float_page
%installfloatmethod \s!pagegrid \v!leftpage
%installfloatmethod \s!pagegrid \v!rightpage
%installfloatmethod \s!pagegrid \v!inmargin
@@ -546,54 +550,54 @@
%installfloatmethod \s!pagegrid \v!somewhere
%installfloatmethod \s!pagegrid \v!backspace
%installfloatmethod \s!pagegrid \v!cutspace
-\installfloatmethod \s!pagegrid \s!tblr \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!lrtb \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!tbrl \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!rltb \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!fxtb \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!btlr \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!lrbt \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!btrl \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!rlbt \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!fxbt \page_grid_place_float_slot
-\installfloatmethod \s!pagegrid \s!fixd \page_grid_place_float_fixed
+\installfloatmethod \s!pagegrid \s!tblr \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!lrtb \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!tbrl \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!rltb \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!fxtb \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!btlr \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!lrbt \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!btrl \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!rlbt \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!fxbt \page_grd_place_float_slot
+\installfloatmethod \s!pagegrid \s!fixd \page_grd_place_float_fixed
%
-\unexpanded\def\page_grid_command_side_float_output
+\unexpanded\def\page_grd_command_side_float_output
{} % nothing, reset anyway
-\unexpanded\def\page_grid_command_flush_side_floats
+\unexpanded\def\page_grd_command_flush_side_floats
{\page_sides_forget_floats}
-\unexpanded\def\page_grid_command_synchronize_side_floats
+\unexpanded\def\page_grd_command_synchronize_side_floats
{\page_sides_forget_floats}
-\unexpanded\def\page_grid_command_synchronize_hsize
- {\page_grid_command_set_hsize}
+\unexpanded\def\page_grd_command_synchronize_hsize
+ {\page_grd_command_set_hsize}
\defineoutputroutine
[\s!pagegrid]
- [\s!page_otr_command_routine =\page_grid_command_routine,
- \s!page_otr_command_package_contents =\page_grid_command_package_contents,
- \s!page_otr_command_set_vsize =\page_grid_command_set_vsize,
- \s!page_otr_command_set_hsize =\page_grid_command_set_hsize, % tricky, goes wrong
- \s!page_otr_command_next_page =\page_grid_command_next_page,
- \s!page_otr_command_next_page_and_inserts =\page_grid_command_next_page_and_inserts,
- \s!page_otr_command_synchronize_hsize =\page_grid_command_synchronize_hsize,
- % \s!page_otr_command_set_top_insertions =\page_grid_command_set_top_insertions,
- % \s!page_otr_command_set_bottom_insertions =\page_grid_command_set_bottom_insertions,
- % \s!page_otr_command_flush_top_insertions =\page_grid_command_flush_top_insertions,
- % \s!page_otr_command_flush_bottom_insertions =\page_grid_command_flush_bottom_insertions,
- % \s!page_otr_command_set_float_hsize =\page_grid_command_set_float_hsize,
- \s!page_otr_command_check_if_float_fits =\page_grid_command_check_if_float_fits,
- % \s!page_otr_command_flush_float_box =\page_grid_command_flush_float_box,
- \s!page_otr_command_synchronize_side_floats =\page_grid_command_synchronize_side_floats,
- \s!page_otr_command_side_float_output =\page_grid_command_side_float_output,
- \s!page_otr_command_flush_floats =\page_grid_command_flush_floats,
- \s!page_otr_command_flush_side_floats =\page_grid_command_flush_side_floats,
- \s!page_otr_command_flush_saved_floats =\page_grid_command_flush_saved_floats
- % \s!page_otr_command_flush_margin_blocks =\page_grid_command_flush_margin_blocks, % not used
+ [\s!page_otr_command_routine =\page_grd_command_routine,
+ \s!page_otr_command_package_contents =\page_grd_command_package_contents,
+ \s!page_otr_command_set_vsize =\page_grd_command_set_vsize,
+ \s!page_otr_command_set_hsize =\page_grd_command_set_hsize, % tricky, goes wrong
+ \s!page_otr_command_next_page =\page_grd_command_next_page,
+ \s!page_otr_command_next_page_and_inserts =\page_grd_command_next_page_and_inserts,
+ \s!page_otr_command_synchronize_hsize =\page_grd_command_synchronize_hsize,
+ % \s!page_otr_command_set_top_insertions =\page_grd_command_set_top_insertions,
+ % \s!page_otr_command_set_bottom_insertions =\page_grd_command_set_bottom_insertions,
+ % \s!page_otr_command_flush_top_insertions =\page_grd_command_flush_top_insertions,
+ % \s!page_otr_command_flush_bottom_insertions =\page_grd_command_flush_bottom_insertions,
+ % \s!page_otr_command_set_float_hsize =\page_grd_command_set_float_hsize,
+ \s!page_otr_command_check_if_float_fits =\page_grd_command_check_if_float_fits,
+ % \s!page_otr_command_flush_float_box =\page_grd_command_flush_float_box,
+ \s!page_otr_command_synchronize_side_floats =\page_grd_command_synchronize_side_floats,
+ \s!page_otr_command_side_float_output =\page_grd_command_side_float_output,
+ \s!page_otr_command_flush_floats =\page_grd_command_flush_floats,
+ \s!page_otr_command_flush_side_floats =\page_grd_command_flush_side_floats,
+ \s!page_otr_command_flush_saved_floats =\page_grd_command_flush_saved_floats
+ % \s!page_otr_command_flush_margin_blocks =\page_grd_command_flush_margin_blocks, % not used
]
% spans
@@ -613,18 +617,18 @@
\c!n=\plustwo,
\c!nlines=\zerocount,
\c!align=\v!normal,
- \c!width=\d_page_grid_span_width,
+ \c!width=\d_page_grd_span_width,
\c!indenting=,
\c!indentnext=\v!yes,
\c!default=\v!here,
\c!alternative=\v!a]
-\newdimen\d_page_grid_span_width
+\newdimen\d_page_grd_span_width
\unexpanded\def\startpagegridspan
- {\dotripleempty\page_grid_span_start}
+ {\dotripleempty\page_grd_span_start}
-\def\page_grid_span_start[#1][#2][#3]% [#3] gobbles space
+\def\page_grd_span_start[#1][#2][#3]% [#3] gobbles space
{\endgraf % else rubish output if forgotten
\synchronizepagegrid
\bgroup
@@ -652,9 +656,9 @@
\def\pagegridspanwidth#1% assumes equal distances
{\the\dimexpr
- #1\d_page_grid_column_width
- +#1\d_page_grid_distance
- - \d_page_grid_distance
+ #1\d_page_grd_column_width
+ +#1\d_page_grd_distance
+ - \d_page_grd_distance
\relax}
% areas
@@ -702,15 +706,15 @@
\to \everydefinepagegridarea
\unexpanded\def\setuppagegridareatext
- {\dodoubleargument\page_grid_set_area_text}
+ {\dodoubleargument\page_grd_set_area_text}
-\def\page_grid_set_area_text[#1][#2]%
+\def\page_grd_set_area_text[#1][#2]%
{\edef\currentpagegridarea{#1}%
\setpagegridareaparameter\c!text{#2}}
% maybe move the left/right correction to the tex end or the offset to lua
-\unexpanded\def\page_grid_set_area#1#2#3#4#5#6#7#8% can be optimized
+\unexpanded\def\page_grd_set_area#1#2#3#4#5#6#7#8% can be optimized
{\begingroup
\edef\currentpagegridarea{#2}%
\setpagegridareaparameter\c!width {#5\scaledpoint}%
@@ -753,7 +757,7 @@
\fi
\endgroup}
-\let\setpagegridarea\page_grid_set_area
+\let\setpagegridarea\page_grd_set_area
% state start | repeat
diff --git a/tex/context/base/mkiv/page-flt.lua b/tex/context/base/mkiv/page-flt.lua
index fdfd968d5..a082cc71e 100644
--- a/tex/context/base/mkiv/page-flt.lua
+++ b/tex/context/base/mkiv/page-flt.lua
@@ -12,10 +12,13 @@ if not modules then modules = { } end modules ['page-flt'] = {
local tostring = tostring
local insert, remove = table.insert, table.remove
local find = string.find
+local abs = math.abs
-local trace_floats = false trackers.register("floats.caching", function(v) trace_floats = v end) -- name might change
+local trace_floats = false trackers.register("floats.caching", function(v) trace_floats = v end)
+local trace_collecting = false trackers.register("floats.collecting", function(v) trace_collecting = v end)
-local report_floats = logs.reporter("floats","caching")
+local report_floats = logs.reporter("floats","caching")
+local report_collecting = logs.reporter("floats","collecting")
local C, S, P, lpegmatch = lpeg.C, lpeg.S, lpeg.P, lpeg.match
@@ -23,6 +26,7 @@ local C, S, P, lpegmatch = lpeg.C, lpeg.S, lpeg.P, lpeg.match
-- text page leftpage rightpage (todo: top, bottom, margin, order)
local setdimen = tex.setdimen
+local getdimen = tex.getdimen
local setcount = tex.setcount
local texsetbox = tex.setbox
local textakebox = nodes.takebox
@@ -79,14 +83,25 @@ function floats.pop()
end
end
-local function setdimensions(b)
- local w, h, d = 0, 0, 0
+local function setdimensions(t,b)
+ local bw, bh, bd = 0, 0, 0
+ local nw, nh, nd = 0, 0, 0
if b then
- w, h, d = b.width, b.height, b.depth
+ bw = b.width
+ bh = b.height
+ bd = b.depth
end
- setdimen("global","floatwidth", w)
- setdimen("global","floatheight", h+d)
- return w, h, d
+ if t then
+ nw = t.width or bw
+ nh = t.height or bh
+ nd = t.depth or bd
+ end
+ setdimen("global","floatwidth", bw)
+ setdimen("global","floatheight", bh+bd)
+ setdimen("global","naturalfloatwd", nw)
+ setdimen("global","naturalfloatht", nh)
+ setdimen("global","naturalfloatdp", nd)
+ return bw, bh, bd, nw, nh, dp
end
local function get(stack,n,bylabel)
@@ -116,9 +131,12 @@ function floats.save(which,data)
local stack = stacks[which]
noffloats = noffloats + 1
local t = {
- n = noffloats,
- data = data or { },
- box = b,
+ n = noffloats,
+ data = data or { },
+ width = getdimen("naturalfloatwd"),
+ height = getdimen("naturalfloatht"),
+ depth = getdimen("naturalfloatdp"),
+ box = b,
}
insert(stack,t)
-- inspect(stacks)
@@ -139,9 +157,11 @@ function floats.resave(which)
which = which or default
local stack = stacks[which]
local b = textakebox("floatbox")
+ if not b then
+ report_floats("resaved float is empty")
+ end
last.box = b
insert(stack,1,last)
--- inspect(stacks)
setcount("global","savednoffloats",#stacks[default])
if trace_floats then
report_floats("%s, category %a, number %a, slot %a width %p, height %p, depth %p","resaving",
@@ -156,15 +176,14 @@ end
function floats.flush(which,n,bylabel)
which = which or default
--- inspect(stacks)
local stack = stacks[which]
local t, b, n = get(stack,n or 1,bylabel)
if t then
if not b then
showmessage("floatblocks",1,t.n)
end
+ local w, h, d = setdimensions(t,b)
if trace_floats then
- local w, h, d = setdimensions(b) -- ?
report_floats("%s, category %a, number %a, slot %a width %p, height %p, depth %p","flushing",
which,t.n,n,w,h,d)
else
@@ -173,7 +192,7 @@ function floats.flush(which,n,bylabel)
texsetbox("floatbox",b)
last = remove(stack,n)
last.box = nil
- setcount("global","savednoffloats",#stacks[default]) -- default?
+ setcount("global","savednoffloats",#stacks[which]) -- default?
else
setdimensions()
end
@@ -184,7 +203,7 @@ function floats.consult(which,n)
local stack = stacks[which]
local t, b, n = get(stack,n)
if t then
- local w, h, d = setdimensions(b)
+ local w, h, d = setdimensions(t,b)
if trace_floats then
report_floats("%s, category %a, number %a, slot %a width %p, height %p, depth %p","consulting",
which,t.n,n,w,h,d)
@@ -199,16 +218,46 @@ function floats.consult(which,n)
end
function floats.collect(which,maxwidth,distance)
- which = which or default
- local stack = stacks[which]
- local n, m = #stack, 0
- for i=1,n do
+ local usedwhich = which or default
+ local stack = stacks[usedwhich]
+ local stacksize = #stack
+ local collected = 0
+ local maxheight = 0
+ local maxdepth = 0
+
+ local function register()
+ collected = collected + 1
+ maxwidth = rest
+ if h > maxheight then
+ maxheight = h
+ end
+ if d > maxdepth then
+ maxdepth = d
+ end
+ end
+
+ for i=1,stacksize do
local t, b, n = get(stack,i)
if t then
- local w, h, d = setdimensions(b)
- if w + distance < maxwidth then
- m = m + 1
- maxwidth = maxwidth - w - distance
+ local w, h, d, nw = setdimensions(t,b)
+ -- we use the real width
+ w = nw
+ -- which could be an option
+ local rest = maxwidth - w - (1 == 1 and 0 or distance)
+ local fits = rest > -10
+ if trace_collecting then
+ report_collecting("%s, category %a, number %a, slot %a width %p, rest %p, fit %a","collecting",
+ usedwhich,t.n,n,w,rest,fits)
+ end
+ if fits then
+ collected = collected + 1
+ maxwidth = rest
+ if h > maxheight then
+ maxheight = h
+ end
+ if d > maxdepth then
+ maxdepth = d
+ end
else
break
end
@@ -216,10 +265,8 @@ function floats.collect(which,maxwidth,distance)
break
end
end
- if m == 0 then
- m = 1
- end
- setcount("global","nofcollectedfloats",m)
+ setcount("global","nofcollectedfloats",collected)
+ setdimen("global","maxcollectedfloatstotal",maxheight+maxdepth)
end
function floats.getvariable(name,default)
diff --git a/tex/context/base/mkiv/page-flt.mkiv b/tex/context/base/mkiv/page-flt.mkiv
index 555077ace..811248717 100644
--- a/tex/context/base/mkiv/page-flt.mkiv
+++ b/tex/context/base/mkiv/page-flt.mkiv
@@ -54,11 +54,12 @@
%D For the moment we keep this but they will become private too.
-\newcount\totalnoffloats % these will be redone ... handled at the lua end anyway
-\newcount\savednoffloats % these will be redone ... handled at the lua end anyway
-\newcount\nofcollectedfloats % communication channel
+\newcount\totalnoffloats % these will be redone ... handled at the lua end anyway
+\newcount\savednoffloats % these will be redone ... handled at the lua end anyway
+\newcount\nofcollectedfloats % communication channel
+\newdimen\maxcollectedfloatstotal % communication channel
-\newcount\noffloatinserts % these will be redone ... handled at the lua end anyway
+\newcount\noffloatinserts % these will be redone ... handled at the lua end anyway
\newbox \floattext
diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv
index 0b67f6ef6..f8980b055 100644
--- a/tex/context/base/mkiv/page-one.mkiv
+++ b/tex/context/base/mkiv/page-one.mkiv
@@ -365,29 +365,33 @@
\def\page_one_command_flush_floats_indeed % much in common with OTRSET
{\ifconditional\c_page_floats_some_waiting
\ifconditional\c_page_floats_pack_flushed
- \setfalse\c_page_floats_center_box % not needed as we do call directly
\page_floats_collect\s!text\hsize\emwidth
- %% no longer (interferes with footnotes):
- %%
- %% \page_one_command_set_vsize % test 2011.06.24.001
- %%
- \global\setbox\floatbox\hbox to \hsize
- {\hfil
- \dorecurse\nofcollectedfloats
- {\ifcase\columndirection % nog document wide
- \page_floats_flush\s!text\plusone
- \else
- \page_floats_flush\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}%
- \fi
- \ifdim\wd\floatbox>\makeupwidth % \hsize
- \hpack to \makeupwidth{\hss\box\floatbox\hss}%
- \else
- \box\floatbox
- \fi
- \ifnum\recurselevel<\nofcollectedfloats
- \hfil
- \fi}%
- \hfil}%
+ \ifcase\nofcollectedfloats
+ \page_floats_get
+ \else
+ \setfalse\c_page_floats_center_box % not needed as we do call directly
+ %% no longer (interferes with footnotes):
+ %%
+ %% \page_one_command_set_vsize % test 2011.06.24.001
+ %%
+ \global\setbox\floatbox\hbox to \hsize
+ {\hfil
+ \dorecurse\nofcollectedfloats
+ {\ifcase\columndirection % nog document wide
+ \page_floats_flush\s!text\plusone
+ \else
+ \page_floats_flush\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}%
+ \fi
+ \ifdim\wd\floatbox>\makeupwidth % \hsize
+ \hpack to \makeupwidth{\hss\box\floatbox\hss}%
+ \else
+ \box\floatbox
+ \fi
+ \ifnum\recurselevel<\nofcollectedfloats
+ \hfil
+ \fi}%
+ \hfil}%
+ \fi
\else
\page_floats_get
\fi
diff --git a/tex/context/base/mkiv/page-pcl.mkiv b/tex/context/base/mkiv/page-pcl.mkiv
index c8818e32b..3b936dea5 100644
--- a/tex/context/base/mkiv/page-pcl.mkiv
+++ b/tex/context/base/mkiv/page-pcl.mkiv
@@ -19,45 +19,49 @@
%D side floats too. No balancing and other fancy features.
%D
%D Don't use this in production! Although the main approach will stay there might be
-%D changes in th ewya floats are dealt with. Not much testing has been done but as
+%D changes in the way floats are dealt with. Not much testing has been done but as
%D we stay close to the single column mode we expect most to just work. Only floats
%D are the (usual) pain. Backgrounds, line numbering, etc.\ not tested either.
\unprotect
+\definemeasure[onecolumn] [\columnwidth]
+\definemeasure[twocolumns] [\dimexpr\plustwo \columnwidth+ \columndistance\relax]
+\definemeasure[threecolumns][\dimexpr\plusthree\columnwidth+\plustwo \columndistance\relax]
+\definemeasure[fourcolumns] [\dimexpr\plusfour \columnwidth+\plusthree\columndistance\relax]
+
\def\s!pagecolumn{pagecolumn}
-\newcount\c_page_column_n_of_columns \c_page_column_n_of_columns\plusone
-\newcount\c_page_column_current \c_page_column_current \plusone
-\newdimen\d_page_column_distance
-\newdimen\d_page_column_max_height
-\newdimen\d_page_column_max_width
-%newdimen\d_page_column_balance_step
-\newdimen\d_page_column_column_width
+\newcount\c_page_col_n_of_columns \c_page_col_n_of_columns\plusone
+\newcount\c_page_col_current \c_page_col_current \plusone
+\newdimen\d_page_col_distance
+\newdimen\d_page_col_max_height
+\newdimen\d_page_col_max_width
+%newdimen\d_page_col_balance_step
+\newdimen\d_page_col_column_width
-\newdimen\d_page_column_top_height
-\newdimen\d_page_column_top_width
+\newdimen\d_page_col_top_height
+\newdimen\d_page_col_top_width
-\newdimen\d_page_column_available
-\newdimen\d_page_column_sofar
+\newdimen\d_page_col_available
+\newdimen\d_page_col_sofar
%D We need to step over empty columns.
-\unexpanded\def\page_column_command_next_page
- {\ifnum\c_page_column_n_of_columns=\plusone
+\unexpanded\def\page_col_command_next_page
+ {\ifnum\c_page_col_n_of_columns=\plusone
\page_otr_eject_page
\else
\page_otr_eject_page_column
\fi}
-\unexpanded\def\page_column_column
+\unexpanded\def\page_col_column
{\page_otr_eject_page}
\unexpanded\def\page_otr_eject_page_column
{\begingroup
\scratchcountertwo\realpageno
\page_otr_eject_page
-% \page_otr_flush_all_floats
\scratchcounterone\zerocount
\scratchcounterthree\zerocount
\doloop{%
@@ -66,15 +70,14 @@
\else
\advance\scratchcounterthree\plusone
\ifnum\scratchcountertwo=\realpageno
- \ifnum\c_page_column_current=\plusone
+ \ifnum\c_page_col_current=\plusone
\exitloop
\else
- \ifnum\scratchcounterone=\c_page_column_current
+ \ifnum\scratchcounterone=\c_page_col_current
\dontleavehmode\null
\fi
\page_otr_eject_page
-% \page_otr_flush_all_floats
- \scratchcounterone\c_page_column_current
+ \scratchcounterone\c_page_col_current
\fi
\else
\exitloop
@@ -85,8 +88,8 @@
%D \unknown
-\unexpanded\def\page_column_command_next_page_and_inserts
- {\ifnum\c_page_column_n_of_columns=\plusone
+\unexpanded\def\page_col_command_next_page_and_inserts
+ {\ifnum\c_page_col_n_of_columns=\plusone
\page_otr_eject_page_and_flush_inserts
\else
\page_otr_eject_page_and_flush_inserts
@@ -94,37 +97,37 @@
%D \unknown
-\unexpanded\def\page_column_command_set_hsize
- {\ifnum\c_page_column_n_of_columns=\plusone
+\unexpanded\def\page_col_command_set_hsize
+ {\ifnum\c_page_col_n_of_columns=\plusone
\page_one_command_set_hsize
\else
- \page_column_command_set_hsize_indeed
+ \page_col_command_set_hsize_indeed
\fi}
-\unexpanded\def\page_column_command_set_hsize_indeed
- {\global\hsize\d_page_column_column_width\relax
- \global\d_page_column_available\dimexpr
- \numexpr\c_page_column_n_of_columns-\c_page_column_current+\plusone\relax\d_page_column_column_width
- + \numexpr\c_page_column_n_of_columns-\c_page_column_current \relax\d_page_column_distance
+\unexpanded\def\page_col_command_set_hsize_indeed
+ {\global\hsize\d_page_col_column_width\relax
+ \global\d_page_col_available\dimexpr
+ \numexpr\c_page_col_n_of_columns-\c_page_col_current+\plusone\relax\d_page_col_column_width
+ + \numexpr\c_page_col_n_of_columns-\c_page_col_current \relax\d_page_col_distance
\relax
- \global\d_page_column_sofar
- \ifnum\c_page_column_n_of_columns=\plusone
+ \global\d_page_col_sofar
+ \ifnum\c_page_col_n_of_columns=\plusone
\zerocount
\else
- \numexpr\c_page_column_n_of_columns-\plusone\relax
- \dimexpr\d_page_column_column_width+\d_page_column_distance\relax
+ \numexpr\c_page_col_n_of_columns-\plusone\relax
+ \dimexpr\d_page_col_column_width+\d_page_col_distance\relax
\fi}
%D \unknown
-\unexpanded\def\page_column_command_set_vsize
- {\ifnum\c_page_column_n_of_columns=\plusone
+\unexpanded\def\page_col_command_set_vsize
+ {\ifnum\c_page_col_n_of_columns=\plusone
\page_one_command_set_vsize
\else
- \page_column_command_set_vsize_indeed
+ \page_col_command_set_vsize_indeed
\fi}
-\unexpanded\def\page_column_command_set_vsize_indeed % \page_one_command_set_vsize minus the pagegoal setting
+\unexpanded\def\page_col_command_set_vsize_indeed % \page_one_command_set_vsize minus the pagegoal setting
{\ifgridsnapping
\ifcase\layoutlines
\getrawnoflines\textheight
@@ -138,14 +141,14 @@
%D \unknown
-\unexpanded\def\page_column_command_package_contents % \box<n> \unvbox<n> % this one will be redone (checked)
- {\ifnum\c_page_column_n_of_columns=\plusone
+\unexpanded\def\page_col_command_package_contents % \box<n> \unvbox<n> % this one will be redone (checked)
+ {\ifnum\c_page_col_n_of_columns=\plusone
\expandafter\page_one_command_package_contents
\else
- \expandafter\page_column_command_package_contents_all
+ \expandafter\page_col_command_package_contents_all
\fi}
-\unexpanded\def\page_column_command_package_contents_one#1#2% \box<n> \unvbox<n> % this one will be redone (checked)
+\unexpanded\def\page_col_command_package_contents_one#1#2% \box<n> \unvbox<n> % this one will be redone (checked)
{\bgroup
\forgetall
% see one for comments as it is similar
@@ -154,7 +157,7 @@
\setbox\b_page_one_contents\vbox to \textheight
{\page_otr_command_flush_top_insertions
\page_one_registered_text_area_a#1#2%
- \hsize\d_page_column_column_width
+ \hsize\d_page_col_column_width
\ifgridsnapping
\vskip\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax
\prevdepth\openstrutdepth
@@ -189,26 +192,26 @@
\fi
\setbox\b_page_one_bottom_notes\hpack
{\checksinglecolumnfootnotes % ?
- \hsize\d_page_column_column_width
+ \hsize\d_page_col_column_width
\setupnotes[\c!width=\textwidth]%
\lower\scratchoffset\vbox{\placebottomnotes\par\kern\zeropoint}}%
\ht\b_page_one_contents \zeropoint
\wd\b_page_one_contents \zeropoint
\ht\b_page_one_bottom_notes\zeropoint
\wd\b_page_one_bottom_notes\zeropoint
- \wd\b_page_one_bottom_notes\d_page_column_column_width
+ \wd\b_page_one_bottom_notes\d_page_col_column_width
\page_one_registered_text_area_b
{\vpack to \textheight
{\hbox{\box\b_page_one_contents\box\b_page_one_bottom_notes}}}%
\else
\ht\b_page_one_contents\textheight
- \wd\b_page_one_contents\d_page_column_column_width
+ \wd\b_page_one_contents\d_page_col_column_width
\page_one_registered_text_area_b
{\box\b_page_one_contents}%
\fi
\egroup}
-\unexpanded\def\page_column_command_package_contents_all#1#2% \box<n> \unvbox<n> % this one will be redone (checked)
+\unexpanded\def\page_col_command_package_contents_all#1#2% \box<n> \unvbox<n> % this one will be redone (checked)
{\bgroup
\setbox\b_page_one_contents\vbox to \textheight
{\page_one_registered_text_area_a#1#2}%
@@ -220,86 +223,85 @@
%D \unknown
-\unexpanded\def\page_column_command_side_float_output
- {\ifnum\c_page_column_n_of_columns=\plusone
+\unexpanded\def\page_col_command_side_float_output
+ {\ifnum\c_page_col_n_of_columns=\plusone
\page_one_command_side_float_output
\else
- \page_column_command_side_float_output_indeed
+ \page_col_command_side_float_output_indeed
\fi}
-\unexpanded\def\page_column_command_side_float_output_indeed
+\unexpanded\def\page_col_command_side_float_output_indeed
{% % %
\ifvoid\namedinsertionnumber\s!topfloat\else
\scratchwidth\wd\namedinsertionnumber\s!topfloat
- \ifdim\scratchwidth>\d_page_column_top_width
- \global\d_page_column_top_width \scratchwidth
+ \ifdim\scratchwidth>\d_page_col_top_width
+ \global\d_page_col_top_width \scratchwidth
\fi
- \global\d_page_column_top_height\ht\namedinsertionnumber\s!topfloat
+ \global\d_page_col_top_height\ht\namedinsertionnumber\s!topfloat
\fi
% % %
\setbox\scratchbox\vbox\bgroup
- \page_column_command_package_contents_one\unvbox\normalpagebox
+ \page_col_command_package_contents_one\unvbox\normalpagebox
\egroup
- \putboxincache\s!pagecolumn{\number\c_page_column_current}\scratchbox
- \ifnum\c_page_column_current=\c_page_column_n_of_columns
- \page_column_routine_package
+ \putboxincache\s!pagecolumn{\number\c_page_col_current}\scratchbox
+ \ifnum\c_page_col_current=\c_page_col_n_of_columns
+ \page_col_routine_package
\page_otr_construct_and_shipout\box\normalpagebox\plusone
- \global\c_page_column_current\plusone
- \global\d_page_column_top_height\zeropoint
- \global\d_page_column_top_width\zeropoint
+ \global\c_page_col_current\plusone
+ \global\d_page_col_top_height\zeropoint
+ \global\d_page_col_top_width\zeropoint
+ % \page_col_command_flush_top_insertions
+ % \page_col_command_flush_floats
\else
- \ifdim\d_page_column_top_width>\zeropoint
- % % %
-% \writestatus{!!!!!}{
-% width : \the\d_page_column_top_width,
-% sofar : \the\d_page_column_sofar}
- \ifdim\dimexpr\d_page_column_top_width>\d_page_column_sofar\relax
+ \ifdim\d_page_col_top_width>\zeropoint
+ \ifdim\dimexpr\d_page_col_top_width>\d_page_col_sofar\relax
\begingroup
\floatingpenalty\zerocount
\insert\namedinsertionnumber\s!topfloat\bgroup
- \vbox to \d_page_column_top_height{\vss\the\c_page_column_current\vss}
-% \page_one_command_flush_top_insertions
-% \page_one_command_flush_floats
+ \vbox to \d_page_col_top_height{\vss}
+ % can be an option
+ \page_col_command_flush_top_insertions
+ \page_col_command_flush_floats
+ % so far till option
\egroup
\endgroup
\fi
\fi
- % % %
- \global\advance\c_page_column_current\plusone
+ \global\advance\c_page_col_current\plusone
\fi
%
- \page_column_command_set_vsize
- \page_column_command_set_hsize}
+ \page_col_command_set_vsize
+ \page_col_command_set_hsize}
% use \currentmixedcolumns instead of \recurselevel
-\def\page_column_routine_package_step
+\def\page_col_routine_package_step
{% needs packaging anyway
\getboxfromcache{\s!pagecolumn}{\number\recurselevel}\scratchbox
- \page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_column_n_of_columns\plusone % new
- \page_marks_synchronize_column\plusone\c_page_column_n_of_columns\recurselevel\scratchbox
+ \page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_col_n_of_columns\plusone % new
+ \page_marks_synchronize_column\plusone\c_page_col_n_of_columns\recurselevel\scratchbox
% backgrounds
\anch_mark_column_box\scratchbox
\mixedcolumnseparatorheight\ht\scratchbox
\mixedcolumnseparatordepth \dp\scratchbox
\inheritedpagecolumnsframedbox\recurselevel\scratchbox}
-\def\page_column_routine_package
+\def\page_col_routine_package
{\global\setbox\normalpagebox\hbox to \makeupwidth\bgroup
\edef\p_separator{\pagecolumnsparameter\c!separator}%
- \pagecolumnseparatorwidth\d_page_column_distance
+ \pagecolumnseparatorwidth\d_page_col_distance
\edef\p_direction{\pagecolumnsparameter\c!direction}%
\ifx\p_direction\v!reverse
- \dostepwiserecurse\c_page_column_n_of_columns\plusone\minusone
- {\page_column_routine_package_step
+ \dostepwiserecurse\c_page_col_n_of_columns\plusone\minusone
+ {\page_col_routine_package_step
\ifnum\recurselevel>\plusone
- \page_column_routine_package_separate
+ \page_col_routine_package_separate
\fi}%
\else
- \dorecurse\c_page_column_n_of_columns
- {\page_column_routine_package_step
- \ifnum\recurselevel<\c_page_column_n_of_columns
- \page_column_routine_package_separate
+ \dorecurse\c_page_col_n_of_columns
+ {\page_col_routine_package_step
+ \ifnum\recurselevel<\c_page_col_n_of_columns
+ \page_col_routine_package_separate
\fi}%
\fi
\egroup
@@ -307,48 +309,279 @@
%D \unknown
-\unexpanded\def\page_column_command_check_if_float_fits
- {\ifnum\c_page_column_n_of_columns=\plusone
+\unexpanded\def\page_col_command_check_if_float_fits
+ {\ifnum\c_page_col_n_of_columns=\plusone
\page_one_command_check_if_float_fits
\else
- \page_column_command_check_if_float_fits_indeed
+ \page_col_command_check_if_float_fits_indeed
\fi}
-\unexpanded\def\page_column_command_check_if_float_fits_indeed
+\unexpanded\def\page_col_command_check_if_float_fits_indeed
{\ifconditional\c_page_floats_not_permitted
- %\writestatus{CHECK}{\the\wd\floatbox,\the\d_page_column_available,NOT PERMITTED}
- \global\setfalse\c_page_floats_room
- \else\ifdim\naturalfloatwidth>\d_page_column_column_width
- %\writestatus{CHECK}{\the\wd\floatbox,\the\d_page_column_available,TOO WIDE}
\global\setfalse\c_page_floats_room
+ \else\ifabsdim\dimexpr\d_page_col_available-\naturalfloatwd\relax<\onepoint
+ \global\settrue\c_page_floats_room
\else
- %\writestatus{CHECK}{\the\wd\floatbox,\the\d_page_column_available,SEEMS TO FIT}
- % same as one
+ \global\setfalse\c_page_floats_room
+ \fi\fi
+ \ifconditional\c_page_floats_room
\begingroup
\scratchdimen\dimexpr\pagetotal+\lineheight\relax
\ifdim\scratchdimen>\pagegoal
\goodbreak
+ \ifdim\dimexpr\d_page_col_available-\naturalfloatwd\relax>\onepoint
+ \global\setfalse\c_page_floats_room
+ \else
+ \global\settrue\c_page_floats_room
+ \fi
\fi
\endgroup
- \scratchdimenone\dimexpr\pagetotal+\floatheight+\d_strc_floats_top-\pageshrink\relax
- \scratchdimentwo\pagegoal
- \relax % needed
- \ifcase\c_page_one_float_method
- % method 0 : raw
- \or
- % method 1 : safe
- \advance\scratchdimentwo -\strutdp
- \or
- % method 2 : tight
- \advance\scratchdimenone -\onepoint
+ \fi
+ \ifconditional\c_page_floats_room
+ \ifdim\pagetotal>\zeropoint
+ \scratchdimenone\dimexpr\pagetotal+\floatheight+\d_strc_floats_top-\pageshrink\relax
+ \scratchdimentwo\pagegoal
+ \relax % needed
+ \ifcase\c_page_one_float_method
+ % method 0 : raw
+ \or
+ % method 1 : safe
+ \advance\scratchdimentwo -\strutdp
+ \or
+ % method 2 : tight
+ \advance\scratchdimenone -\onepoint
+ \fi
+ \relax % really needed ! ! ! !
+ \ifdim\scratchdimenone>\scratchdimentwo
+ \global\setfalse\c_page_floats_room
+ \fi
+ \fi
+ \ifconditional\c_page_floats_room
+ \global\setbox\floatbox\hpack to \d_page_col_available{\hss\box\floatbox\hss}%
+ \fi
+ \fi}
+
+%D \unknown
+
+\unexpanded\def\page_col_command_flush_floats
+ {\ifnum\c_page_col_n_of_columns=\plusone
+ \page_one_command_flush_floats
+ \else
+ \page_col_command_flush_floats_indeed
+ \fi}
+
+\def\page_col_set_float_pack_hsize
+ {\ifnum\c_page_col_current=\c_page_col_n_of_columns
+ \c_page_col_current\plusone
+ \else
+ \advance\c_page_col_current\plusone
+ \fi
+ \page_col_command_set_hsize_indeed
+ \hsize\d_page_col_available}
+
+\unexpanded\def\page_col_command_flush_floats_indeed
+ {\global\settrue\c_page_floats_flushing
+ \ifconditional\c_page_floats_some_waiting
+ \par
+ \page_col_set_float_pack_hsize
+ \page_col_command_flush_floats_indeed_indeed
+ \fi
+ \global\savednoffloats\zerocount
+ \global\setfalse\c_page_floats_some_waiting
+ \global\setfalse\c_page_floats_flushing}
+
+\def\page_floats_show_pack_state_indeed#1%
+ {\llap{\smash{\backgroundline[black]{\strut\smallinfofont\white#1\space\the\nofcollectedfloats\space of\space\the\savednoffloats:\the\hsize}}\hskip.25\emwidth}}
+
+\installtextracker
+ {floats.collecting}
+ {\let\page_floats_show_pack_state\page_floats_show_pack_state_indeed}
+ {\let\page_floats_show_pack_state\gobbleoneargument}
+
+\let\page_floats_show_pack_state\gobbleoneargument
+
+\def\page_col_command_flush_floats_indeed_indeed % much in common with OTRSET
+ {\ifconditional\c_page_floats_some_waiting
+ \ifconditional\c_page_floats_pack_flushed
+ \setfalse\c_page_floats_center_box % not needed as we do call directly
+ %
+ \page_floats_collect\s!text\hsize\emwidth
+ %
+ \ifnum\nofcollectedfloats=\plusone
+ \ifdim\naturalfloatwd>\hsize
+ \nofcollectedfloats\zerocount
+ \fi
+ \fi
+ \ifnum\nofcollectedfloats>\zerocount
+ \global\setbox\floatbox\hpack to \hsize
+ {\page_floats_show_pack_state F%
+ \hfil
+ \dorecurse\nofcollectedfloats
+ {\ifcase\columndirection % nog document wide
+ \page_floats_flush\s!text\plusone
+ \else
+ \page_floats_flush\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}%
+ \fi
+ % this could happen at the lua end instead
+ \scratchdimen\dimexpr\wd\floatbox-\naturalfloatwd\relax
+ \ifdim\scratchdimen<\zeropoint
+ \global\setbox\floatbox\hpack spread -\scratchdimen{\hss\box\floatbox\hss}%
+ \fi
+ %
+ \ifdim\wd\floatbox>\textwidth % \hsize
+ \hpack to \textwidth{\hss\box\floatbox\hss}% \textwidth
+ \else
+ \box\floatbox
+ \fi
+ \ifnum\recurselevel<\nofcollectedfloats
+ \hfil
+ \fi}%
+ \hfil}%
+ \doplacefloatbox
+ % \page_one_insert_top_float
+ \doubleexpandafter\page_col_command_flush_floats_indeed_indeed
+ \else
+ % todo
+ \fi
+ \else
+ \page_floats_get
+ % \page_one_insert_top_float
+ \doplacefloatbox
+ \doubleexpandafter\page_col_command_flush_floats_indeed_indeed
+ \fi
+ \fi}
+
+\unexpanded\def\page_col_command_flush_saved_floats % like one
+ {\global\d_page_floats_inserted_top\zeropoint
+ \global\d_page_floats_inserted_bottom\zeropoint
+ \ifconditional\c_page_floats_flushing \else
+ \page_col_command_set_top_insertions
+ \page_col_command_set_bottom_insertions
+ \ifconditional\c_page_floats_some_waiting
+ \doif{\rootfloatparameter\c!cache}\v!no\page_col_command_flush_floats % could be _otr_
+ \else\ifconditional\c_page_margin_blocks_present
+ \page_col_command_flush_floats
+ \fi\fi
+ \fi}
+
+\unexpanded\def\page_col_command_flush_top_insertions
+ {\ifnum\c_page_col_n_of_columns=\plusone
+ \page_one_command_flush_top_insertions
+ \else
+ \page_col_command_flush_top_insertions_indeed
+ \fi}
+
+\unexpanded\def\page_col_command_flush_bottom_insertions
+ {\ifnum\c_page_col_n_of_columns=\plusone
+ \page_one_command_flush_bottom_insertions
+ \else
+ \page_col_command_flush_bottom_insertions_indeed
+ \fi}
+
+\unexpanded\def\page_col_command_set_top_insertions
+ {\bgroup
+ \ifconditional\c_page_floats_some_waiting
+ \noffloatinserts\zerocount
+ \let\totaltopinserted\!!zeropoint
+ \page_col_set_float_pack_hsize
+ \page_col_command_set_top_insertions_indeed
+ \ifnum\rootfloatparameter\c!nbottom=\zerocount
+ \ifnum\rootfloatparameter\c!nlines>\zerocount
+ \ifdim\totaltopinserted>\zeropoint\relax
+ \ifdim\dimexpr\rootfloatparameter\c!nlines\lineheight+\totaltopinserted\relax>\textheight
+ \showmessage\m!floatblocks8{\rootfloatparameter\c!nlines}%
+ \page_otr_fill_and_eject_page % was tripple: vfilll
+ \fi
+ \fi
+ \fi
\fi
- \relax % really needed ! ! ! !
- \ifdim\scratchdimenone>\scratchdimentwo
- \global\setfalse\c_page_floats_room
+ \fi
+ \egroup}
+
+\def\d_page_col_collected_top_float_height % pseudo
+ {\dimexpr
+ \d_page_floats_inserted_top +
+ \maxcollectedfloatstotal +
+ \ifdim\d_strc_floats_top>\d_strc_floats_bottom
+ \d_strc_floats_top
\else
- \global\settrue\c_page_floats_room
+ \d_strc_floats_bottom
\fi
- \fi\fi}
+ \relax}
+
+\def\page_col_command_set_top_insertions_indeed
+ {\ifnum\noffloatinserts<\c_page_floats_n_of_top
+ \ifcase\savednoffloats
+ \let\page_col_command_set_top_insertions_indeed\relax
+ \else
+ \page_floats_collect\s!text\hsize\emwidth
+ \ifdim\d_page_col_collected_top_float_height<\textheight
+ \global\setbox\floatbox\hpack to \hsize
+ {\page_floats_show_pack_state T%
+ \hfil
+ \dorecurse\nofcollectedfloats
+ {\ifcase\columndirection % nog document wide
+ \page_floats_flush\s!text\plusone
+ \else
+ \page_floats_flush\s!text{\the\numexpr\nofcollectedfloats-\recurselevel+1\relax}%
+ \fi
+ % this could happen at the lua end instead
+ \scratchdimen\dimexpr\wd\floatbox-\naturalfloatwd\relax
+ \ifdim\scratchdimen<\zeropoint
+ \global\setbox\floatbox\hpack spread -\scratchdimen{\hss\box\floatbox\hss}%
+ \fi
+ %
+ \ifdim\wd\floatbox>\makeupwidth % \hsize
+ \hpack to \makeupwidth{\hss\box\floatbox\hss}%
+ \else
+ \box\floatbox
+ \fi
+ \ifnum\recurselevel<\nofcollectedfloats
+ \hfil
+ \fi}%
+ \hfil}%
+ \page_one_prepare_top_float
+ \xdef\totaltopinserted{\the\d_page_floats_inserted_top}%
+ \page_one_insert_top_float
+ \ifconditional\c_page_floats_some_waiting
+ \advance\noffloatinserts \plusone
+ \else
+ \noffloatinserts\c_page_floats_n_of_top\relax
+ \fi
+ \page_floats_report_flushed
+ \else
+ \let\page_col_command_set_top_insertions_indeed\relax
+ \fi
+ \fi
+ \else
+ \ifconditional\c_page_floats_some_waiting
+ \showmessage\m!floatblocks6{\the\c_page_floats_n_of_top}%
+ \fi
+ \let\page_col_command_set_top_insertions_indeed\relax
+ \fi
+ \page_col_command_set_top_insertions_indeed}
+
+\unexpanded\def\page_col_command_set_bottom_insertions
+ {\ifnum\c_page_col_n_of_columns=\plusone
+ \page_one_command_set_bottom_insertions
+ \else
+ \page_col_command_set_bottom_insertions_indeed
+ \fi}
+
+\let\page_col_command_flush_top_insertions_indeed \page_one_command_flush_top_insertions
+\let\page_col_command_flush_bottom_insertions_indeed\page_one_command_flush_bottom_insertions
+
+%let\page_col_command_set_top_insertions \page_one_command_set_top_insertions
+\let\page_col_command_set_bottom_insertions \page_one_command_set_bottom_insertions
+
+%let\page_col_command_set_top_insertions_indeed \page_one_command_set_top_insertions
+\let\page_col_command_set_bottom_insertions_indeed \page_one_command_set_botttom_insertions
+
+\let\page_col_command_flush_float_box \page_one_command_flush_float_box
+\let\page_col_command_synchronize_side_floats \page_one_command_synchronize_side_floats
+\let\page_col_command_flush_side_floats \page_one_command_flush_side_floats
+\let\page_col_command_flush_margin_blocks \page_one_command_flush_margin_blocks
+\let\page_col_command_test_page \page_one_command_test_page
%D The separator code is more or less the same as mixed columns but we need
%D to compensate for the top floats so we comment a bit for now.
@@ -369,14 +602,14 @@
% \s!depth \pagecolumnseparatordepth
% \relax}
%
-% \def\page_column_routine_package_separate
+% \def\page_col_routine_package_separate
% {\ifcsname\??pagecolumnsseparator\p_separator\endcsname
-% \page_column_command_inject_separator
+% \page_col_command_inject_separator
% \else
% \hss
% \fi}
%
-% \unexpanded\def\page_column_command_inject_separator
+% \unexpanded\def\page_col_command_inject_separator
% {\begingroup
% \setbox\scratchbox\hbox to \zeropoint \bgroup
% \hss
@@ -393,13 +626,13 @@
% \hss
% \endgroup}
-\def\page_column_routine_package_separate
+\def\page_col_routine_package_separate
{\hss}
%D \unknown
-\unexpanded\def\page_column_command_routine % yet the same
- {\ifnum\c_page_column_n_of_columns=\plusone
+\unexpanded\def\page_col_command_routine % yet the same
+ {\ifnum\c_page_col_n_of_columns=\plusone
\page_sides_output_routine
\else
\page_sides_output_routine_column
@@ -416,7 +649,7 @@
\def\page_sides_output_routine_yes_column % this might become the main one too
{\unvbox\normalpagebox % bah, and the discards?
- %\page_column_column
+ %\page_col_column
\column % \page
%
% % do we really need the next code
@@ -448,27 +681,27 @@
\defineoutputroutine
[\s!pagecolumn]
- [\s!page_otr_command_routine =\page_column_command_routine,
- \s!page_otr_command_package_contents =\page_column_command_package_contents,
- \s!page_otr_command_set_vsize =\page_column_command_set_vsize,
- \s!page_otr_command_set_hsize =\page_column_command_set_hsize,
- \s!page_otr_command_next_page =\page_column_command_next_page,
- \s!page_otr_command_next_page_and_inserts =\page_column_command_next_page_and_inserts,
- % \s!page_otr_command_synchronize_hsize =\page_one_command_synchronize_hsize, % one
- \s!page_otr_command_set_top_insertions =\page_one_command_set_top_insertions, % one
- \s!page_otr_command_set_bottom_insertions =\page_one_command_set_bottom_insertions, % one
- \s!page_otr_command_flush_top_insertions =\page_one_command_flush_top_insertions, % one
- \s!page_otr_command_flush_bottom_insertions=\page_one_command_flush_bottom_insertions, % one
- % \s!page_otr_command_set_float_hsize =\page_one_command_set_float_hsize, % one
- \s!page_otr_command_check_if_float_fits =\page_column_command_check_if_float_fits,
- \s!page_otr_command_flush_float_box =\page_one_command_flush_float_box, % one
- \s!page_otr_command_synchronize_side_floats=\page_one_command_synchronize_side_floats, % one
- \s!page_otr_command_side_float_output =\page_column_command_side_float_output,
- \s!page_otr_command_flush_floats =\page_one_command_flush_floats, % one
- \s!page_otr_command_flush_side_floats =\page_one_command_flush_side_floats, % one
- \s!page_otr_command_flush_saved_floats =\page_one_command_flush_saved_floats, % one
- \s!page_otr_command_flush_margin_blocks =\page_one_command_flush_margin_blocks, % one
- \s!page_otr_command_test_column =\page_one_command_test_page % one
+ [\s!page_otr_command_routine =\page_col_command_routine,
+ \s!page_otr_command_package_contents =\page_col_command_package_contents,
+ \s!page_otr_command_set_vsize =\page_col_command_set_vsize,
+ \s!page_otr_command_set_hsize =\page_col_command_set_hsize,
+ \s!page_otr_command_next_page =\page_col_command_next_page,
+ \s!page_otr_command_next_page_and_inserts =\page_col_command_next_page_and_inserts,
+ % \s!page_otr_command_synchronize_hsize =\page_col_command_synchronize_hsize, % not done
+ \s!page_otr_command_set_top_insertions =\page_col_command_set_top_insertions,
+ \s!page_otr_command_set_bottom_insertions =\page_col_command_set_bottom_insertions,
+ \s!page_otr_command_flush_top_insertions =\page_col_command_flush_top_insertions,
+ \s!page_otr_command_flush_bottom_insertions=\page_col_command_flush_bottom_insertions,
+ % \s!page_otr_command_set_float_hsize =\page_col_command_set_float_hsize, % not done
+ \s!page_otr_command_check_if_float_fits =\page_col_command_check_if_float_fits,
+ \s!page_otr_command_flush_float_box =\page_col_command_flush_float_box,
+ \s!page_otr_command_synchronize_side_floats=\page_col_command_synchronize_side_floats,
+ \s!page_otr_command_side_float_output =\page_col_command_side_float_output,
+ \s!page_otr_command_flush_floats =\page_col_command_flush_floats,
+ \s!page_otr_command_flush_side_floats =\page_col_command_flush_side_floats,
+ \s!page_otr_command_flush_saved_floats =\page_col_command_flush_saved_floats,
+ \s!page_otr_command_flush_margin_blocks =\page_col_command_flush_margin_blocks,
+ \s!page_otr_command_test_column =\page_col_command_test_page
]
%D \unknown
@@ -539,7 +772,7 @@
\c!direction=\v!normal]
\let\startpagecolumns\relax % defined later
-\let\stop % automatic as suggested by WScolumns \relax % defined later
+\let\stoppagecolumns \relax % defined later
\appendtoks % could become an option
\setuevalue{\e!start\currentpagecolumns}{\startpagecolumns[\currentpagecolumns]}%
@@ -552,33 +785,34 @@
\unexpanded\def\startpagecolumns
{\page
\begingroup
- \dosingleempty\page_column_start}
+ \begingroup
+ \dosingleempty\page_col_start}
-\unexpanded\def\page_column_start[#1]%
+\unexpanded\def\page_col_start[#1]%
{\doifelseassignment{#1}%
{\let\currentpagecolumns\empty
\setuppagecolumns[#1]}%
{\edef\currentpagecolumns{#1}}%
%
- % \page_column_enable_grid_snapping
+ % \page_col_enable_grid_snapping
%
- \d_page_column_distance \pagecolumnsparameter\c!distance\relax
- \c_page_column_n_of_columns \pagecolumnsparameter\c!n\relax
- % \d_page_column_max_height \pagecolumnsparameter\c!maxheight
- \d_page_column_max_width \pagecolumnsparameter\c!maxwidth
- % \d_page_column_balance_step \pagecolumnsparameter\c!step
- \c_page_column_current \plusone
+ \d_page_col_distance \pagecolumnsparameter\c!distance\relax
+ \c_page_col_n_of_columns \pagecolumnsparameter\c!n\relax
+ % \d_page_col_max_height \pagecolumnsparameter\c!maxheight
+ \d_page_col_max_width \pagecolumnsparameter\c!maxwidth
+ % \d_page_col_balance_step \pagecolumnsparameter\c!step
+ \c_page_col_current \plusone
%
- \d_page_column_column_width\dimexpr(\d_page_column_max_width-\d_page_column_distance*\numexpr(\c_page_column_n_of_columns-\plusone)\relax)/\c_page_column_n_of_columns\relax
+ \d_page_col_column_width\dimexpr(\d_page_col_max_width-\d_page_col_distance*\numexpr(\c_page_col_n_of_columns-\plusone)\relax)/\c_page_col_n_of_columns\relax
%
- \columnwidth \d_page_column_column_width
- \columndistance \d_page_column_distance
+ \columnwidth \d_page_col_column_width
+ \columndistance \d_page_col_distance
%
\nopenalties
%
% \insidecolumnstrue % NO!
%
- \let\column\page_column_column
+ \let\column\page_col_column
%
\def\page_floats_get_used_hsize{\makeupwidth} % a bit of a hack
%
@@ -594,13 +828,21 @@
%
\setupoutputroutine[\s!pagecolumn]%
%
- \page_column_command_set_vsize
- \page_column_command_set_hsize
+ \setupfloats[\c!ntop=\plusthousand]%
+ %
+ \page_col_command_set_vsize
+ \page_col_command_set_hsize
%
\nofcolumns\c_page_mix_n_of_columns} % public
\unexpanded\def\stoppagecolumns
- {\page
+ {\column % \page_otr_eject_page
+ \page
+ \endgroup
+ \setupoutputroutine[\s!singlecolumn]%
+ \page_col_command_set_vsize
+ \page_col_command_set_hsize
+ \page
\endgroup}
\protect \endinput
diff --git a/tex/context/base/mkiv/publ-aut.lua b/tex/context/base/mkiv/publ-aut.lua
index e0f96b9c5..becb7b125 100644
--- a/tex/context/base/mkiv/publ-aut.lua
+++ b/tex/context/base/mkiv/publ-aut.lua
@@ -314,11 +314,11 @@ local function the_initials(initials,symbol,connector)
end
s = s + 1 ; set[s] = initial[i]
end
- r = r + 1 ; result[r] = concat(set)
+ r = r + 1 ; result[r] = concat(set) .. symbol
else
- r = r + 1 ; result[r] = initial
+ r = r + 1 ; result[r] = initial .. symbol
end
- r = r + 1 ; result[r] = symbol
+ -- r = r + 1 ; result[r] = symbol
end
return result
end
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 779281eb5..53fefa668 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index a17ca6544..e2fd24d5b 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi
index 408a48611..0a1f59335 100644
--- a/tex/context/base/mkiv/strc-flt.mkvi
+++ b/tex/context/base/mkiv/strc-flt.mkvi
@@ -810,14 +810,18 @@
{\setfalse\c_page_floats_center_box_global
\setfalse\c_page_floats_center_box_local}}
-\let\naturalfloatheight\!!zeropoint
-\let\naturalfloatwidth \!!zeropoint
-\let\naturalfloatdepth \!!zeropoint
+\def\naturalfloatheight{\the\naturalfloatwd}
+\def\naturalfloatwidth {\the\naturalfloatht}
+\def\naturalfloatdepth {\the\naturalfloatdp}
+
+\newdimen\naturalfloatwd
+\newdimen\naturalfloatht
+\newdimen\naturalfloatdp
\def\strc_floats_set_natural_dimensions#box%
- {\xdef\naturalfloatheight{\the\ht#box}%
- \xdef\naturalfloatwidth {\the\wd#box}%
- \xdef\naturalfloatdepth {\the\dp#box}}
+ {\global\naturalfloatwd\wd#box\relax
+ \global\naturalfloatht\ht#box\relax
+ \global\naturalfloatdp\dp#box\relax}
\def\doifelsemainfloatbody
{\ifinsidesplitfloat
diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua
index 26229c79c..1c21252f7 100644
--- a/tex/context/base/mkiv/task-ini.lua
+++ b/tex/context/base/mkiv/task-ini.lua
@@ -25,6 +25,8 @@ local enableaction = tasks.enableaction
local freezegroup = tasks.freezegroup
local freezecallbacks = callbacks.freeze
+appendaction("processors", "normalizers", "languages.replacements.handler") -- disabled
+
appendaction("processors", "normalizers", "typesetters.wrappers.handler") -- disabled
appendaction("processors", "normalizers", "typesetters.characters.handler") -- always on
appendaction("processors", "normalizers", "fonts.collections.process") -- disabled
@@ -38,7 +40,7 @@ appendaction("processors", "characters", "typesetters.cases.handler")
appendaction("processors", "characters", "typesetters.breakpoints.handler") -- disabled
appendaction("processors", "characters", "scripts.injectors.handler") -- disabled
-appendaction("processors", "words", "languages.replacements.handler") -- disabled
+------------("processors", "words", "languages.replacements.handler") -- disabled
appendaction("processors", "words", "languages.words.check") -- disabled -- might move up, no disc check needed then
appendaction("processors", "words", "languages.hyphenators.handler") -- always on
appendaction("processors", "words", "typesetters.initials.handler") -- disabled -- might move up
diff --git a/tex/context/base/mkiv/typo-ovl.lua b/tex/context/base/mkiv/typo-ovl.lua
new file mode 100644
index 000000000..09cf5e129
--- /dev/null
+++ b/tex/context/base/mkiv/typo-ovl.lua
@@ -0,0 +1,183 @@
+if not modules then modules = { } end modules ['typo-ovl'] = {
+ version = 1.001,
+ comment = "companion to typo-ovl.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This is dubious code. If you needed it your source is probably bad. We only used
+-- in when we had to mark bad content but when cleaning up some project code I decided
+-- that it is easier to maintain in the distribution then in a project style. After all,
+-- we have hardly any private code. For convenience I hooked it into the existing
+-- replacement module (as it used the same code anyway). I did some cleanup.
+
+local next = next
+
+local context = context
+
+local nuts = nodes.nuts
+local tonut = nodes.tonut
+local tonode = nodes.tonode
+
+local nodecodes = nodes.nodecodes
+local glyph_code = nodecodes.glyph
+local disc_code = nodecodes.disc
+
+local getnext = nuts.getnext
+local getid = nuts.getid
+local getdisc = nuts.getdisc
+local getattr = nuts.getattr
+local setattr = nuts.setattr
+local getattrlist = nuts.getattrlist
+local setattrlist = nuts.setattrlist
+local getfield = nuts.getfield
+local setfont = nuts.setfont
+
+local unsetvalue = attributes.unsetvalue
+local prvattribute = attributes.private
+
+local texgetbox = tex.getbox
+local currentfont = font.current
+
+local a_overloads = attributes.private("overloads")
+local n_overloads = 0
+local t_overloads = { }
+
+local overloaded = { }
+
+local function markasoverload(a)
+ local n = prvattribute(a)
+ if n then
+ overloaded[n] = a
+ end
+end
+
+attributes.markasoverload = markasoverload
+
+markasoverload("color")
+markasoverload("colormodel")
+markasoverload("transparency")
+markasoverload("case")
+markasoverload("negative")
+markasoverload("effect")
+markasoverload("ruled")
+markasoverload("shifted")
+markasoverload("kernchars")
+markasoverload("kern")
+markasoverload("noligature")
+markasoverload("viewerlayer")
+
+local function tooverloads(n)
+ local current = tonut(n)
+ local a = getattrlist(current)
+ local s = { }
+ while a do
+ local n = getfield(a,"number")
+ local o = overloaded[n]
+ if o then
+ local v = getfield(a,"value")
+ if v ~= unsetvalue then
+ s[n] = v
+ -- print(o,n,v)
+ end
+ end
+ a = getnext(a)
+ end
+ return s
+end
+
+attributes.tooverloads = tooverloads
+
+function attributes.applyoverloads(specification,start,stop)
+ local current = tonut(start)
+ local processor = specification.processor
+ local overloads = specification.processor or getattr(current,a_overloads)
+ if overloads and overloads ~= unsetvalue then
+ overloads = t_overloads[overloads]
+ if not overloads then
+ return
+ end
+ else
+ return
+ end
+
+ local last = stop and tonut(stop)
+ local oldlist = nil
+ local newlist = nil
+ local newfont = overloads.font
+
+ local function apply()
+ local a = getattrlist(current)
+ if a == oldlist then
+ setattrlist(current,newlist)
+ else
+ oldlist = getattrlist(current)
+ for k, v in next, overloads do
+ setattr(current,k,v)
+ end
+ newlist = current -- getattrlist(current)
+ end
+ if newfont then
+ setfont(current,newfont)
+ end
+ end
+
+ while current do
+ local id = getid(current)
+ if id == glyph_code then
+ apply()
+ elseif id == disc_code then
+ apply()
+ if pre then
+ while pre do
+ if getid(pre) == glyph_code then
+ apply()
+ end
+ pre = getnext(pre)
+ end
+ end
+ if post then
+ while post do
+ if getid(post) == glyph_code then
+ apply()
+ end
+ post = getnext(post)
+ end
+ end
+ if replace then
+ while replace do
+ if getid(replace) == glyph_code then
+ apply()
+ end
+ replace = getnext(replace)
+ end
+ end
+ end
+ if current == last then
+ break
+ end
+ current = getnext(current)
+ end
+end
+
+-- we assume the same highlight so we're global
+
+interfaces.implement {
+ name = "overloadsattribute",
+ arguments = { "string", "integer", "integer" },
+ actions = function(name,font,box)
+ local samplebox = texgetbox(box)
+ local sample = samplebox and samplebox.list
+ local overloads = sample and tooverloads(sample)
+ if overloads then
+ overloads.font = font > 0 and font or false
+ n_overloads = n_overloads + 1
+ t_overloads[n_overloads] = overloads
+ t_overloads[name] = overloads
+ context(n_overloads)
+ else
+ context(unsetvalue)
+ end
+ end
+}
diff --git a/tex/context/base/mkiv/typo-ovl.mkiv b/tex/context/base/mkiv/typo-ovl.mkiv
new file mode 100644
index 000000000..025ae8a8f
--- /dev/null
+++ b/tex/context/base/mkiv/typo-ovl.mkiv
@@ -0,0 +1,115 @@
+%D \module
+%D [ file=lang-ovl,
+%D version=2016.02.03, % about that time (maybe earlier)
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Overloads,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Typesetting Macros / Overloads}
+
+\unprotect
+
+%D See \LUA\ file for comments. I'll probably never use this code outside the
+%D project where it had some experimental use. (Occasionally we do some spell
+%D checking and suspicious word usage marking.) So there is not much documentation
+%D here. Keep in mind that overloading only makes sense for content that gets
+%D replaced as otherwise normal attributes make more sense. Using this otherwise
+%D is weird but one never knows what users come up with.
+
+\registerctxluafile{typo-ovl}{}
+
+\definesystemattribute[overloads][public,global]
+
+\installcorenamespace{overloads}
+
+%D Watch how we abuse highlights.
+
+\newcount\c_typo_overload_font_id
+
+\unexpanded\def\typo_overloads_define#1%
+ {\begingroup
+ % we pack so we avoid interference (and for sure don't process!)
+ \setbox\scratchbox\hpack\bgroup
+ \global\c_typo_overload_font_id\fontid\font
+ \resetallattributes % so we only change what gets set
+ \highlight[#1]%
+ \signalcharacter
+ \global\c_typo_overload_font_id
+ \ifnum\c_typo_overload_font_id=\fontid\font
+ \zerocount
+ \else
+ \fontid\font
+ \fi
+ \egroup
+ \global\expandafter\chardef\csname\??overloads#1\endcsname
+ \clf_overloadsattribute{#1}\c_typo_overload_font_id\scratchbox
+ \endgroup}
+
+\unexpanded\def\setoverloads[#1]%
+ {\ifcsname\??overloads#1\endcsname\else
+ \typo_overloads_define{#1}%
+ \fi
+ \attribute\overloadsattribute\csname\??overloads#1\endcsname}
+
+\unexpanded\def\registeroverloads[#1]%
+ {\ifcsname\??overloads#1\endcsname\else
+ \typo_overloads_define{#1}%
+ \fi}
+
+\unexpanded\def\resetoverloads
+ {\overloadsattribute\attributeunsetvalue}
+
+%D We hook this into the replacement module, probably the only place where it makes
+%D sense. Here is an adapted version of an example:
+%D
+%D \starttyping
+%D \replaceword[basics][new] [old]
+%D \replaceword[basics][now] [hl3->never]
+%D \replaceword[basics][never][now]
+%D \replaceword[basics][heck] []
+%D
+%D \definehighlight[hl1][style={\setbar[underbar]\red\setcharactercasing[WORD]\bf}]
+%D \definehighlight[hl2][style={\setbar[overbar]\blue\setcharactercasing[Words]}]
+%D \definehighlight[hl3][style={\setbar[overstrike]\green\bs}]
+%D
+%D \registeroverloads[hl1]
+%D \registeroverloads[hl2]
+%D \registeroverloads[hl3]
+%D
+%D \start \setreplacements[basics][hl1] What the heck, it's now or never, isn't it new? \stop \par
+%D \start \setreplacements[basics][hl2] What the heck, it's now or never, isn't it new? \stop \par
+%D \start \setreplacements[basics][hl1] What the heck, it's now or never, isn't it new? \stop \par
+%D \start \setreplacements[basics] What the heck, it's now or never, isn't it new? \stop \par
+%D \stoptyping
+%D
+%D We used it to mark synonyms that should not be corrected by the editor. Sort of the
+%D reverse of not having a word in a vetted wordlist. A bit out of place in a typesetting
+%D system. If really needed we can support multiple words seperataed by spaces but I didn't
+%D need it. And \unknown\ fonts are supported but at fixed size!
+
+\ifdefined\setreplacements
+
+ \unexpanded\def\setreplacements
+ {\dodoubleempty\languages_replacements_set}
+
+ \unexpanded\def\languages_replacements_set[#1][#2]%
+ {\clf_setreplacements{#1}%
+ \ifsecondargument
+ \setoverloads[#2]%
+ \else
+ \resetoverloads
+ \fi}
+
+\else
+
+ % something weird
+
+\fi
+
+\protect
diff --git a/tex/context/base/mkiv/typo-prc.lua b/tex/context/base/mkiv/typo-prc.lua
index cde66df00..2704149db 100644
--- a/tex/context/base/mkiv/typo-prc.lua
+++ b/tex/context/base/mkiv/typo-prc.lua
@@ -41,9 +41,9 @@ local becomes = P('->')
local processor = (1-becomes)^1
local splitter = C(processor) * becomes * Cs(patterns.argument + patterns.content)
-function processors.split(str)
+function processors.split(str,nocheck)
local p, s = lpegmatch(splitter,str)
- if registered[p] then
+ if p and (nocheck or registered[p]) then
return p, s
else
return false, str
diff --git a/tex/context/fonts/mkiv/stix-two-math.lfg b/tex/context/fonts/mkiv/stix-two-math.lfg
index dfbe7487e..8d9c9c71a 100644
--- a/tex/context/fonts/mkiv/stix-two-math.lfg
+++ b/tex/context/fonts/mkiv/stix-two-math.lfg
@@ -4,7 +4,7 @@
-- As we cannot rely on version numbers (if we have more patches) we
-- check for values instead.
--
--- This font also has inconsistent italics in smalelr sizes which we can
+-- This font also has inconsistent italics in smaller sizes which we can
-- fix in a more general way but I'm not sure if we want that.
local function fix_italic(target,original,name,value,factor)
@@ -17,7 +17,6 @@ local function fix_italic(target,original,name,value,factor)
local i = c.italic
if i then
local d = original.descriptions[u]
- inspect(d)
if d and d.math.italic == value then
if m then
logs.report("patching font","fixing italic correction of %U at math size %i by %0.3f",u,m,factor)
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 8c8249219..35b8810b8 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index ceab04020..c941d4cc1 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/modules/mkiv/m-typesetting.mkiv b/tex/context/modules/mkiv/m-typesetting.mkiv
new file mode 100644
index 000000000..34713fa38
--- /dev/null
+++ b/tex/context/modules/mkiv/m-typesetting.mkiv
@@ -0,0 +1,149 @@
+%D \module
+%D [ file=m-typesetting,
+%D version=2017.11.15, % reused from columnset style
+%D title=\CONTEXT\ Modules,
+%D subtitle=Typesetting pages,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\startmodule[typesetting]
+
+% \setupcombination
+% [style=mono]
+
+\definecombination
+ [twopages]
+
+\definecombination
+ [fourpages]
+ [distance=.5\bodyfontsize,
+ width=\textwidth]
+
+\definecombination
+ [sixpages]
+ [distance=.5\bodyfontsize,
+ width=\textwidth]
+
+\definemeasure[twopages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+\definemeasure[fourpages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+\definemeasure[sixpages] [\dimexpr\dimexpr\textwidth-2.5\bodyfontsize\relax/6\relax]
+\definemeasure[eightpages][\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+
+\starttexdefinition unexpanded OnePage #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][1*1]
+ {\typesetfile[#1.tex][page=1,lines=15]} {1}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded OneSpread #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][1*1]
+ {\typesetfile[#1.tex][page=2,lines=15]} {2}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded TwoPages #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][2*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{twopages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded TwoSpread #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][2*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{twopages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{twopages}]} {3}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded FourPages #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{fourpages}]} {3}
+ {\typesetfile[#1.tex][page=4,width=\measure{fourpages}]} {4}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded FourSpread #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{fourpages}]} {3}
+ {\typesetfile[#1.tex][page=4,width=\measure{fourpages}]} {4}
+ {\typesetfile[#1.tex][page=5,width=\measure{fourpages}]} {5}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded SixPages #1
+ \startlinecorrection[blank]
+ \startcombination[sixpages][6*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{sixpages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{sixpages}]} {3}
+ {\typesetfile[#1.tex][page=4,width=\measure{sixpages}]} {4}
+ {\typesetfile[#1.tex][page=5,width=\measure{sixpages}]} {5}
+ {\typesetfile[#1.tex][page=6,width=\measure{sixpages}]} {6}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded SixSpread #1
+ \startlinecorrection[blank]
+ \startcombination[sixpages][6*1]
+ {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
+ {\typesetfile[#1.tex][page=3,width=\measure{sixpages}]} {3}
+ {\typesetfile[#1.tex][page=4,width=\measure{sixpages}]} {4}
+ {\typesetfile[#1.tex][page=5,width=\measure{sixpages}]} {5}
+ {\typesetfile[#1.tex][page=6,width=\measure{sixpages}]} {6}
+ {\typesetfile[#1.tex][page=7,width=\measure{sixpages}]} {7}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded EightPages #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*2]
+ {\typesetfile[#1.tex][page=1,width=\measure{eightpages}]} {#1 / 1}
+ {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
+ {\typesetfile[#1.tex][page=3,width=\measure{eightpages}]} {#1 / 3}
+ {\typesetfile[#1.tex][page=4,width=\measure{eightpages}]} {#1 / 4}
+ {\typesetfile[#1.tex][page=5,width=\measure{eightpages}]} {#1 / 5}
+ {\typesetfile[#1.tex][page=6,width=\measure{eightpages}]} {#1 / 6}
+ {\typesetfile[#1.tex][page=7,width=\measure{eightpages}]} {#1 / 7}
+ {\typesetfile[#1.tex][page=8,width=\measure{eightpages}]} {#1 / 8}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\starttexdefinition unexpanded EightSpread #1
+ \startlinecorrection[blank]
+ \startcombination[fourpages][4*2]
+ {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
+ {\typesetfile[#1.tex][page=3,width=\measure{eightpages}]} {#1 / 3}
+ {\typesetfile[#1.tex][page=4,width=\measure{eightpages}]} {#1 / 4}
+ {\typesetfile[#1.tex][page=5,width=\measure{eightpages}]} {#1 / 5}
+ {\typesetfile[#1.tex][page=6,width=\measure{eightpages}]} {#1 / 6}
+ {\typesetfile[#1.tex][page=7,width=\measure{eightpages}]} {#1 / 7}
+ {\typesetfile[#1.tex][page=8,width=\measure{eightpages}]} {#1 / 8}
+ {\typesetfile[#1.tex][page=9,width=\measure{eightpages}]} {#1 / 9}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
+\stopmodule
diff --git a/tex/context/modules/mkiv/s-evohome.mkiv b/tex/context/modules/mkiv/s-evohome.mkiv
index 06641d2c4..e5c2ae6bb 100644
--- a/tex/context/modules/mkiv/s-evohome.mkiv
+++ b/tex/context/modules/mkiv/s-evohome.mkiv
@@ -65,7 +65,7 @@ function moduledata.evohome.status(specification)
for i=1,#zones do
local zone = zones[i]
- local data = utilities.evohome.getroomstate(presets,zone.name)
+ local data = utilities.evohome.getzonestate(presets,zone.name)
local schedule = data.schedule or { }
context.startsubject { title = zone.name }
context.starttabulate { "|l|c|c|" }
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index a02bce663..3e59cb448 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 11/15/17 22:08:52
+-- merge date : 11/19/17 20:15:33
do -- begin closure to overcome local limits and interference