summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
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/back-exp.lua20
-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/context.mkxl2
-rw-r--r--tex/context/base/mkiv/driv-shp.lua25
-rw-r--r--tex/context/base/mkiv/font-mps.lua4
-rw-r--r--tex/context/base/mkiv/font-nod.lua5
-rw-r--r--tex/context/base/mkiv/font-ots.lua16
-rw-r--r--tex/context/base/mkiv/lpdf-emb.lua6
-rw-r--r--tex/context/base/mkiv/lpdf-lmt.lua252
-rw-r--r--tex/context/base/mkiv/math-tag.lua21
-rw-r--r--tex/context/base/mkiv/meta-ini.mkiv63
-rw-r--r--tex/context/base/mkiv/meta-ini.mkxl39
-rw-r--r--tex/context/base/mkiv/node-ltp.lua19
-rw-r--r--tex/context/base/mkiv/node-nut.lua12
-rw-r--r--tex/context/base/mkiv/pack-rul.mkiv1
-rw-r--r--tex/context/base/mkiv/pack-rul.mkxl2
-rw-r--r--tex/context/base/mkiv/spac-prf.lua4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26630 -> 26616 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin268730 -> 267867 bytes
-rw-r--r--tex/context/base/mkiv/supp-box.lua12
-rw-r--r--tex/context/base/mkiv/typo-chr.lua2
-rw-r--r--tex/context/base/mkiv/typo-ovl.lua16
-rw-r--r--tex/context/base/mkiv/util-str.lua33
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin888718 -> 893320 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin61165 -> 61165 bytes
-rw-r--r--tex/context/modules/mkiv/x-setups-basics.mkiv4
-rw-r--r--tex/context/modules/mkiv/x-setups-overview.mkiv35
30 files changed, 315 insertions, 286 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 88a6725ac..8102353cb 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{2019.08.18 22:16}
+\newcontextversion{2019.08.20 17:20}
%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 245efc750..d745ff9da 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{2019.08.18 22:16}
+\edef\contextversion{2019.08.20 17:20}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 18333ab21..617bf7cc3 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -2692,16 +2692,16 @@ local function push(fulltag,depth)
end
local treedata = tree.data
local t = { -- maybe we can use the tag table
- tg = tg,
- fulltag = fulltag,
- detail = detail,
- n = n, -- already a number
- element = element,
- nature = nature,
- data = { },
- attribute = currentattribute,
- parnumber = currentparagraph,
- record = record, -- we can consider storing properties
+ tg = tg,
+ fulltag = fulltag,
+ detail = detail,
+ n = n, -- already a number
+ element = element,
+ nature = nature,
+ data = { },
+ attribute = currentattribute,
+ parnumber = currentparagraph,
+ record = record, -- we can consider storing properties
}
treedata[#treedata+1] = t
currentdepth = currentdepth + 1
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index f21269908..6b6f3e909 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{2019.08.18 22:16}
+\newcontextversion{2019.08.20 17:20}
%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 7798cf29b..c92be96d4 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{2019.08.18 22:16}
+\edef\contextversion{2019.08.20 17:20}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index e4904c50e..6c210c12c 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2019.08.18 22:16}
+\edef\contextversion{2019.08.20 17:20}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/driv-shp.lua b/tex/context/base/mkiv/driv-shp.lua
index 18f910225..ae99d84ce 100644
--- a/tex/context/base/mkiv/driv-shp.lua
+++ b/tex/context/base/mkiv/driv-shp.lua
@@ -43,6 +43,7 @@ local getboxglue = nuts.getboxglue
local getexpansion = nuts.getexpansion
local getreplace = nuts.getreplace
local setreplace = nuts.setreplace
+local getfont = nuts.getfont
local setdirection = nuts.setdirection
local setfield = nuts.setfield
@@ -66,6 +67,7 @@ local parameters = fonthashes.parameters
local nodecodes = nodes.nodecodes
local whatsitcodes = nodes.whatsitcodes
local leadercodes = nodes.leadercodes
+local gluecodes = nodes.gluecodes
local dircodes = nodes.dircodes
local dirvalues = nodes.dirvalues
local subtypes = nodes.subtypes
@@ -94,6 +96,8 @@ local cleaders_code <const> = leadercodes.cleaders
local xleaders_code <const> = leadercodes.xleaders
local gleaders_code <const> = leadercodes.gleaders
+local spaceskip_code <const> = gluecodes.spaceskip
+
local saveposwhatsit_code <const> = whatsitcodes.savepos
local userdefinedwhatsit_code <const> = whatsitcodes.userdefined
local openwhatsit_code <const> = whatsitcodes.open
@@ -170,6 +174,10 @@ local level = 0
local nesting = 0
local main = 0
+-- experiment (smaller page stream but might be fragile)
+
+local tospace = false directives.register("backends.spaces", function(v) tospace = v end)
+
-- todo: cache streams
local function flush_vf_packet(pos_h,pos_v,pos_r,font,char,data,factor,vfcommands)
@@ -532,7 +540,8 @@ local hlist_out, vlist_out do
pos_v = ref_v - (cur_v - y_offset)
-- synced
end
- local wd, ht, dp = flush_character(current,font,char,false,true,pos_h,pos_v,pos_r)
+ -- local wd, ht, dp = flush_character(current,font,char,false,true,pos_h,pos_v,pos_r)
+ local wd = flush_character(current,font,char,false,true,pos_h,pos_v,pos_r)
cur_h = cur_h + wd
elseif id == glue_code then
local gluewidth = effectiveglue(current,this_box)
@@ -564,7 +573,6 @@ local hlist_out, vlist_out do
gluewidth = gluewidth + 10
local edge = cur_h + gluewidth
local lx = 0
- -- local subtype = getsubtype(current)
if subtype == gleaders_code then
local save_h = cur_h
if pos_r == righttoleft_code then
@@ -628,6 +636,10 @@ local hlist_out, vlist_out do
cur_h = cur_h + gluewidth
end
else
+ if tospace and subtype == spaceskip_code then
+ -- todo: flush_space
+ flush_character(false,getfont(current),32,false,true,pos_h,pos_v,pos_r)
+ end
cur_h = cur_h + gluewidth
end
end
@@ -757,10 +769,9 @@ local hlist_out, vlist_out do
cur_h = cur_h + effectiveglue(current,this_box)
-- end
elseif id == dir_code then
- -- we normally have proper begin-end pairs
- -- a begin without end is (silently) handled
- -- an end without a begin will be (silently) skipped
- -- we only need to move forward so a faster calculation
+ -- We normally have proper begin-end pairs. A begin without end is (silently) handled
+ -- and an end without a begin will be (silently) skipped we only need to move forward
+ -- so we then have a faster calculation.
local dir, cancel = getdirection(current)
if cancel then
local ds = dirstack[current]
@@ -820,6 +831,8 @@ local hlist_out, vlist_out do
elseif id == marginkern_code then
cur_h = cur_h + getkern(current)
end
+ -- There is no gain in skipping over this when we have zero progression
+ -- and such.
if pos_r == righttoleft_code then
pos_h = ref_h - cur_h
else
diff --git a/tex/context/base/mkiv/font-mps.lua b/tex/context/base/mkiv/font-mps.lua
index 895835958..d5bacaff5 100644
--- a/tex/context/base/mkiv/font-mps.lua
+++ b/tex/context/base/mkiv/font-mps.lua
@@ -279,7 +279,7 @@ local getnext = nuts.getnext
local getid = nuts.getid
local getlist = nuts.getlist
local getsubtype = nuts.getsubtype
-local getfield = nuts.getfield
+local getreplace = nuts.getreplace
local getbox = nuts.getbox
local getwhd = nuts.getwhd
local getkern = nuts.getkern
@@ -372,7 +372,7 @@ function fonts.metapost.boxtomp(n,kind)
result[#result+1] = code
dx = dx + width
elseif id == disc_code then
- local replace = getfield(current,"replace")
+ local replace = getreplace(current)
if replace then
dx = dx + horizontal(parent,replace,xoffset+dx,yoffset)
end
diff --git a/tex/context/base/mkiv/font-nod.lua b/tex/context/base/mkiv/font-nod.lua
index a0eb88a25..f359ef04f 100644
--- a/tex/context/base/mkiv/font-nod.lua
+++ b/tex/context/base/mkiv/font-nod.lua
@@ -56,7 +56,6 @@ local kern_code = nodecodes.kern
local dir_code = nodecodes.dir
local localpar_code = nodecodes.localpar
-local getfield = nuts.getfield
local getnext = nuts.getnext
local getprev = nuts.getprev
local getid = nuts.getid
@@ -64,6 +63,7 @@ local getfont = nuts.getfont
local getsubtype = nuts.getsubtype
local getlist = nuts.getlist
local getdisc = nuts.getdisc
+local getreplace = nuts.getreplace
local isglyph = nuts.isglyph
local getkern = nuts.getkern
local getdirection = nuts.getdirection
@@ -519,7 +519,8 @@ local function toutf(list,result,nofresult,stopcriterium,nostrip)
result[nofresult] = f_badcode(c)
end
elseif id == disc_code then
- result, nofresult = toutf(getfield(n,"replace"),result,nofresult,false,true) -- needed?
+ local replace = getreplace(n)
+ result, nofresult = toutf(replace,result,nofresult,false,true) -- needed?
elseif id == hlist_code or id == vlist_code then
-- if nofresult > 0 and result[nofresult] ~= " " then
-- nofresult = nofresult + 1
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 631302200..5091fd765 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -177,7 +177,6 @@ registertracker("otf.sample.silent", "otf.steps=silent","otf.substitutions","otf
local nuts = nodes.nuts
-local getfield = nuts.getfield
local getnext = nuts.getnext
local setnext = nuts.setnext
local getprev = nuts.getprev
@@ -193,6 +192,7 @@ local getchar = nuts.getchar
local setchar = nuts.setchar
local getdisc = nuts.getdisc
local setdisc = nuts.setdisc
+local getreplace = nuts.getreplace
local setlink = nuts.setlink
local getcomponents = nuts.getcomponents -- the original one, not yet node-aux
local setcomponents = nuts.setcomponents -- the original one, not yet node-aux
@@ -2090,7 +2090,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
if keepdisc then
keepdisc = false
lookaheaddisc = current
- local replace = getfield(current,"replace")
+ local replace = getreplace(current)
if not replace then
sweepoverflow = true
sweepnode = current
@@ -2167,7 +2167,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
lookaheaddisc = current
end
-- we assume a simple text only replace (we could use nuts.count)
- local replace = getfield(current,"replace")
+ local replace = getreplace(current)
while replace and i < s do
if getid(replace) == glyph_code then
i = i + 1
@@ -2213,7 +2213,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck)
backtrackdisc = current
end
-- we assume a simple text only replace (we could use nuts.count)
- local replace = getfield(current,"replace")
+ local replace = getreplace(current)
while replace and i > 1 do
if getid(replace) == glyph_code then
i = i - 1
@@ -3386,7 +3386,7 @@ local function t_run_single(start,stop,font,attr,lookupcache)
-- how about post ... we can probably merge this into the while
while getid(s) == disc_code do
ss = getnext(s)
- s = getfield(s,"replace")
+ s = getreplace(s)
if not s then
s = ss
ss = nil
@@ -3413,7 +3413,7 @@ local function t_run_single(start,stop,font,attr,lookupcache)
end
while getid(s) == disc_code do
ss = getnext(s)
- s = getfield(s,"replace")
+ s = getreplace(s)
if not s then
s = ss
ss = nil
@@ -3556,7 +3556,7 @@ local function t_run_multiple(start,stop,font,attr,steps,nofsteps)
end
while getid(s) == disc_code do
ss = getnext(s)
- s = getfield(s,"replace")
+ s = getreplace(s)
if not s then
s = ss
ss = nil
@@ -3583,7 +3583,7 @@ local function t_run_multiple(start,stop,font,attr,steps,nofsteps)
end
while getid(s) == disc_code do
ss = getnext(s)
- s = getfield(s,"replace")
+ s = getreplace(s)
if not s then
s = ss
ss = nil
diff --git a/tex/context/base/mkiv/lpdf-emb.lua b/tex/context/base/mkiv/lpdf-emb.lua
index acb8a3082..dbf6fd4d3 100644
--- a/tex/context/base/mkiv/lpdf-emb.lua
+++ b/tex/context/base/mkiv/lpdf-emb.lua
@@ -1768,9 +1768,9 @@ function lpdf.flushfonts()
-- This will move to the tpk module where we will also deal
-- with bitmaps then.
local encoding, pfbfile, encfile = getmapentry(filename)
-if trace_fonts then
- report_fonts("file %a resolved to encoding %a and file %a",filename,encoding,pfbfile)
-end
+ if trace_fonts then
+ report_fonts("file %a resolved to encoding %a and file %a",filename,encoding,pfbfile)
+ end
if encoding and pfbfile then
filename = pfbfile
format = "type1"
diff --git a/tex/context/base/mkiv/lpdf-lmt.lua b/tex/context/base/mkiv/lpdf-lmt.lua
index b1fcc2c78..6913e24e9 100644
--- a/tex/context/base/mkiv/lpdf-lmt.lua
+++ b/tex/context/base/mkiv/lpdf-lmt.lua
@@ -38,7 +38,7 @@ local band, extract = bit32.band, bit32.extract
local concat, sortedhash = table.concat, table.sortedhash
local setmetatableindex = table.setmetatableindex
-local bpfactor <const> = number.dimenfactors.bp
+local bpfactor <const> = number.dimenfactors.bp
local md5HEX = md5.HEX
local osuuid = os.uuid
@@ -79,6 +79,8 @@ local properties = fonthashes.properties
local report = logs.reporter("backend")
+local trace_threshold = false trackers.register("backends.pdf.threshold", function(v) trace_threshold = v end)
+
-- used variables
local pdf_h, pdf_v
@@ -150,11 +152,11 @@ local fontproperties
local usedcharacters = setmetatableindex("table")
local pdfcharacters
-local horizontalmode = true
------ widefontmode = true
-local scalefactor = 1
-local threshold = 655360 * 5 / 100
-local tjfactor = 100 / 65536
+local horizontalmode = true
+----- widefontmode = true
+local scalefactor = 1
+local threshold = 655360
+local tjfactor <const> = 100 / 65536
lpdf.usedcharacters = usedcharacters
@@ -168,7 +170,8 @@ local function updatefontstate(font)
horizontalmode = fontparameters.writingmode ~= "vertical"
-- widefontmode = fontproperties.encodingbytes == 2
scalefactor = (designsize/size) * tjfactor
- threshold = size * (fontproperties.threshold or 5) / 100
+ local fthreshold = fontproperties.threshold
+ threshold = (fthreshold and (size * fthreshold / 100)) or 655360
end
-- helpers
@@ -234,18 +237,17 @@ local function end_chararray()
end
local function begin_charmode()
- -- b = b + 1 ; buffer[b] = widefontmode and "<" or "("
b = b + 1 ; buffer[b] = "<"
mode = "char"
end
local function end_charmode()
- -- b = b + 1 ; buffer[b] = widefontmode and ">" or ")"
b = b + 1 ; buffer[b] = ">"
mode = "chararray"
end
local function calc_pdfpos(h,v)
+ -- mostly char
if mode == "page" then
cmtx = h - pdf_h
cmty = v - pdf_v
@@ -256,11 +258,11 @@ local function calc_pdfpos(h,v)
return h ~= pdf_h or v ~= pdf_v
elseif horizontalmode then
tmty = v - saved_text_pos_v
- tj_delta = cw - h -- + saved_chararray_pos_h
+ tj_delta = cw - h
return tj_delta ~= 0 or v ~= pdf_v
else
tmtx = h - saved_text_pos_h
- tj_delta = cw + v -- - saved_chararray_pos_v
+ tj_delta = cw + v
return tj_delta ~= 0 or h ~= pdf_h
end
end
@@ -274,7 +276,7 @@ local function pdf_set_pos(h,v)
end
end
-local function pdf_reset_pos() -- pdf_set_pos(0,0)
+local function pdf_reset_pos()
if mode == "page" then
cmtx = - pdf_h
cmty = - pdf_v
@@ -325,7 +327,6 @@ end
local function pdf_goto_textmode()
if mode == "page" then
- -- pdf_set_pos(0,0)
pdf_reset_pos()
return begin_text()
elseif mode ~= "text" then
@@ -364,7 +365,6 @@ local function pdf_goto_fontmode()
elseif mode == "text" then
end_text()
end
- -- pdf_set_pos(0,0)
pdf_reset_pos()
mode = "page"
end
@@ -391,8 +391,8 @@ local flushcharacter do
tmrx = expand * extend
tmsy = slant
tmry = squeeze
- need_width = fontparameters.width
- need_mode = fontparameters.mode
+ need_width = fontparameters.width or 0
+ need_mode = fontparameters.mode or 0
f_cur = font
f_pdf = usedfonts[font] -- cache
cur_factor = factor
@@ -413,12 +413,12 @@ local flushcharacter do
-- instances.
-- local lastslant, lastextend, lastsqueeze, lastformat, lastsize, lastwidth, lastmode, lastused, lastfont
- --
+
-- local function setup_fontparameters(font,factor,f,e)
-- if font ~= lastfont then
- -- lastslant = fontparameters.slantfactor 0
- -- lastextend = fontparameters.extendfactor 1
- -- lastsqueeze = fontparameters.squeezefactor 1
+ -- lastslant = fontparameters.slantfactor or 0
+ -- lastextend = fontparameters.extendfactor or 1
+ -- lastsqueeze = fontparameters.squeezefactor or 1
-- lastformat = fontproperties.format
-- lastsize = fontparameters.size * bpfactor
-- if format == "opentype" or format == "type1" then
@@ -453,10 +453,11 @@ local flushcharacter do
-- end
local f_width = formatters["%.6F w"]
- local f_mode = formatters["%i Tr"]
- local f_font = formatters["/F%i %.6F Tf"]
- local s_width = "0 w"
- local s_mode = "0 Tr"
+ local f_mode = formatters["%i Tr"] -- can be hash
+ local f_font = formatters["/F%i %.6F Tf"] -- can be hash
+
+ local s_width <const> = "0 w"
+ local s_mode <const> = "0 Tr"
directives.register("pdf.stripzeros",function()
f_width = formatters["%.6N w"]
@@ -464,14 +465,16 @@ local flushcharacter do
end)
local function set_font()
- if need_width and need_width ~= 0 then
+ -- if need_width and need_width ~= 0 then
+ if need_width ~= 0 then
b = b + 1 ; buffer[b] = f_width(bpfactor * need_width / 1000)
done_width = true
elseif done_width then
b = b + 1 ; buffer[b] = s_width
done_width = false
end
- if need_mode and need_mode ~= 0 then
+ -- if need_mode and need_mode ~= 0 then
+ if need_mode ~= 0 then
b = b + 1 ; buffer[b] = f_mode(need_mode)
done_mode = true
elseif done_mode then
@@ -486,7 +489,7 @@ local flushcharacter do
end
local function set_textmatrix(h,v)
- local move = calc_pdfpos(h,v) -- duplicate
+ local move = calc_pdfpos(h,v)
if need_tm or move then
b = b + 1 ; buffer[b] = f_tm(tmrx, tmsx, tmsy, tmry, tmtx*bpfactor, tmty*bpfactor)
pdf_h = saved_text_pos_h + tmtx
@@ -496,13 +499,10 @@ local flushcharacter do
cur_tmrx = tmrx
end
- -- local f_skip = formatters["%.1f"]
- -- local f_octal = formatters["\\%o"]
- -- local f_char = formatters["%c"]
- local f_hex = formatters["%04X"]
+ local f_hex = formatters["%04X"]
local h_hex = setmetatableindex(function(t,k) -- we already have this somewhere
- if k < 256 then
+ if k < 256 then -- maybe 512
-- not sparse in this range
for i=0,255 do
t[i] = f_hex(i)
@@ -526,10 +526,12 @@ local flushcharacter do
end
local move = calc_pdfpos(pos_h,pos_v)
- -- report(
- -- "factor %i, width %p, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
- -- factor,width,naturalwidth,move,need_tm,pos_h,tj_delta,threshold,cw
- -- )
+ if trace_threshold then
+ report(
+ "font %i, char %C, factor %i, width %p, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
+ font,char,factor,width,naturalwidth,move,need_tm,pos_h,tj_delta,threshold,cw
+ )
+ end
if move or need_tm then
if not need_tm then
@@ -555,7 +557,7 @@ local flushcharacter do
end
if move then
local d = tj_delta * scalefactor
- if d <= -0.5 or d >= 0.5 then -- 0.25
+ if d <= -0.5 or d >= 0.5 then
if mode == "char" then
end_charmode()
end
@@ -568,25 +570,16 @@ local flushcharacter do
begin_charmode(font)
end
- local index = data.index or char
+ -- cw = cw + naturalwidth
+ cw = cw + width
- b = b + 1
- -- if widefontmode then
- -- buffer[b] = h_hex[data.index or 0]
- buffer[b] = h_hex[index]
- -- elseif char > 255 then
- -- buffer[b] = f_octal(32)
- -- elseif char <= 32 or char == 92 or char == 40 or char == 41 or char > 127 then -- \ ( )
- -- buffer[b] = f_octal(char)
- -- else
- -- buffer[b] = f_char(char)
- -- end
+ local index = data.index or char
- cw = cw + naturalwidth
+ b = b + 1 ; buffer[b] = h_hex[index]
-if not pdfcharacters[index] then
- pdfcharacters[index] = true
-end
+ if not pdfcharacters[index] then
+ pdfcharacters[index] = true
+ end
end
@@ -632,14 +625,13 @@ local flushliteral do
mode = literalvalues[mode]
end
else
- -- str, mode = getdata(current)
local p = nodeproperties[current]
-if p then
- str = p.data
- mode = p.mode
-else
- str, mode = getdata(current)
-end
+ if p then
+ str = p.data
+ mode = p.mode
+ else
+ str, mode = getdata(current)
+ end
end
if str and str ~= "" then
if mode == originliteral_code then
@@ -815,20 +807,20 @@ local flushsave, flushrestore, flushsetmatrix do
b = b + 1 ; buffer[b] = "Q"
end
--- pushorientation = function(orientation,pos_h,pos_v,pos_r)
--- flushsave(false,pos_h,pos_v)
--- if orientation == 1 then
--- flushsetmatrix("0 -1 1 0",pos_h,pos_v)
--- elseif orientation == 2 then
--- flushsetmatrix("-1 0 0 -1",pos_h,pos_v)
--- elseif orientation == 3 then
--- flushsetmatrix("0 1 -1 0",pos_h,pos_v)
--- end
--- end
+ -- pushorientation = function(orientation,pos_h,pos_v,pos_r)
+ -- flushsave(false,pos_h,pos_v)
+ -- if orientation == 1 then
+ -- flushsetmatrix("0 -1 1 0",pos_h,pos_v)
+ -- elseif orientation == 2 then
+ -- flushsetmatrix("-1 0 0 -1",pos_h,pos_v)
+ -- elseif orientation == 3 then
+ -- flushsetmatrix("0 1 -1 0",pos_h,pos_v)
+ -- end
+ -- end
--- poporientation = function(orientation,pos_h,pos_v,pos_r)
--- flushrestore(false,pos_h,pos_v)
--- end
+ -- poporientation = function(orientation,pos_h,pos_v,pos_r)
+ -- flushrestore(false,pos_h,pos_v)
+ -- end
end
@@ -861,8 +853,8 @@ local flushrule, flushsimplerule, flushimage do
local f_fm = formatters["/Fm%d Do"]
local f_im = formatters["/Im%d Do"]
- local s_b = "q"
- local s_e = "Q"
+ local s_b <const> = "q"
+ local s_e <const> = "Q"
local f_v = formatters["[] 0 d 0 J %.6F w 0 0 m %.6F 0 l S"]
local f_h = formatters["[] 0 d 0 J %.6F w 0 0 m 0 %.6F l S"]
@@ -1007,8 +999,7 @@ local flushrule, flushsimplerule, flushimage do
b = b + 1 ; buffer[b] = s_e
end
- -- place image also used in vf but we can use a different one if
- -- we need it
+ -- place image also used in vf but we can use a different one if we need it
local imagetypes = images.types -- pdf png jpg jp2 jbig2 stream memstream
local img_none = imagetypes.none
@@ -1016,7 +1007,7 @@ local flushrule, flushsimplerule, flushimage do
local img_stream = imagetypes.stream
local img_memstream = imagetypes.memstream
- local one_bp <const> = 65536 * bpfactor
+ local one_bp <const> = 65536 * bpfactor
local imageresources, n = { }, 0
@@ -1543,7 +1534,7 @@ local streams = { } -- maybe just parallel to objects (no holes)
local nofobjects = 0
local offset = 0
local f = false
------ flush = false
+local flush = false
local threshold = 40 -- also #("/Filter /FlateDecode")
local objectstream = true
local compress = true
@@ -1570,8 +1561,8 @@ local f_stream_b_d_u = formatters["%i 0 obj\010<< %s /Length %i >>\010stream\010
local f_stream_b_d_c = formatters["%i 0 obj\010<< %s /Filter /FlateDecode /Length %i >>\010stream\010"]
local f_stream_b_d_r = formatters["%i 0 obj\010<< %s >>\010stream\010"]
-local s_object_e = "\010endobj\010"
-local s_stream_e = "\010endstream\010endobj\010"
+local s_object_e <const> = "\010endobj\010"
+local s_stream_e <const> = "\010endstream\010endobj\010"
do
@@ -1678,9 +1669,9 @@ local addtocache, flushcache, cache do
else
b = f_stream_b_d_u(cache,strobj(),#data)
end
- f:write(b)
- f:write(data)
- f:write(e)
+ flush(f,b)
+ flush(f,data)
+ flush(f,e)
offset = offset + #b + #data + #e
data, d = { }, 0
list, l = { }, 0
@@ -1720,7 +1711,7 @@ local function flushnormalobj(data,n)
if level == 0 then
objects[n] = offset
offset = offset + #data
- f:write(data)
+ flush(f,data)
else
if not lastdeferred then
lastdeferred = n
@@ -1763,9 +1754,9 @@ local function flushstreamobj(data,n,dict,comp,nolength)
else
b = dict and f_stream_b_d_u(n,dict,size) or f_stream_b_n_u(n,size)
end
- f:write(b)
- f:write(data)
- f:write(e)
+ flush(f,b)
+ flush(f,data)
+ flush(f,e)
objects[n] = offset
offset = offset + #b + #data + #e
else
@@ -1803,7 +1794,7 @@ local function flushdeferred()
if type(o) == "string" then
objects[n] = offset
offset = offset + #o
- f:write(o)
+ flush(f,o)
end
end
lastdeferred = false
@@ -1922,13 +1913,9 @@ updaters.register("backend.update.pdf",function()
pdf.immediateobj = obj
end)
--- Bah, in lua 5.4 we cannot longer use flush = getmetatable(f).write as efficient
--- flusher due to some change in the metatable definitions (more indirectness) ...
--- so maybe we should introduce our own helper for this as now we get a lookup for
--- each write (and writing isn't already the fastest). A little Lua charm gone as
--- now the memory variant also needs to use this 'object' model. (Ok, the <const>
--- is a new charm but for that to work in our advance I need to patch quite some
--- files.)
+-- In lua 5.4 the methods are now moved one metalevel deeper so we need to get them
+-- from mt.__index instead. (I did get that at first.) It makes for a slightly (imo)
+-- nicer interface but no real gain in speed as we don't flush that often.
local openfile, closefile do
@@ -1942,46 +1929,47 @@ local openfile, closefile do
local f_startxref = formatters["startxref\010%i\010%%%%EOF"]
local inmemory = false
- -- local inmemory = environment.arguments.inmemory
- -- local close = nil
+ local close = false
openfile = function(filename)
if inmemory then
- -- local n = 0
- -- f = { }
- -- flush = function(f,s)
- -- n = n + 1 f[n] = s
- -- end
- -- close = function(f)
- -- f = concat(f)
- -- io.savedata(filename,f)
- -- f = false
- -- end
local n = 0
- f = {
- write = function(self,s)
- n = n + 1 f[n] = s
- end,
- close = function(self)
- f = concat(f)
- io.savedata(filename,f)
- f = false
- end,
- }
+ f = { }
+ flush = function(f,s)
+ n = n + 1 f[n] = s
+ end
+ close = function(f)
+ f = concat(f)
+ io.savedata(filename,f)
+ f = false
+ end
+ -- local n = 0
+ -- f = {
+ -- write = function(self,s)
+ -- n = n + 1 f[n] = s
+ -- end,
+ -- close = function(self)
+ -- f = concat(f)
+ -- io.savedata(filename,f)
+ -- f = false
+ -- end,
+ -- }
else
f = io.open(filename,"wb")
if not f then
-- message
os.exit()
end
- -- flush = getmetatable(f).write
- -- close = getmetatable(f).close
+ -- f:setvbuf("full",64*1024)
+ local m = getmetatable(f)
+ flush = m.write or m.__index.write
+ close = m.close or m.__index.close
end
local v = f_pdf(majorversion,minorversion)
-- local b = "%\xCC\xD5\xC1\xD4\xC5\xD8\xD0\xC4\xC6\010" -- LUATEXPDF (+128)
local b = "%\xC3\xCF\xCE\xD4\xC5\xD8\xD4\xD0\xC4\xC6\010" -- CONTEXTPDF (+128)
- f:write(v)
- f:write(b)
+ flush(f,v)
+ flush(f,b)
offset = #v + #b
end
@@ -2127,20 +2115,20 @@ local openfile, closefile do
local comp = zlibcompress(data,3)
if comp then
data = comp
- f:write(f_stream_b_d_c(nofobjects,xref(),#data))
+ flush(f,f_stream_b_d_c(nofobjects,xref(),#data))
else
- f:write(f_stream_b_d_u(nofobjects,xref(),#data))
+ flush(f,f_stream_b_d_u(nofobjects,xref(),#data))
end
else
- f:write(f_stream_b_d_u(nofobjects,xref(),#data))
+ flush(f,f_stream_b_d_u(nofobjects,xref(),#data))
end
- f:write(data)
- f:write(s_stream_e)
- f:write(f_startxref(xrefoffset))
+ flush(f,data)
+ flush(f,s_stream_e)
+ flush(f,f_startxref(xrefoffset))
else
flushdeferred()
xrefoffset = offset
- f:write(f_xref(nofobjects+1))
+ flush(f,f_xref(nofobjects+1))
local trailer = pdfdictionary {
Size = nofobjects+1,
Root = catalog,
@@ -2160,12 +2148,12 @@ local openfile, closefile do
end
end
objects[0] = f_first(lastfree)
- f:write(concat(objects,"",0,nofobjects))
+ flush(f,concat(objects,"",0,nofobjects))
trailer.Size = nofobjects + 1
if trailerid then
- f:write(f_trailer_id(trailer(),trailerid,trailerid,xrefoffset))
+ flush(f,f_trailer_id(trailer(),trailerid,trailerid,xrefoffset))
else
- f:write(f_trailer_no(trailer(),xrefoffset))
+ flush(f,f_trailer_no(trailer(),xrefoffset))
end
end
end
diff --git a/tex/context/base/mkiv/math-tag.lua b/tex/context/base/mkiv/math-tag.lua
index b758c1ff5..d7aa37a5b 100644
--- a/tex/context/base/mkiv/math-tag.lua
+++ b/tex/context/base/mkiv/math-tag.lua
@@ -58,11 +58,16 @@ local choice_code = nodecodes.choice -- attr display text script s
local fence_code = nodecodes.fence -- attr subtype
local accentcodes = nodes.accentcodes
+local fencecodes = nodes.fencecodes
local fixedtopaccent_code = accentcodes.fixedtop
local fixedbottomaccent_code = accentcodes.fixedbottom
local fixedbothaccent_code = accentcodes.fixedboth
+local leftfence_code = fencecodes.left
+local middlefence_code = fencecodes.middle
+local rightfence_code = fencecodes.right
+
local kerncodes = nodes.kerncodes
local fontkern_code = kerncodes.fontkern
@@ -450,16 +455,16 @@ process = function(start) -- we cannot use the processor as we have no finalizer
process(scriptscript)
end
elseif id == fence_code then
+ local subtype = getsubtype(start)
local delim = getfield(start,"delim")
- local subtype = getfield(start,"subtype")
- if subtype == 1 then
+ if subtype == leftfence_code then
-- left
local properties = { }
insert(fencesstack,properties)
setattr(start,a_tagged,start_tagged("mfenced",properties)) -- needs checking
if delim then
start_tagged("ignore")
- local chr = getfield(delim,"small_char")
+ local chr = getchar(delim)
if chr ~= 0 then
properties.left = chr
end
@@ -467,12 +472,12 @@ process = function(start) -- we cannot use the processor as we have no finalizer
stop_tagged()
end
start_tagged("mrow") -- begin of subsequence
- elseif subtype == 2 then
+ elseif subtype == middlefence_code then
-- middle
if delim then
start_tagged("ignore")
local top = fencesstack[#fencesstack]
- local chr = getfield(delim,"small_char")
+ local chr = getchar(delim)
if chr ~= 0 then
local mid = top.middle
if mid then
@@ -486,7 +491,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer
end
stop_tagged() -- end of subsequence
start_tagged("mrow") -- begin of subsequence
- elseif subtype == 3 then
+ elseif subtype == rightfence_code then
local properties = remove(fencesstack)
if not properties then
report_tags("missing right fence")
@@ -494,7 +499,7 @@ process = function(start) -- we cannot use the processor as we have no finalizer
end
if delim then
start_tagged("ignore")
- local chr = getfield(delim,"small_char")
+ local chr = getchar(delim)
if chr ~= 0 then
properties.right = chr
end
@@ -525,9 +530,9 @@ process = function(start) -- we cannot use the processor as we have no finalizer
stop_tagged()
end
elseif id == accent_code then
+ local subtype = getsubtype(start)
local accent = getfield(start,"accent")
local bot_accent = getfield(start,"bot_accent")
- local subtype = getsubtype(start)
if bot_accent then
if accent then
setattr(start,a_tagged,start_tagged("munderover", {
diff --git a/tex/context/base/mkiv/meta-ini.mkiv b/tex/context/base/mkiv/meta-ini.mkiv
index 88549c34a..fa5aa92c6 100644
--- a/tex/context/base/mkiv/meta-ini.mkiv
+++ b/tex/context/base/mkiv/meta-ini.mkiv
@@ -167,10 +167,10 @@
\appendtoks
\ifcsname\??mpdefinitions\currentMPinstance\endcsname \else
- \expandafter\newtoks\csname\??mpdefinitions\currentMPinstance\endcsname
+ \expandafter\newtoks\csname\??mpdefinitions\currentMPinstance\endcsname
\fi
\ifcsname\??mpinclusions\currentMPinstance\endcsname \else
- \expandafter\newtoks\csname\??mpinclusions\currentMPinstance\endcsname
+ \expandafter\newtoks\csname\??mpinclusions\currentMPinstance\endcsname
\fi
\t_meta_definitions\emptytoks % in case we redefine
\t_meta_inclusions \emptytoks % in case we redefine
@@ -243,7 +243,6 @@
{\ifconditional\c_meta_include_initializations
\the\t_meta_initializations
\fi}
- % \theMPrandomseed;}
\def\meta_flush_current_inclusions
{\the\t_meta_inclusions}
@@ -443,7 +442,7 @@
height \d_overlay_height
\relax}
-%D Since we want lables to follow the document settings, we also set the font
+%D Since we want labels to follow the document settings, we also set the font
%D related variables.
\unexpanded\def\MPfontsizehskip#1%
@@ -609,7 +608,11 @@
%D \defineoverlay[example][\uniqueMPgraphic{test}]
%D
%D \startuniqueMPgraphic {test}
-%D draw unitsquare xscaled \overlaywidth yscaled \overlayheight ;
+%D draw OverlayBox ;
+%D \stopuniqueMPgraphic
+%D
+%D \startuniqueMPgraphic {test}
+%D draw OverlayBox ;
%D \stopuniqueMPgraphic
%D \stoptyping
@@ -660,10 +663,10 @@
\kern\MPllx\raise\MPlly\box\b_meta_graphic
\egroup}
-\unexpanded\def\obeyMPboxdepth {\let\meta_relocate_box\meta_obey_box_depth }
+\unexpanded\def\obeyMPboxdepth {\let\meta_relocate_box\meta_obey_box_depth}
\unexpanded\def\ignoreMPboxdepth{\let\meta_relocate_box\meta_ignore_box_depth}
-\unexpanded\def\obeyMPboxorigin {\let\meta_relocate_box\meta_obey_box_origin }
-\unexpanded\def\normalMPboxdepth{\let\meta_relocate_box\relax }
+\unexpanded\def\obeyMPboxorigin {\let\meta_relocate_box\meta_obey_box_origin}
+\unexpanded\def\normalMPboxdepth{\let\meta_relocate_box\relax}
\let\meta_relocate_box\relax
@@ -696,20 +699,19 @@
\unexpanded\def\startuniqueMPgraphic
{\dodoublegroupempty\meta_start_unique_graphic}
+\let\stopuniqueMPgraphic\relax
+
\def\meta_start_unique_graphic#1%
{\normalexpanded{\meta_start_unique_graphic_indeed{#1}}}
\unexpanded\def\meta_start_unique_graphic_indeed#1#2#3\stopuniqueMPgraphic
{\setgvalue{\??mpgraphic#1}{\meta_handle_unique_graphic{#1}{#2}{#3}}}
-\let\stopuniqueMPgraphic\relax
-
\unexpanded\def\uniqueMPgraphic
{\dodoublegroupempty\meta_unique_graphic}
\def\meta_unique_graphic#1#2%
{\meta_begin_graphic_group{#1}%
-% \setupMPvariables[\currentMPgraphicname][#2]%
\setupMPvariables[#1][#2]%
\csname\??mpgraphic#1\endcsname\empty
\meta_end_graphic_group}
@@ -728,6 +730,8 @@
\unexpanded\def\startuseMPgraphic
{\dodoublegroupempty\meta_start_use_graphic}
+\let\stopuseMPgraphic\relax
+
% \def\meta_start_use_graphic#1#2#3\stopuseMPgraphic
% {\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}
%
@@ -746,13 +750,10 @@
\unexpanded\def\meta_start_use_graphic_indeed#1#2#3\stopuseMPgraphic
{\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}
-\let\stopuseMPgraphic\relax
-
\unexpanded\def\startusableMPgraphic % redundant but handy
{\dodoublegroupempty\meta_start_usable_graphic}
-% \def\meta_start_usable_graphic#1#2#3\stopusableMPgraphic
-% {\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}
+\let\stopusableMPgraphic\relax
\def\meta_start_usable_graphic#1%
{\normalexpanded{\meta_start_usable_graphic_indeed{#1}}}
@@ -760,8 +761,6 @@
\unexpanded\def\meta_start_usable_graphic_indeed#1#2#3\stopusableMPgraphic
{\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}
-\let\stopusableMPgraphic\relax
-
\def\meta_handle_reusable_graphic#1#2#3%
{\begingroup
\edef\currentmpvariableclass{#1}%
@@ -779,8 +778,7 @@
\unexpanded\def\startreusableMPgraphic
{\dodoublegroupempty\meta_start_reusable_graphic}
-% \def\meta_start_reusable_graphic#1#2#3\stopreusableMPgraphic
-% {\setgvalue{\??mpgraphic#1}{\meta_handle_reusable_graphic{#1}{#2}{#3}}}
+\let\stopreusableMPgraphic\relax
\def\meta_start_reusable_graphic#1%
{\normalexpanded{\meta_start_reusable_graphic_indeed{#1}}}
@@ -788,18 +786,9 @@
\unexpanded\def\meta_start_reusable_graphic_indeed#1#2#3\stopreusableMPgraphic
{\setgvalue{\??mpgraphic#1}{\meta_handle_reusable_graphic{#1}{#2}{#3}}}
-\let\stopreusableMPgraphic\relax
-
\unexpanded\def\useMPgraphic
{\dodoublegroupempty\meta_use_graphic}
-% \def\meta_use_graphic#1#2%
-% {\meta_begin_graphic_group{#1}%
-% %\doifsomething{#2}{\setupMPvariables[\currentMPgraphicname][#2]}%
-% \doifsomething{#2}{\setupMPvariables[#1][#2]}%
-% \csname\??mpgraphic#1\endcsname\empty
-% \meta_end_graphic_group}
-
\def\meta_use_graphic#1#2%
{\meta_begin_graphic_group{#1}%
\ifcsname\??mpgraphic#1\endcsname
@@ -827,9 +816,6 @@
\def\m_meta_page_prefix{\doifelseoddpage oe}
-% \def\overlaypagestamp
-% {\m_meta_page_prefix:\overlaywidth:\overlayheight:\overlaydepth:\MPcolor\overlaycolor:\MPcolor\overlaylinecolor}
-
\def\overlaypagestamp
{\m_meta_page_prefix :%
\the\d_overlay_width :%
@@ -843,9 +829,7 @@
\unexpanded\def\startuniqueMPpagegraphic
{\dodoublegroupempty\meta_start_unique_page_graphic}
-% \def\meta_start_unique_page_graphic#1#2#3\stopuniqueMPpagegraphic % inefficient, double storage
-% {\setgvalue{\??mpgraphic o:#1}{\meta_handle_unique_graphic{o:#1}{#2}{#3}}% % but these also keep the state
-% \setgvalue{\??mpgraphic e:#1}{\meta_handle_unique_graphic{e:#1}{#2}{#3}}} % and meaning will be redefined
+\let\stopuniqueMPpagegraphic\relax
\def\meta_start_unique_page_graphic#1%
{\normalexpanded{\meta_start_unique_page_graphic_indeed{#1}}}
@@ -854,15 +838,12 @@
{\setgvalue{\??mpgraphic o:#1}{\meta_handle_unique_graphic{o:#1}{#2}{#3}}% % but these also keep the state
\setgvalue{\??mpgraphic e:#1}{\meta_handle_unique_graphic{e:#1}{#2}{#3}}} % and meaning will be redefined
-\let\stopuniqueMPpagegraphic\relax
-
\unexpanded\def\uniqueMPpagegraphic
{\dodoublegroupempty\meta_unique_page_graphic}
\def\meta_unique_page_graphic#1#2%
{\meta_begin_graphic_group{#1}%
\let\overlaystamp\overlaypagestamp
-% \setupMPvariables[\m_meta_page_prefix:\currentMPgraphicname][#2]% prefix is new here
\setupMPvariables[\m_meta_page_prefix:#1][#2]% prefix is new here
\csname\??mpgraphic\m_meta_page_prefix:#1\endcsname\empty
\meta_end_graphic_group}
@@ -959,6 +940,8 @@
\unexpanded\def\startMPcode
{\dosinglegroupempty\meta_start_code}
+\let\stopMPcode\relax
+
\def\meta_start_code
{\iffirstargument
\expandafter\meta_start_code_instance
@@ -983,8 +966,6 @@
\meta_process_graphic{#2}%
\endgroup}
-\let\stopMPcode\relax
-
\unexpanded\def\MPcode
{\dodoublegroupempty\meta_code}
@@ -1430,6 +1411,8 @@
\setbox\nextbox\hpack\bgroup
\dosinglegroupempty\meta_start_calculation}
+\let\stopMPcalculation\relax
+
\def\meta_start_calculation
{\iffirstargument
\expandafter\meta_start_calculation_instance
@@ -1454,8 +1437,6 @@
\egroup
\endgroup}
-\let\stopMPcalculation\relax
-
%D \macros
%D {setupMPgraphics}
%D
diff --git a/tex/context/base/mkiv/meta-ini.mkxl b/tex/context/base/mkiv/meta-ini.mkxl
index 47a137616..31117420c 100644
--- a/tex/context/base/mkiv/meta-ini.mkxl
+++ b/tex/context/base/mkiv/meta-ini.mkxl
@@ -595,7 +595,11 @@
%D \defineoverlay[example][\uniqueMPgraphic{test}]
%D
%D \startuniqueMPgraphic {test}
-%D draw unitsquare xscaled \overlaywidth yscaled \overlayheight ;
+%D draw OverlayBox ;
+%D \stopuniqueMPgraphic
+%D
+%D \startuniqueMPgraphic {test}
+%D draw OverlayBox ;
%D \stopuniqueMPgraphic
%D \stoptyping
@@ -682,21 +686,21 @@
\unexpanded\def\startuniqueMPgraphic
{\dodoublegroupempty\meta_start_unique_graphic}
+\let\stopuniqueMPgraphic\relax
+
\def\meta_start_unique_graphic#1%
{\normalexpanded{\meta_start_unique_graphic_indeed{#1}}}
\unexpanded\def\meta_start_unique_graphic_indeed#1#2#3\stopuniqueMPgraphic
{\setgvalue{\??mpgraphic#1}{\meta_handle_unique_graphic{#1}{#2}{#3}}}
-\let\stopuniqueMPgraphic\relax
-
\unexpanded\def\uniqueMPgraphic
{\dodoublegroupempty\meta_unique_graphic}
\def\meta_unique_graphic#1#2%
{\meta_begin_graphic_group{#1}%
\setupMPvariables[#1][#2]%
- \csname\??mpgraphic#1\endcsname\empty
+ \begincsname\??mpgraphic#1\endcsname\empty
\meta_end_graphic_group}
\def\meta_handle_use_graphic#1#2#3%
@@ -713,17 +717,18 @@
\unexpanded\def\startuseMPgraphic
{\dodoublegroupempty\meta_start_use_graphic}
+\let\stopuseMPgraphic\relax
+
\def\meta_start_use_graphic#1%
{\normalexpanded{\meta_start_use_graphic_indeed{#1}}}
\unexpanded\def\meta_start_use_graphic_indeed#1#2#3\stopuseMPgraphic
{\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}
-\let\stopuseMPgraphic\relax
-
\unexpanded\def\startusableMPgraphic % redundant but handy
{\dodoublegroupempty\meta_start_usable_graphic}
+\let\stopusableMPgraphic\relax
\def\meta_start_usable_graphic#1%
{\normalexpanded{\meta_start_usable_graphic_indeed{#1}}}
@@ -731,8 +736,6 @@
\unexpanded\def\meta_start_usable_graphic_indeed#1#2#3\stopusableMPgraphic
{\setgvalue{\??mpgraphic#1}{\meta_handle_use_graphic{#1}{#2}{#3}}}
-\let\stopusableMPgraphic\relax
-
\def\meta_handle_reusable_graphic#1#2#3%
{\begingroup
\edef\currentmpvariableclass{#1}%
@@ -750,14 +753,14 @@
\unexpanded\def\startreusableMPgraphic
{\dodoublegroupempty\meta_start_reusable_graphic}
+\let\stopreusableMPgraphic\relax
+
\def\meta_start_reusable_graphic#1%
{\normalexpanded{\meta_start_reusable_graphic_indeed{#1}}}
\unexpanded\def\meta_start_reusable_graphic_indeed#1#2#3\stopreusableMPgraphic
{\setgvalue{\??mpgraphic#1}{\meta_handle_reusable_graphic{#1}{#2}{#3}}}
-\let\stopreusableMPgraphic\relax
-
\unexpanded\def\useMPgraphic
{\dodoublegroupempty\meta_use_graphic}
@@ -765,11 +768,11 @@
{\meta_begin_graphic_group{#1}%
\ifcsname\??mpgraphic#1\endcsname
\edef\usedMPgraphicname{#1}%
- \else\ifcsname\??mpgraphic\currentMPgraphicname\endcsname
+ \orelse\ifcsname\??mpgraphic\currentMPgraphicname\endcsname
\let\usedMPgraphicname\currentMPgraphicname
\else
\let\usedMPgraphicname\empty
- \fi\fi
+ \fi
\ifx\usedMPgraphicname\empty
% message
\else
@@ -801,6 +804,8 @@
\unexpanded\def\startuniqueMPpagegraphic
{\dodoublegroupempty\meta_start_unique_page_graphic}
+\let\stopuniqueMPpagegraphic\relax
+
\def\meta_start_unique_page_graphic#1%
{\normalexpanded{\meta_start_unique_page_graphic_indeed{#1}}}
@@ -808,8 +813,6 @@
{\setgvalue{\??mpgraphic o:#1}{\meta_handle_unique_graphic{o:#1}{#2}{#3}}% % but these also keep the state
\setgvalue{\??mpgraphic e:#1}{\meta_handle_unique_graphic{e:#1}{#2}{#3}}} % and meaning will be redefined
-\let\stopuniqueMPpagegraphic\relax
-
\unexpanded\def\uniqueMPpagegraphic
{\dodoublegroupempty\meta_unique_page_graphic}
@@ -912,6 +915,8 @@
\unexpanded\def\startMPcode
{\dosinglegroupempty\meta_start_code}
+\let\stopMPcode\relax
+
\def\meta_start_code
{\iffirstargument
\expandafter\meta_start_code_instance
@@ -936,8 +941,6 @@
\meta_process_graphic{#2}%
\endgroup}
-\let\stopMPcode\relax
-
\unexpanded\def\MPcode
{\dodoublegroupempty\meta_code}
@@ -1383,6 +1386,8 @@
\setbox\nextbox\hpack\bgroup
\dosinglegroupempty\meta_start_calculation}
+\let\stopMPcalculation\relax
+
\def\meta_start_calculation
{\iffirstargument
\expandafter\meta_start_calculation_instance
@@ -1407,8 +1412,6 @@
\egroup
\endgroup}
-\let\stopMPcalculation\relax
-
%D \macros
%D {setupMPgraphics}
%D
diff --git a/tex/context/base/mkiv/node-ltp.lua b/tex/context/base/mkiv/node-ltp.lua
index 1ced3a998..0b2790cc7 100644
--- a/tex/context/base/mkiv/node-ltp.lua
+++ b/tex/context/base/mkiv/node-ltp.lua
@@ -157,7 +157,6 @@ local texget = tex.get
local texset = tex.set
local texgetglue = tex.getglue
-
-- (t == 0 and 0) or (s <= 0 and 10000) or calculate_badness(t,s)
-- local function calculate_badness(t,s)
@@ -215,6 +214,12 @@ local getwidth = nuts.getwidth
local getheight = nuts.getheight
local getdepth = nuts.getdepth
local getdata = nuts.getdata
+local getreplace = nuts.getreplace
+local setreplace = nuts.setreplace
+local getpost = nuts.getpost
+local setpost = nuts.setpost
+local getpre = nuts.getpre
+local setpre = nuts.setpre
local isglyph = nuts.isglyph
@@ -1270,8 +1275,8 @@ do
report_parbuilders('unsupported disc at location %a',4)
end
setsubtype(nextlast,regulardisc_code)
- setfield(nextlast,"replace",post)
- setfield(lastnode,"post") -- nil
+ setreplace(nextlast,post)
+ setpost(lastnode)
end
if replace then
flush_node_list(replace)
@@ -1950,8 +1955,8 @@ par.right_skip = nil
local id = getid(l)
if id == glyph_code then
-- ok ?
- elseif id == disc_code and getfield(l,"post") then
- l = getfield(l,"post") -- TODO: first char could be a disc
+ elseif id == disc_code and getpost(l) then
+ l = getpost(l) -- TODO: first char could be a disc
else
l = find_protchar_left(l)
end
@@ -2306,7 +2311,7 @@ par.right_skip = nil
if getid(cur_p_next) ~= disc_code or getsubtype(cur_p_next) ~= seconddisc_code then
report_parbuilders("unsupported disc at location %a",1)
else
- local pre = getfield(cur_p_next,"pre")
+ local pre = getpre(cur_p_next)
if pre then
local size, adjust_stretch, adjust_shrink = add_to_width(line_break_dir,checked_expansion,pre)
disc_width.size = disc_width.size + size
@@ -2903,7 +2908,7 @@ do
local subtype = getsubtype(current)
if subtype ~= seconddisc_code then
-- todo : local stretch, shrink = char_stretch_shrink(s)
- local replace = getfield(current,"replace")
+ local replace = getreplace(current)
if replace then
process(replace)
end
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index 158f74a98..6c4b034c9 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -408,13 +408,13 @@ if not nuts.getpre then
local d_getdisc = direct.getdisc
local d_setfield = direct.setfield
- function nuts.getpre(d) local h, _, _, t, _, _ = d_getdisc(d,true) return h, t end
- function nuts.getpost(d) local _, h, _, _, t, _ = d_getdisc(d,true) return h, t end
- function nuts.getreplace(d) local _, _, h, _, _, t = d_getdisc(d,true) return h, t end
+ function nuts.getpre (n) local h, _, _, t, _, _ = d_getdisc(n,true) return h, t end
+ function nuts.getpost (n) local _, h, _, _, t, _ = d_getdisc(n,true) return h, t end
+ function nuts.getreplace(n) local _, _, h, _, _, t = d_getdisc(n,true) return h, t end
- function nuts.setpre(d,n) d_setfield("pre", n) end
- function nuts.setpost(d,n) d_setfield("post", n) end
- function nuts.setreplace(d,n) d_setfield("replace",n) end
+ function nuts.setpre (n,h) d_setfield(d,"pre", h) end
+ function nuts.setpost (n,h) d_setfield(d,"post", h) end
+ function nuts.setreplace(n,h) d_setfield(d,"replace",h) end
end
diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv
index 8de68f248..e85891680 100644
--- a/tex/context/base/mkiv/pack-rul.mkiv
+++ b/tex/context/base/mkiv/pack-rul.mkiv
@@ -87,6 +87,7 @@
\unexpanded\def\doinstallinheritedframed#1#2#3#4#5#6#7#8#9%
{\def#5##1##2{\ifx##1\relax#6{##2}\else#4{##1}{##2}\fi}%
%\def#6##1{\ifcsname\??framed:##1\endcsname\??framed:##1\else\s!empty\fi}% root
+ %\def#6##1{\ifcsname\??framed:##1\endcsname\??framed:##1\else\??empty\fi}% root
\def#6##1{\ifcsname\??framed:##1\endcsname\??framed:##1\else\??empty\fi}% root
\unexpanded\def#8%
{\bgroup
diff --git a/tex/context/base/mkiv/pack-rul.mkxl b/tex/context/base/mkiv/pack-rul.mkxl
index c913977c7..d2818b4df 100644
--- a/tex/context/base/mkiv/pack-rul.mkxl
+++ b/tex/context/base/mkiv/pack-rul.mkxl
@@ -426,7 +426,7 @@
\let\m_overlay_region\empty
-% expandable ... in a future version the space will go (in my one can use Overlay*)
+% expandable ... in a future version the space will go (in mp one can use Overlay*)
\def\overlaywidth {\the\d_overlay_width \space} % We preset the variables
\def\overlayheight {\the\d_overlay_height \space} % to some reasonable default
diff --git a/tex/context/base/mkiv/spac-prf.lua b/tex/context/base/mkiv/spac-prf.lua
index 32582c56f..049e62ac5 100644
--- a/tex/context/base/mkiv/spac-prf.lua
+++ b/tex/context/base/mkiv/spac-prf.lua
@@ -45,7 +45,7 @@ local nuts = nodes.nuts
local tonut = nodes.tonut
local tonode = nuts.tonode
-local getfield = nuts.getfield
+local getreplace = nuts.getreplace
local getattr = nuts.getattr
local getid = nuts.getid
local getnext = nuts.getnext
@@ -185,7 +185,7 @@ local function getprofile(line,step)
dp = 0
progress()
elseif id == disc_code then
- local replace = getfield(current,"replace")
+ local replace = getreplace(current)
if replace then
process(replace)
end
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 48fe54d39..bb3bed49a 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 1a046e57a..1a4c6ffb3 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/supp-box.lua b/tex/context/base/mkiv/supp-box.lua
index d957376d0..0469369a9 100644
--- a/tex/context/base/mkiv/supp-box.lua
+++ b/tex/context/base/mkiv/supp-box.lua
@@ -386,13 +386,13 @@ local function getnaturaldimensions(n)
return w, h, d
end
-interfaces.implement {
+implement {
name = "getnaturaldimensions",
arguments = "integer",
actions = getnaturaldimensions
}
-interfaces.implement {
+implement {
name = "naturalwd",
arguments = "integer",
actions = function(n)
@@ -401,7 +401,7 @@ interfaces.implement {
end
}
-interfaces.implement {
+implement {
name = "getnaturalwd",
arguments = "integer",
actions = function(n)
@@ -424,7 +424,7 @@ local function setboxtonaturalwd(n)
setbox(n,new)
end
-interfaces.implement {
+implement {
name = "setnaturalwd",
arguments = "integer",
actions = setboxtonaturalwd
@@ -458,7 +458,7 @@ do
nodes.firstdirinbox = firstdirinbox
- interfaces.implement {
+ implement {
name = "doifelserighttoleftinbox",
arguments = "integer",
actions = function(n)
@@ -805,7 +805,7 @@ local function limitate(t)
return tonode(result)
end
-interfaces.implement {
+implement {
name = "limitated",
public = true,
protected = true,
diff --git a/tex/context/base/mkiv/typo-chr.lua b/tex/context/base/mkiv/typo-chr.lua
index 15d14c860..dd3071e4f 100644
--- a/tex/context/base/mkiv/typo-chr.lua
+++ b/tex/context/base/mkiv/typo-chr.lua
@@ -284,6 +284,8 @@ interfaces.implement {
-- end,
-- }
+-- not needed in lmtx ...
+
interfaces.implement {
name = "lastnodeid",
actions = function()
diff --git a/tex/context/base/mkiv/typo-ovl.lua b/tex/context/base/mkiv/typo-ovl.lua
index 6f836551d..25b1a0178 100644
--- a/tex/context/base/mkiv/typo-ovl.lua
+++ b/tex/context/base/mkiv/typo-ovl.lua
@@ -34,6 +34,8 @@ local setattrlist = nuts.setattrlist
local getfield = nuts.getfield
local setfont = nuts.setfont
+local nextnode = nuts.traversers.node
+
local unsetvalue = attributes.unsetvalue
local prvattribute = attributes.private
@@ -90,9 +92,9 @@ end
attributes.tooverloads = tooverloads
function attributes.applyoverloads(specification,start,stop)
- local current = tonut(start)
+ local start = tonut(start)
local processor = specification.processor
- local overloads = specification.processor or getattr(current,a_overloads)
+ local overloads = specification.processor or getattr(start,a_overloads)
if overloads and overloads ~= unsetvalue then
overloads = t_overloads[overloads]
if not overloads then
@@ -107,7 +109,7 @@ function attributes.applyoverloads(specification,start,stop)
local newlist = nil
local newfont = overloads.font
- local function apply()
+ local function apply(current)
local a = getattrlist(current)
if a == oldlist then
setattrlist(current,newlist)
@@ -127,12 +129,11 @@ function attributes.applyoverloads(specification,start,stop)
end
end
- while current do
- local id = getid(current)
+ for current, id in nextnode, start do
if id == glyph_code then
- apply()
+ apply(current)
elseif id == disc_code then
- apply()
+ apply(current)
if pre then
while pre do
if getid(pre) == glyph_code then
@@ -161,7 +162,6 @@ function attributes.applyoverloads(specification,start,stop)
if current == last then
break
end
- current = getnext(current)
end
end
diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua
index 92e17b550..432b39ec5 100644
--- a/tex/context/base/mkiv/util-str.lua
+++ b/tex/context/base/mkiv/util-str.lua
@@ -633,7 +633,7 @@ local environment = {
stripzeros = patterns.stripzeros,
escapedquotes = string.escapedquotes,
- FORMAT = string.f9,
+ FORMAT = string.f6,
}
-- -- --
@@ -938,13 +938,30 @@ end
-- end
-- end
-local format_N = function(f) -- strips leading and trailing zeros
- n = n + 1
- -- stripzero (singular) as we only have a number
- if not f or f == "" then
- f = ".9"
- end -- always a leading number !
- return format("(((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripzero,format('%%%sf',a%s)))",n,n,f,n)
+local format_N if environment.FORMAT then
+
+ format_N = function(f)
+ n = n + 1
+ if not f or f == "" then
+ return format("FORMAT(a%s,'%%.9f')",n)
+ elseif f == ".6" then
+ return format("FORMAT(a%s)",n)
+ else
+ return format("FORMAT(a%s,'%%%sf')",n,f)
+ end
+ end
+
+else
+
+ format_N = function(f) -- strips leading and trailing zeros
+ n = n + 1
+ -- stripzero (singular) as we only have a number
+ if not f or f == "" then
+ f = ".9"
+ end -- always a leading number !
+ return format("(((a%s %% 1 == 0) and format('%%i',a%s)) or lpegmatch(stripzero,format('%%%sf',a%s)))",n,n,f,n)
+ end
+
end
local format_a = function(f)
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index fa852c437..1db2bc0f7 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 583dec8ee..32cb31641 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/x-setups-basics.mkiv b/tex/context/modules/mkiv/x-setups-basics.mkiv
index 51c925397..4e960f428 100644
--- a/tex/context/modules/mkiv/x-setups-basics.mkiv
+++ b/tex/context/modules/mkiv/x-setups-basics.mkiv
@@ -15,7 +15,6 @@
%D We can make this module a bit cleaner using more recent features or we go \LUA\
%D completely but as this style evolved over 15 years it's a waste of time.
%D
-%D
%D Thanks to Wolfgang these descriptions have become quite complete! In the process
%D of covering more commands and expecially different instances of the same command,
%D either or not generated, the supporting macros became more complex. I must admit
@@ -32,6 +31,9 @@
%D
%D Currently we load the \XML\ file and when not in the english interface we just
%D remap the relevant words to their translation.
+%D
+%D If you notice something that needs fixing, you can send a message to the mailing
+%D list.
%D \startbuffer
%D \usemodule[x-setups-basics]
diff --git a/tex/context/modules/mkiv/x-setups-overview.mkiv b/tex/context/modules/mkiv/x-setups-overview.mkiv
index 512db3bd1..f293c13b7 100644
--- a/tex/context/modules/mkiv/x-setups-overview.mkiv
+++ b/tex/context/modules/mkiv/x-setups-overview.mkiv
@@ -99,7 +99,7 @@
[\hbox to \paperwidth{\reuseMPgraphic{cover+back}\hss}]
\startreusableMPgraphic{cover+back}
- numeric h, w; boolean mapping ; path p, q, r ; color f, d ; pair s ;
+ numeric h, w; boolean mapping ; path p, q, r ; color f, d , c ; pair s ;
h := OverlayHeight ; w := 2*OverlayWidth ;
r := unitsquare xyscaled (w,h) ;
fill r withcolor resolvedcolor("lightgray") ;
@@ -115,8 +115,9 @@
forever :
s := center r randomized (w,h) ;
if new_on_grid(xpart s, ypart s) :
- d := .5[resolvedcolor("LocalColor"),resolvedcolor("lightgray")] randomized (.5,.9) ;
- f := resolvedcolor("lightgray") randomized (.5,.9) ;
+ c := resolvedcolor("lightgray") ;
+ d := .5[resolvedcolor("LocalColor"),c] randomized (.5,.9) ;
+ f := c randomized (.5,.9) ;
s := (dx,dy) ;
if mapping :
p := (-w/4,0) -- (w/4,0) ;
@@ -139,6 +140,7 @@
fi ;
exitif grid_full ;
endfor ;
+
setbounds currentpicture to r ;
\stopreusableMPgraphic
@@ -248,16 +250,25 @@
\startmakeup[\v!standard]
\dontcomplain
\startcolor[TitleColor]
- \definedfont[RegularBold at 100pt]\setstrut
- \setupalign[\v!left]
- \strut Con\TeX t \par
- \definedfont[RegularBold at 50pt]\setstrut
- \setups[text:commands]
- \vfill
- \definedfont[RegularBold at 24pt]\setupinterlinespace
- \setups[text:lowercase]
- \par \strut \currentdate \par
+ \definedfont[RegularBold at 100pt]\setstrut
+ \setupalign[\v!flushright]
+ \strut Con\TeX t \par
+ \definedfont[RegularBold at 50pt]\setstrut
+ \setups[text:commands]
\stopcolor
+ \vfill
+ \start
+ \switchtobodyfont[big,15pt]
+ \setuptabulate[before=,after=]
+ \dontleavehmode \hfill \hbox \bgroup
+ \starttabulate[|l|l|]
+ \BC language \EQ \setups[text:lowercase] \NC \NR
+ \BC version \EQ \currentdate \NC \NR
+ \BC maintainer \EQ Wolfgang Schuster \NC\NR
+ \BC comments \EQ \tt ntg-context@ntg.nl \NC \NR
+ \stoptabulate
+ \egroup
+ \stop
\stopmakeup
\protect