summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-04-14 23:17:45 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-04-14 23:17:45 +0200
commit113a26a2838ace27514f6348ed0d41bf87724472 (patch)
tree306e92bd61c55979ec5033898d565f8fc69c84eb /tex/context
parent9191d12efe40ce045f76b695fc5c02fa6a1a7d6a (diff)
downloadcontext-113a26a2838ace27514f6348ed0d41bf87724472.tar.gz
2021-04-14 22:57:00
Diffstat (limited to 'tex/context')
-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.mkiv2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26155 -> 24897 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin257718 -> 240711 bytes
-rw-r--r--tex/context/base/mkiv/util-zip.lua35
-rw-r--r--tex/context/base/mkxl/cldf-lmt.lmt72
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl2
-rw-r--r--tex/context/base/mkxl/lpdf-lmt.lmt52
-rw-r--r--tex/context/base/mkxl/mult-ini.mkxl6
-rw-r--r--tex/context/fonts/mkiv/pagella-math.lfg2
13 files changed, 124 insertions, 55 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index a0151c54d..b468ce3d0 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{2021.04.09 19:54}
+\newcontextversion{2021.04.14 22:55}
%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 5313df6e6..7ad92f388 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{2021.04.09 19:54}
+\edef\contextversion{2021.04.14 22:55}
%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 e81cbb7d9..7bb390194 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.04.09 19:54}
+\newcontextversion{2021.04.14 22:55}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 5062c3a10..6fa606a95 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2021.04.09 19:54}
+\edef\contextversion{2021.04.14 22:55}
%D Kind of special:
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index cffa6fdb6..69556e09e 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 fea56a359..615e7d326 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/util-zip.lua b/tex/context/base/mkiv/util-zip.lua
index f87e391a1..e97f3a065 100644
--- a/tex/context/base/mkiv/util-zip.lua
+++ b/tex/context/base/mkiv/util-zip.lua
@@ -34,32 +34,13 @@ local band = bit32.band
local rshift = bit32.rshift
local lshift = bit32.lshift
-local decompress, expandsize, calculatecrc
+local zlibdecompress = zlib.decompress
+local zlibdecompresssize = zlib.decompresssize
+local zlibchecksum = zlib.crc32
--- if flate then
---
--- decompress = flate.flate_decompress
--- calculatecrc = flate.update_crc32
---
--- else
-
- local zlibdecompress = zlib.decompress
- local zlibexpandsize = zlib.expandsize
- local zlibchecksum = zlib.crc32
-
- decompress = function(source)
- return zlibdecompress(source,-15) -- auto
- end
-
- expandsize = zlibexpandsize and function(source,targetsize)
- return zlibexpandsize(source,targetsize,-15) -- auto
- end or decompress
-
- calculatecrc = function(buffer,initial)
- return zlibchecksum(initial or 0,buffer)
- end
-
--- end
+local decompress = function(source) return zlibdecompress (source,-15) end -- auto
+local decompresssize = function(source,targetsize) return zlibdecompresssize(source,targetsize,-15) end -- auto
+local calculatecrc = function(buffer,initial) return zlibchecksum (initial or 0,buffer) end
local zipfiles = { }
utilities.zipfiles = zipfiles
@@ -201,8 +182,8 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist
setposition(handle,position)
local result = readstring(handle,compressed)
if data.method == 8 then
- if expandsize then
- result = expandsize(result,data.uncompressed)
+ if decompresssize then
+ result = decompresssize(result,data.uncompressed)
else
result = decompress(result)
end
diff --git a/tex/context/base/mkxl/cldf-lmt.lmt b/tex/context/base/mkxl/cldf-lmt.lmt
index f3121eadc..1c1b6a353 100644
--- a/tex/context/base/mkxl/cldf-lmt.lmt
+++ b/tex/context/base/mkxl/cldf-lmt.lmt
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['cldf-lmt'] = {
license = "see context related readme files"
}
-local next, load = next, load
+local next, load, tonumber = next, load, tonumber
local gmatch, gsub, byte = string.gmatch, string.gsub, string.byte
local setmetatableindex = table.setmetatableindex
@@ -627,7 +627,7 @@ context.luatables = {
local tables = { }
local stack = setmetatableindex("table")
-interfaces.implement {
+implement {
name = "droptablegroup",
public = true,
actions = function()
@@ -699,7 +699,7 @@ local function newtable(array)
if not tables[name] then
local t = { }
tables[name] = t
- interfaces.implement {
+ implement {
name = name,
public = true,
usage = "value",
@@ -886,7 +886,7 @@ implement {
end
}
-interfaces.implement {
+implement {
name = "bitwise",
public = true,
usage = "value",
@@ -933,7 +933,7 @@ interfaces.implement {
local escape = function(s) return "\\" .. byte(s) end
-interfaces.implement {
+implement {
name = "ctxluamatch",
public = true,
usage = "value",
@@ -947,3 +947,65 @@ interfaces.implement {
return none_code
end,
}
+
+-- yes or no ...
+
+do
+
+ local codes = { }
+ tex.codes = codes
+
+ local global_code = tex.flagcodes.global
+
+ local savelua = token.save_lua
+ local isdefined = token.is_defined
+
+ local newsparse = sparse.new
+ local setsparse = sparse.set
+ local wipesparse = sparse.wipe
+ local restoresparse = sparse.restore
+
+ -- local function isglobal(n) -- maybe a general helper
+ -- return n and (tonumber(n) & global_code)
+ -- end
+
+ local registerfunction = context.functions.register
+
+ implement {
+ name = "codedef",
+ public = true,
+ protected = true,
+ actions = function(what)
+ local name = scancsname(true)
+ -- if isdefined(name) then
+ -- wipesparse(codes[name]) -- better make a wipe helper if ever needed
+ -- else
+ local code = newsparse()
+ local restore = registerfunction(function() restoresparse(code) end)
+ implement {
+ name = name,
+ public = true,
+ protected = true,
+ usage = "value",
+ actions = function(what)
+ local n = scaninteger()
+ if what == "value" then
+ return integer_code, code[n]
+ else
+ local v = scaninteger(true)
+ -- if isglobal(what) then
+ if what and (tonumber(what) & global_code) then
+ setsparse(code,"global",n,v)
+ else
+ savelua(restore,true) -- only once
+ setsparse(code,n,v)
+ end
+ end
+ end,
+ }
+ codes[name] = code
+ -- end
+ end,
+ }
+
+end
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 87175b22d..f99a9ce23 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.04.09 19:54}
+\newcontextversion{2021.04.14 22:55}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 84bdd0277..103481265 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2021.04.09 19:54}
+\immutable\edef\contextversion{2021.04.14 22:55}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt
index 8d8220230..800f56ca3 100644
--- a/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -42,9 +42,9 @@ local loaddata = io.loaddata
local bpfactor = number.dimenfactors.bp
--- local md5HEX = md5.HEX
local osuuid = os.uuid
-local zlibcompress = (xzip or zlib).compress
+local zlibcompress = xzip.compress
+local zlibcompresssize = xzip.compresssize
local nuts = nodes.nuts
local tonut = nodes.tonut
@@ -101,6 +101,19 @@ local report_objects = logs.reporter("backend","objects")
local trace_objects = false trackers.register("backend.objects", function(v) trace_objects = v end)
local trace_details = false trackers.register("backend.details", function(v) trace_details = v end)
+-- experiment:
+
+local function compressdata(data,size)
+ local guess = ((size // 4096) + 1) * 2048
+ local comp = zlibcompresssize(data,3,guess)
+ -- if comp then
+ -- report()
+ -- report("size %i, guess %i, result %i => %s / %s",size,guess,#comp,guess>=#comp and "hit" or "miss")
+ -- report()
+ -- end
+ return comp
+end
+
-- we collect them:
local flushers = { }
@@ -2021,25 +2034,28 @@ local addtocache, flushcache, cache do
list = concat(list," ")
data[0] = list
data = concat(data,"\010",0,d)
+ local size = #data
local strobj = pdfdictionary {
Type = p_ObjStm,
N = d,
First = #list + 1,
}
objects[cache] = offset
- local b = nil
- local e = s_stream_e
+ local fb
if compress then
- local comp = zlibcompress(data,3)
- if comp and #comp < #data then
+-- local comp = zlibcompress(data,3)
+ local comp = compressdata(data,size)
+ if comp and #comp < size then
data = comp
- b = f_stream_b_d_c(cache,strobj(),#data)
+ fb = f_stream_b_d_c
else
- b = f_stream_b_d_u(cache,strobj(),#data)
+ fb = f_stream_b_d_u
end
else
- b = f_stream_b_d_u(cache,strobj(),#data)
+ fb = f_stream_b_d_u
end
+ local b = fb(cache,strobj(),size)
+ local e = s_stream_e
flush(f,b)
flush(f,data)
flush(f,e)
@@ -2274,7 +2290,8 @@ local function flushstreamobj(data,n,dict,comp,nolength)
if nolength then
b = f_stream_b_d_r(n,dict)
elseif comp ~= false and compress and size > threshold then
- local compdata = zlibcompress(data,3)
+-- local compdata = zlibcompress(data,3)
+ local compdata = compressdata(data,size)
if compdata then
local compsize = #compdata
if compsize > size - threshold then
@@ -2298,7 +2315,8 @@ local function flushstreamobj(data,n,dict,comp,nolength)
if nolength then
data = f_stream_d_r(n,dict,data)
elseif comp ~= false and compress and size > threshold then
- local compdata = zlibcompress(data,3)
+-- local compdata = zlibcompress(data,3)
+ local compdata = compressdata(data,size)
if compdata then
local compsize = #compdata
if compsize > size - threshold then
@@ -2635,6 +2653,7 @@ local openfile, closefile do
end
objects[0] = rep("\0",1+nofbytes+1)
local data = concat(objects,"",0,nofobjects)
+ local size = #data
local xref = pdfdictionary {
Type = pdfconstant("XRef"),
Size = nofobjects + 1,
@@ -2643,17 +2662,20 @@ local openfile, closefile do
Info = info,
ID = trailerid and pdfarray { pdfliteral(trailerid,true), pdfliteral(trailerid,true) } or nil,
}
+ local fb
if compress then
- local comp = zlibcompress(data,3)
+-- local comp = zlibcompress(data,3)
+ local comp = compressdata(data,size)
if comp then
data = comp
- flush(f,f_stream_b_d_c(nofobjects,xref(),#data))
+ fb = f_stream_b_d_c
else
- flush(f,f_stream_b_d_u(nofobjects,xref(),#data))
+ fb = f_stream_b_d_u
end
else
- flush(f,f_stream_b_d_u(nofobjects,xref(),#data))
+ fb = f_stream_b_d_u
end
+ flush(f,fb(nofobjects,xref(),size))
flush(f,data)
flush(f,s_stream_e)
flush(f,f_startxref(xrefoffset))
diff --git a/tex/context/base/mkxl/mult-ini.mkxl b/tex/context/base/mkxl/mult-ini.mkxl
index 17f63ef93..b357c3e12 100644
--- a/tex/context/base/mkxl/mult-ini.mkxl
+++ b/tex/context/base/mkxl/mult-ini.mkxl
@@ -19,8 +19,10 @@
\unprotect
-\registerctxluafile{mult-ini}{autosuffix}
-\registerctxluafile{mult-fmt}{initexonly}
+\pushoverloadmode
+ \registerctxluafile{mult-ini}{autosuffix}
+ \registerctxluafile{mult-fmt}{initexonly}
+\popoverloadmode
%D \macros
%D [constanten,variabelen,commands]
diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg
index d4ae14162..0e8ac1f70 100644
--- a/tex/context/fonts/mkiv/pagella-math.lfg
+++ b/tex/context/fonts/mkiv/pagella-math.lfg
@@ -1,5 +1,6 @@
local kern_V = { bottomright = { { kern = -200 } } }
local kern_W = { bottomright = { { kern = -100 } } }
+-- local kern_f = { bottomright = { { kern = -100 } } }
local offset_f = { xoffset = "llx" }
-- Beware of updates in ssty slots!
@@ -27,6 +28,7 @@ return {
-- [0x1D44A] = kern_W, -- 𝑊
-- ["1:0x1D44A"] = kern_W, -- needed for compact
-- ["2:0x1D44A"] = kern_W, -- needed for compact
+-- ["*:0x1D453"] = kern_f,
["*:0x1D449"] = kern_V, -- 𝑉
["*:0x1D44A"] = kern_W, -- 𝑊
},