summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-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/context.mkxl2
-rw-r--r--tex/context/base/mkiv/data-tre.lua52
-rw-r--r--tex/context/base/mkiv/driv-ini.lua9
-rw-r--r--tex/context/base/mkiv/font-mps.lua37
-rw-r--r--tex/context/base/mkiv/font-shp.lua12
-rw-r--r--tex/context/base/mkiv/grph-rul.lua22
-rw-r--r--tex/context/base/mkiv/lpdf-ano.lua32
-rw-r--r--tex/context/base/mkiv/lpdf-col.lua31
-rw-r--r--tex/context/base/mkiv/lpdf-emb.lua8
-rw-r--r--tex/context/base/mkiv/lpdf-grp.lua11
-rw-r--r--tex/context/base/mkiv/lpdf-lmt.lua36
-rw-r--r--tex/context/base/mkiv/lpdf-mis.lua6
-rw-r--r--tex/context/base/mkiv/lpdf-swf.lua6
-rw-r--r--tex/context/base/mkiv/lpdf-u3d.lua6
-rw-r--r--tex/context/base/mkiv/meta-blb.lua6
-rw-r--r--tex/context/base/mkiv/meta-pdf.lua9
-rw-r--r--tex/context/base/mkiv/mlib-cnt.lua1
-rw-r--r--tex/context/base/mkiv/mlib-pdf.lua29
-rw-r--r--tex/context/base/mkiv/mlib-pps.lua45
-rw-r--r--tex/context/base/mkiv/mlib-svg.lua24
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26771 -> 26724 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin269733 -> 269636 bytes
-rw-r--r--tex/context/base/mkiv/strc-doc.lua4
-rw-r--r--tex/context/base/mkiv/syst-lua.lua242
-rw-r--r--tex/context/base/mkiv/syst-lua.mkiv37
-rw-r--r--tex/context/base/mkiv/syst-lua.mkxl37
-rw-r--r--tex/context/base/mkiv/util-str.lua2
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin894085 -> 930546 bytes
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin61165 -> 25081 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua4
34 files changed, 466 insertions, 252 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 4f1498f2d..20cc26b93 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{2020.01.13 14:52}
+\newcontextversion{2020.01.15 19:09}
%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 9454bd5cd..87441059d 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{2020.01.13 14:52}
+\edef\contextversion{2020.01.15 19:09}
%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 775d624a8..ce1abd040 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{2020.01.13 14:52}
+\newcontextversion{2020.01.15 19:09}
%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 95e6a2637..f75556d26 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{2020.01.13 14:52}
+\edef\contextversion{2020.01.15 19:09}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index f25c9b508..c3954baee 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{2020.01.13 14:52}
+\edef\contextversion{2020.01.15 19:09}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/data-tre.lua b/tex/context/base/mkiv/data-tre.lua
index da3d1f14f..8958dfbea 100644
--- a/tex/context/base/mkiv/data-tre.lua
+++ b/tex/context/base/mkiv/data-tre.lua
@@ -23,8 +23,9 @@ if not modules then modules = { } end modules ['data-tre'] = {
-- dirlist://///storage-2/resources/mb-mp/**/drawing.jpg
-- dirlist://e:/**/drawing.jpg
+local type = type
local find, gsub, lower = string.find, string.gsub, string.lower
-local basename, dirname, joinname = file.basename, file.dirname, file .join
+local basename, dirname, joinname = file.basename, file.dirname, file.join
local globdir, isdir, isfile = dir.glob, lfs.isdir, lfs.isfile
local P, lpegmatch = lpeg.P, lpeg.match
@@ -281,3 +282,52 @@ end
-- print(resolvers.findtexfile("tree://e:/temporary/mb-mp/**/VB_wmf_03_vw_01d_ant.jpg"))
-- print(resolvers.findtexfile("tree://t:/**/tufte.tex"))
-- print(resolvers.findtexfile("dirlist://e:/temporary/mb-mp/**/VB_wmf_03_vw_01d_ant.jpg"))
+
+
+do
+
+ local hashfile = "dirhash.lua"
+ local kind = "HASH256"
+ local version = 1.0
+
+ local loadtable = table.load
+ local savetable = table.save
+ local loaddata = io.loaddata
+
+ function resolvers.dirstatus(patterns)
+ local t = type(patterns)
+ if t == "string" then
+ patterns = { patterns }
+ elseif t ~= "table" then
+ return false
+ end
+ local status = loadtable(hashfile)
+ if not status or status.version ~= version or status.kind ~= kind then
+ status = {
+ version = 1.0,
+ kind = kind,
+ hashes = { },
+ }
+ end
+ local hashes = status.hashes
+ local changed = { }
+ local action = sha2[kind]
+ local update = { }
+ for i=1,#patterns do
+ local pattern = patterns[i]
+ local files = globdir(pattern)
+ for i=1,#files do
+ local name = files[i]
+ local hash = action(loaddata(name))
+ if hashes[name] ~= hash then
+ changed[#changed+1] = name
+ end
+ update[name] = hash
+ end
+ end
+ status.hashes = update
+ savetable(hashfile,status)
+ return #changed > 0 and changed or false
+ end
+
+end
diff --git a/tex/context/base/mkiv/driv-ini.lua b/tex/context/base/mkiv/driv-ini.lua
index a19ebb359..316613b21 100644
--- a/tex/context/base/mkiv/driv-ini.lua
+++ b/tex/context/base/mkiv/driv-ini.lua
@@ -232,13 +232,8 @@ drivers.enable("default")
-- helpers
local s_matrix_0 = "1 0 0 1"
-local f_matrix_2 = formatters["%.6F 0 0 %.6F"]
-local f_matrix_4 = formatters["%.6F %.6F %.6F %.6F"]
-
-directives.register("pdf.stripzeros",function()
- f_matrix_2 = formatters["%.6N 0 0 %.6N"]
- f_matrix_4 = formatters["%.6N %.6N %.6N %.6N"]
-end)
+local f_matrix_2 = formatters["%.6N 0 0 %.6N"]
+local f_matrix_4 = formatters["%.6N %.6N %.6N %.6N"]
function helpers.tomatrix(rx,sx,sy,ry,tx,ty) -- todo: tx ty
if type(rx) == "string" then
diff --git a/tex/context/base/mkiv/font-mps.lua b/tex/context/base/mkiv/font-mps.lua
index d5bacaff5..8bfe23b89 100644
--- a/tex/context/base/mkiv/font-mps.lua
+++ b/tex/context/base/mkiv/font-mps.lua
@@ -22,9 +22,9 @@ fonts = fonts or { }
local metapost = fonts.metapost or { }
fonts.metapost = metapost
-local f_moveto = formatters["(%.6F,%.6F)"]
-local f_lineto = formatters["--(%.6F,%.6F)"]
-local f_curveto = formatters["..controls(%.6F,%.6F)and(%.6F,%.6F)..(%.6F,%.6F)"]
+local f_moveto = formatters["(%N,%N)"]
+local f_lineto = formatters["--(%N,%N)"]
+local f_curveto = formatters["..controls(%N,%N)and(%N,%N)..(%N,%N)"]
local s_cycle = "--cycle"
local f_nofill = formatters["nofill %s;"]
@@ -33,19 +33,8 @@ local f_dofill = formatters["fill %s;"]
local f_draw_trace = formatters["drawpathonly %s;"]
local f_draw = formatters["draw %s;"]
-local f_boundingbox = formatters["((%.6F,%.6F)--(%.6F,%.6F)--(%.6F,%.6F)--(%.6F,%.6F)--cycle)"]
-local f_vertical = formatters["((%.6F,%.6F)--(%.6F,%.6F))"]
-
-directives.register("metapost.stripzeros", function()
-
- f_moveto = formatters["(%.6N,%.6N)"]
- f_lineto = formatters["--(%.6N,%.6N)"]
- f_curveto = formatters["..controls(%.6N,%.6N)and(%.6N,%.6N)..(%.6N,%.6N)"]
-
- f_boundingbox = formatters["((%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--cycle)"]
- f_vertical = formatters["((%.6N,%.6N)--(%.6N,%.6N))"]
-
-end)
+local f_boundingbox = formatters["((%N,%N)--(%N,%N)--(%N,%N)--(%N,%N)--cycle)"]
+local f_vertical = formatters["((%N,%N)--(%N,%N))"]
function metapost.boundingbox(d,factor)
local bounds = d.boundingbox
@@ -297,19 +286,13 @@ local parameters = fonts.hashes.parameters
local shapes = fonts.hashes.shapes
local topaths = metapost.paths
-local f_code = formatters["mfun_do_outline_text_flush(%q,%i,%.6F,%.6F,%q)(%,t);"]
-local f_rule = formatters["mfun_do_outline_rule_flush(%q,%.6F,%.6F,%.6F,%.6F);"]
-local f_bounds = formatters["checkbounds(%.6F,%.6F,%.6F,%.6F);"]
+local f_code = formatters["mfun_do_outline_text_flush(%q,%i,%N,%N,%q)(%,t);"]
+local f_rule = formatters["mfun_do_outline_rule_flush(%q,%N,%N,%N,%N);"]
+local f_bounds = formatters["checkbounds(%N,%N,%N,%N);"]
local s_nothing = "(origin scaled 10)"
-directives.register("metapost.stripzeros", function()
- f_code = formatters["mfun_do_outline_text_flush(%q,%i,%.6N,%.6N,%q)(%,t);"]
- f_rule = formatters["mfun_do_outline_rule_flush(%q,%.6N,%.6N,%.6N,%.6N);"]
- f_bounds = formatters["checkbounds(%.6N,%.6N,%.6N,%.6N);"]
-end)
-
-local sc = 10
-local fc = number.dimenfactors.bp * sc / 10
+local sc = 10
+local fc = number.dimenfactors.bp * sc / sc
-- todo: make the next more efficient:
diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua
index d4805dab2..3d2e5b7c9 100644
--- a/tex/context/base/mkiv/font-shp.lua
+++ b/tex/context/base/mkiv/font-shp.lua
@@ -379,15 +379,9 @@ otf.loadstreamdata = loadstreamdata -- not public
otf.loadshapes = loadshapes
otf.getstreamhash = getstreamhash -- not public, might move to other namespace
-local f_c = formatters["%F %F %F %F %F %F c"]
-local f_l = formatters["%F %F l"]
-local f_m = formatters["%F %F m"]
-
-directives.register("pdf.stripzeros",function()
- f_c = formatters["%N %N %N %N %N %N c"]
- f_l = formatters["%N %N l"]
- f_m = formatters["%N %N m"]
-end)
+local f_c = formatters["%.6N %.6N %.6N %.6N %.6N %.6N c"]
+local f_l = formatters["%.6N %.6N l"]
+local f_m = formatters["%.6N %.6N m"]
local function segmentstopdf(segments,factor,bt,et)
local t = { }
diff --git a/tex/context/base/mkiv/grph-rul.lua b/tex/context/base/mkiv/grph-rul.lua
index b39fd6fdb..5067b0165 100644
--- a/tex/context/base/mkiv/grph-rul.lua
+++ b/tex/context/base/mkiv/grph-rul.lua
@@ -325,25 +325,10 @@ do
end
end
- -- maybe %.6F
-
- local f_rectangle = formatters["%.6F w %.6F %.6F %.6F %.6F re %s"]
- local f_baselined = formatters["%.6F w %.6F %.6F %.6F %.6F re s %.6F %.6F m %.6F %.6F l s"]
- local f_dashlined = formatters["%.6F w %.6F %.6F %.6F %.6F re s [%.6F %.6F] 2 d %.6F %.6F m %.6F %.6F l s"]
+ local f_rectangle = formatters["%.6N w %.6N %.6N %.6N %.6N re %s"]
+ local f_baselined = formatters["%.6N w %.6N %.6N %.6N %.6N re s %.6N %.6N m %.6N %.6N l s"]
+ local f_dashlined = formatters["%.6N w %.6N %.6N %.6N %.6N re s [%.6N %.6N] 2 d %.6N %.6N m %.6N %.6N l s"]
local f_radtangle = formatters[
- [[%.6F w %.6F %.6F m
-%.6F %.6F l %.6F %.6F %.6F %.6F y
-%.6F %.6F l %.6F %.6F %.6F %.6F y
-%.6F %.6F l %.6F %.6F %.6F %.6F y
-%.6F %.6F l %.6F %.6F %.6F %.6F y
-h %s]]
- ]
-
- directives.register("metapost.stripzeros",function() -- confusing name but ok
- f_rectangle = formatters["%.6N w %.6N %.6N %.6N %.6N re %s"]
- f_baselined = formatters["%.6N w %.6N %.6N %.6N %.6N re s %.6N %.6N m %.6N %.6N l s"]
- f_dashlined = formatters["%.6N w %.6N %.6N %.6N %.6N re s [%.6N %.6N] 2 d %.6N %.6N m %.6N %.6N l s"]
- f_radtangle = formatters[
[[%.6N w %.6N %.6N m
%.6N %.6N l %.6N %.6N %.6N %.6N y
%.6N %.6N l %.6N %.6N %.6N %.6N y
@@ -351,7 +336,6 @@ h %s]]
%.6N %.6N l %.6N %.6N %.6N %.6N y
h %s]]
]
- end)
ruleactions.fill = function(p,h,v,i,n)
if p.corner then
diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua
index 1c4a3ba27..c04ada151 100644
--- a/tex/context/base/mkiv/lpdf-ano.lua
+++ b/tex/context/base/mkiv/lpdf-ano.lua
@@ -364,25 +364,14 @@ lpdf.registerdocumentfinalizer(pdfdestinationspecification,"collect destinations
local destinations = { }
-local f_xyz = formatters["<< /D [ %i 0 R /XYZ %.6F %.6F null ] >>"]
+local f_xyz = formatters["<< /D [ %i 0 R /XYZ %.6N %.6N null ] >>"]
local f_fit = formatters["<< /D [ %i 0 R /Fit ] >>"]
local f_fitb = formatters["<< /D [ %i 0 R /FitB ] >>"]
-local f_fith = formatters["<< /D [ %i 0 R /FitH %.6F ] >>"]
-local f_fitv = formatters["<< /D [ %i 0 R /FitV %.6F ] >>"]
-local f_fitbh = formatters["<< /D [ %i 0 R /FitBH %.6F ] >>"]
-local f_fitbv = formatters["<< /D [ %i 0 R /FitBV %.6F ] >>"]
-local f_fitr = formatters["<< /D [ %i 0 R /FitR %.6F %.6F %.6F %.6F ] >>"]
-
-directives.register("pdf.stripzeros",function()
- f_xyz = formatters["<< /D [ %i 0 R /XYZ %.6N %.6N null ] >>"]
- f_fit = formatters["<< /D [ %i 0 R /Fit ] >>"]
- f_fitb = formatters["<< /D [ %i 0 R /FitB ] >>"]
- f_fith = formatters["<< /D [ %i 0 R /FitH %.6N ] >>"]
- f_fitv = formatters["<< /D [ %i 0 R /FitV %.6N ] >>"]
- f_fitbh = formatters["<< /D [ %i 0 R /FitBH %.6N ] >>"]
- f_fitbv = formatters["<< /D [ %i 0 R /FitBV %.6N ] >>"]
- f_fitr = formatters["<< /D [ %i 0 R /FitR %.6N %.6N %.6N %.6N ] >>"]
-end)
+local f_fith = formatters["<< /D [ %i 0 R /FitH %.6N ] >>"]
+local f_fitv = formatters["<< /D [ %i 0 R /FitV %.6N ] >>"]
+local f_fitbh = formatters["<< /D [ %i 0 R /FitBH %.6N ] >>"]
+local f_fitbv = formatters["<< /D [ %i 0 R /FitBV %.6N ] >>"]
+local f_fitr = formatters["<< /D [ %i 0 R /FitR %.6N %.6N %.6N %.6N ] >>"]
local v_standard = variables.standard
local v_frame = variables.frame
@@ -760,13 +749,8 @@ local nofused = 0
local nofspecial = 0
local share = true
-local f_annot = formatters["<< /Type /Annot %s /Rect [ %0.6F %0.6F %0.6F %0.6F ] >>"]
-local f_quadp = formatters["<< /Type /Annot %s /QuadPoints [ %s ] /Rect [ %0.6F %0.6F %0.6F %0.6F ] >>"]
-
-directives.register("pdf.stripzeros",function()
- f_annot = formatters["<< /Type /Annot %s /Rect [ %0.6N %0.6N %0.6N %0.6N ] >>"]
- f_quadp = formatters["<< /Type /Annot %s /QuadPoints [ %s ] /Rect [ %0.6N %0.6N %0.6N %0.6N ] >>"]
-end)
+local f_annot = formatters["<< /Type /Annot %s /Rect [ %.6N %.6N %.6N %.6N ] >>"]
+local f_quadp = formatters["<< /Type /Annot %s /QuadPoints [ %s ] /Rect [ %.6N %.6N %.6N %.6N ] >>"]
directives.register("references.sharelinks", function(v)
share = v
diff --git a/tex/context/base/mkiv/lpdf-col.lua b/tex/context/base/mkiv/lpdf-col.lua
index 4c277e35c..c586300e5 100644
--- a/tex/context/base/mkiv/lpdf-col.lua
+++ b/tex/context/base/mkiv/lpdf-col.lua
@@ -60,25 +60,18 @@ local setmetatableindex = table.setmetatableindex
local c_transparency = pdfconstant("Transparency")
-local f_gray = formatters["%.3F g %.3F G"]
-local f_rgb = formatters["%.3F %.3F %.3F rg %.3F %.3F %.3F RG"]
-local f_cmyk = formatters["%.3F %.3F %.3F %.3F k %.3F %.3F %.3F %.3F K"]
+local f_gray = formatters["%.3N g %.3N G"]
+local f_rgb = formatters["%.3N %.3N %.3N rg %.3N %.3N %.3N RG"]
+local f_cmyk = formatters["%.3N %.3N %.3N %.3N k %.3N %.3N %.3N %.3N K"]
local f_spot = formatters["/%s cs /%s CS %s SCN %s scn"]
local f_tr = formatters["Tr%s"]
-local f_cm = formatters["q %.6F %.6F %.6F %.6F %.6F %.6F cm"]
-local f_effect = formatters["%s Tc %s w %s Tr"] -- %.3F ?
+local f_cm = formatters["q %.6N %.6N %.6N %.6N %.6N %.6N cm"]
+local f_effect = formatters["%s Tc %s w %s Tr"] -- %.6N ?
local f_tr_gs = formatters["/Tr%s gs"]
-local f_num_1 = tostring
-local f_num_2 = formatters["%s %s"]
-local f_num_3 = formatters["%s %s %s"]
-local f_num_4 = formatters["%s %s %s %s"]
-
-directives.register("pdf.stripzeros",function()
- f_gray = formatters["%.3N g %.3N G"]
- f_rgb = formatters["%.3N %.3N %.3N rg %.3N %.3N %.3N RG"]
- f_cmyk = formatters["%.3N %.3N %.3N %.3N k %.3N %.3N %.3N %.3N K"]
- f_cm = formatters["q %.6N %.6N %.6N %.6N %.6N %.6N cm"]
-end)
+local f_num_1 = formatters["%.3N %.3N"]
+local f_num_2 = formatters["%.3N %.3N"]
+local f_num_3 = formatters["%.3N %.3N %.3N"]
+local f_num_4 = formatters["%.3N %.3N %.3N %.3N"]
local report_color = logs.reporter("colors","backend")
@@ -735,11 +728,7 @@ do
local pdfcolor = lpdf.color
local pdftransparency = lpdf.transparency
- local f_slant = formatters["q 1 0 %.6F 1 0 0 cm"]
-
- directives.register("pdf.stripzeros",function()
- f_slant = formatters["q 1 0 %.6N 1 0 0 cm"]
- end)
+ local f_slant = formatters["q 1 0 %N 1 0 0 cm"]
-- local fillcolors = {
-- red = { "pdf", "page", "1 0 0 rg" },
diff --git a/tex/context/base/mkiv/lpdf-emb.lua b/tex/context/base/mkiv/lpdf-emb.lua
index c1ebf6873..8fb211a2d 100644
--- a/tex/context/base/mkiv/lpdf-emb.lua
+++ b/tex/context/base/mkiv/lpdf-emb.lua
@@ -1546,14 +1546,14 @@ do
local f_char = formatters["BT /V%d 1 Tf [<%04X>] TJ ET"]
local f_width = formatters["%.6N 0 d0"]
local f_index = formatters["I%d"]
- local f_image_xy = formatters["%.6N 0 d0 1 0 0 1 %.3N %.3N cm /%s Do"]
+ local f_image_xy = formatters["%.6N 0 d0 1 0 0 1 %.6N %.6N cm /%s Do"]
local f_image_c = formatters["/%s Do"]
- local f_image_c_xy = formatters["%.6N 0 0 %.6N %.3N %.3N cm /%s Do"]
+ local f_image_c_xy = formatters["%.6N 0 0 %.6N %.6N %.6N cm /%s Do"]
local f_image_w = formatters["%.6N 0 d0 %s"]
- local f_image_d = formatters["%.6N 0 d0 1 0 0 1 0 %.3N cm /%s Do"]
+ local f_image_d = formatters["%.6N 0 d0 1 0 0 1 0 %.6N cm /%s Do"]
local f_stream = formatters["%.6N 0 d0 %s"]
local f_stream_c = formatters["%.6N 0 0 0 0 0 d1 %s"]
- local f_stream_d = formatters["%.6N 0 d0 1 0 0 1 0 %.3N cm %s"]
+ local f_stream_d = formatters["%.6N 0 d0 1 0 0 1 0 %.6N cm %s"]
-- A type 3 font has at most 256 characters and Acrobat also wants a zero slot
-- to be filled. We can share a mandate zero slot character. We also need to
diff --git a/tex/context/base/mkiv/lpdf-grp.lua b/tex/context/base/mkiv/lpdf-grp.lua
index 49cc76871..e827419a6 100644
--- a/tex/context/base/mkiv/lpdf-grp.lua
+++ b/tex/context/base/mkiv/lpdf-grp.lua
@@ -262,14 +262,9 @@ end
-- experimental (q Q is not really needed)
-local f_pattern = formatters["q /Pattern cs /%s scn 0 0 %.6F %.6F re f Q"]
-
-directives.register("pdf.stripzeros",function()
- f_pattern = formatters["q /Pattern cs /%s scn 0 0 %.6N %.6N re f Q"]
-end)
-
-local saveboxresource = tex.boxresources.save
-local nofpatterns = 0
+local saveboxresource = tex.boxresources.save
+local nofpatterns = 0
+local f_pattern = formatters["q /Pattern cs /%s scn 0 0 %.6N %.6N re f Q"]
function lpdf.registerpattern(specification)
nofpatterns = nofpatterns + 1
diff --git a/tex/context/base/mkiv/lpdf-lmt.lua b/tex/context/base/mkiv/lpdf-lmt.lua
index e1ef7ff6b..a14df3eca 100644
--- a/tex/context/base/mkiv/lpdf-lmt.lua
+++ b/tex/context/base/mkiv/lpdf-lmt.lua
@@ -175,13 +175,8 @@ end
-- helpers
-local f_cm = formatters["%.6F %.6F %.6F %.6F %.6F %.6F cm"]
-local f_tm = formatters["%.6F %.6F %.6F %.6F %.6F %.6F Tm"]
-
-directives.register("pdf.stripzeros",function()
- f_cm = formatters["%.6N %.6N %.6N %.6N %.6N %.6N cm"]
- f_tm = formatters["%.6N %.6N %.6N %.6N %.6N %.6N Tm"]
-end)
+local f_cm = formatters["%.6N %.6N %.6N %.6N %.6N %.6N cm"]
+local f_tm = formatters["%.6N %.6N %.6N %.6N %.6N %.6N Tm"]
local saved_text_pos_v = 0
local saved_text_pos_h = 0
@@ -451,18 +446,13 @@ local flushcharacter do
-- end
-- end
- local f_width = formatters["%.6F w"]
+ local f_width = formatters["%.6N w"]
local f_mode = formatters["%i Tr"] -- can be hash
- local f_font = formatters["/F%i %.6F Tf"] -- can be hash
+ local f_font = formatters["/F%i %.6N 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"]
- f_font = formatters["/F%i %.6N Tf"]
- end)
-
local function set_font()
-- if need_width and need_width ~= 0 then
if need_width ~= 0 then
@@ -874,20 +864,12 @@ local flushrule, flushsimplerule, flushimage, flushgroup do
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"]
-
- local f_f = formatters["0 0 %.6F %.6F re f"]
- local f_o = formatters["[] 0 d 0 J 0 0 %.6F %.6F re S"]
- local f_w = formatters["[] 0 d 0 J %.6F w 0 0 %.6F %.6F re S"]
+ local f_v = formatters["[] 0 d 0 J %.6N w 0 0 m %.6N 0 l S"]
+ local f_h = formatters["[] 0 d 0 J %.6N w 0 0 m 0 %.6N l S"]
- directives.register("pdf.stripzeros",function()
- f_v = formatters["[] 0 d 0 J %.6N w 0 0 m %.6N 0 l S"]
- f_h = formatters["[] 0 d 0 J %.6N w 0 0 m 0 %.6N l S"]
- f_f = formatters["0 0 %.6N %.6N re f"]
- f_o = formatters["[] 0 d 0 J 0 0 %.6N %.6N re S"]
- f_w = formatters["[] 0 d 0 J %.6N w 0 0 %.6N %.6N re S"]
- end)
+ local f_f = formatters["0 0 %.6N %.6N re f"]
+ local f_o = formatters["[] 0 d 0 J 0 0 %.6N %.6N re S"]
+ local f_w = formatters["[] 0 d 0 J %.6N w 0 0 %.6N %.6N re S"]
-- Historically the index is an object which is kind of bad.
diff --git a/tex/context/base/mkiv/lpdf-mis.lua b/tex/context/base/mkiv/lpdf-mis.lua
index 7410ed9ab..7227f9dba 100644
--- a/tex/context/base/mkiv/lpdf-mis.lua
+++ b/tex/context/base/mkiv/lpdf-mis.lua
@@ -525,11 +525,7 @@ end
-- temp hack: the mediabox is not under our control and has a precision of 5 digits
local factor = number.dimenfactors.bp
-local f_value = formatters["%.6F"]
-
-directives.register("pdf.stripzeros",function()
- local f_value = formatters["%.6N"]
-end)
+local f_value = formatters["%.6N"]
local function boxvalue(n) -- we could share them
return pdfverbose(f_value(factor * n))
diff --git a/tex/context/base/mkiv/lpdf-swf.lua b/tex/context/base/mkiv/lpdf-swf.lua
index 44e42dc5f..df59fc79c 100644
--- a/tex/context/base/mkiv/lpdf-swf.lua
+++ b/tex/context/base/mkiv/lpdf-swf.lua
@@ -41,11 +41,7 @@ local embedimage = images.embed
local basepoints = number.dimenfactors.bp
-local f_image = formatters["%.6F 0 0 %.6F 0 0 cm /%s Do"]
-
-directives.register("pdf.stripzeros",function()
- f_image = formatters["%.6N 0 0 %.6N 0 0 cm /%s Do"]
-end)
+local f_image = formatters["%.6N 0 0 %.6N 0 0 cm /%s Do"]
local function package(image) -- see lpdf-u3d **
local boundingbox = image.bbox
diff --git a/tex/context/base/mkiv/lpdf-u3d.lua b/tex/context/base/mkiv/lpdf-u3d.lua
index f6897e92d..54dc8a227 100644
--- a/tex/context/base/mkiv/lpdf-u3d.lua
+++ b/tex/context/base/mkiv/lpdf-u3d.lua
@@ -348,11 +348,7 @@ end
local stored_js, stored_3d, stored_pr, streams = { }, { }, { }, { }
-local f_image = formatters["q /GS gs %.6F 0 0 %.6F 0 0 cm /IM Do Q"]
-
-directives.register("pdf.stripzeros",function()
- f_image = formatters["q /GS gs %.6N 0 0 %.6N 0 0 cm /IM Do Q"]
-end)
+local f_image = formatters["q /GS gs %.6N 0 0 %.6N 0 0 cm /IM Do Q"]
local function insert3d(spec) -- width, height, factor, display, controls, label, foundname
diff --git a/tex/context/base/mkiv/meta-blb.lua b/tex/context/base/mkiv/meta-blb.lua
index e1c0de74f..9ee57d80d 100644
--- a/tex/context/base/mkiv/meta-blb.lua
+++ b/tex/context/base/mkiv/meta-blb.lua
@@ -142,11 +142,7 @@ end
local sxsy = metapost.sxsy
local cm = metapost.cm
-local f_f = formatters["%.6F"]
-
-directives.register("pdf.stripzeros",function()
- f_f = formatters["%.6N"]
-end)
+local f_f = formatters["%.6N"]
local function injectblob(object,blob)
local sx, rx, ry, sy, tx, ty = cm(object)
diff --git a/tex/context/base/mkiv/meta-pdf.lua b/tex/context/base/mkiv/meta-pdf.lua
index 5bcd161c0..5bcbe4186 100644
--- a/tex/context/base/mkiv/meta-pdf.lua
+++ b/tex/context/base/mkiv/meta-pdf.lua
@@ -44,13 +44,8 @@ local mptopdf = metapost.mptopdf
mptopdf.nofconverted = 0
-local f_translate = formatters["1 0 0 0 1 %.6F %.6F cm"]
-local f_concat = formatters["%.6F %.6F %.6F %.6F %.6F %.6F cm"]
-
-directives.register("pdf.stripzeros",function()
- f_translate = formatters["1 0 0 0 1 %.6N %.6N cm"]
- f_concat = formatters["%.6N %.6N %.6N %.6N %.6N %.6N cm"]
-end)
+local f_translate = formatters["1 0 0 0 1 %.6N %.6N cm"]
+local f_concat = formatters["%.6N %.6N %.6N %.6N %.6N %.6N cm"]
local m_path, m_stack, m_texts, m_version, m_date, m_shortcuts = { }, { }, { }, 0, 0, false
diff --git a/tex/context/base/mkiv/mlib-cnt.lua b/tex/context/base/mkiv/mlib-cnt.lua
index adcaf9f94..761eac655 100644
--- a/tex/context/base/mkiv/mlib-cnt.lua
+++ b/tex/context/base/mkiv/mlib-cnt.lua
@@ -1796,7 +1796,6 @@ local sqrt, sin, cos = math.sqrt, math.sin, math.cos
local f_fill_rgb = formatters["F (%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--C withcolor (%.3N,%.3N,%.3N) ;"]
local f_draw_rgb = formatters["D (%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--C withcolor %.3F ;"]
local f_mesh_rgb = formatters["U (%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--C withcolor (%.3N,%.3N,%.3N) ;"]
-
local f_fill_cmy = formatters["F (%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--C withcolor (%.3N,%.3N,%.3N,0) ;"]
local f_draw_cmy = formatters["D (%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--C withcolor %.3F ;"]
local f_mesh_cmy = formatters["U (%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--(%.6N,%.6N)--C withcolor (%.3N,%.3N,%.3N,0) ;"]
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index ded3a1841..372a77f41 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -45,29 +45,16 @@ local experiment = true -- uses context(node) that already does delayed nod
local savedliterals = nil -- needs checking
local mpsliteral = nodes.pool.originliteral
-local f_f = formatters["%.6F"]
-local f_m = formatters["%.6F %.6F m"]
-local f_c = formatters["%.6F %.6F %.6F %.6F %.6F %.6F c"]
-local f_l = formatters["%.6F %.6F l"]
-local f_cm = formatters["%.6F %.6F %.6F %.6F %.6F %.6F cm"]
-local f_M = formatters["%.6F M"]
+local f_f = formatters["%.6N"]
+local f_m = formatters["%.6N %.6N m"]
+local f_c = formatters["%.6N %.6N %.6N %.6N %.6N %.6N c"]
+local f_l = formatters["%.6N %.6N l"]
+local f_cm = formatters["%.6N %.6N %.6N %.6N %.6N %.6N cm"]
+local f_M = formatters["%.6N M"]
local f_j = formatters["%i j"]
local f_J = formatters["%i J"]
-local f_d = formatters["[%s] %.6F d"]
-local f_w = formatters["%.3F w"]
-
-directives.register("metapost.stripzeros",function()
- f_f = formatters["%.6N"]
- f_m = formatters["%.6N %.6N m"]
- f_c = formatters["%.6N %.6N %.6N %.6N %.6N %.6N c"]
- f_l = formatters["%.6N %.6N l"]
- f_cm = formatters["%.6N %.6N %.6N %.6N %.6N %.6N cm"]
- f_M = formatters["%.6N M"]
- f_j = formatters["%i j"]
- f_J = formatters["%i J"]
- f_d = formatters["[%s] %.6N d"]
- f_w = formatters["%.3N w"]
-end)
+local f_d = formatters["[%s] %.6N d"]
+local f_w = formatters["%.6N w"]
directives.register("metapost.savetable",function(v)
if type(v) == "string" then
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua
index d23949352..0250df35c 100644
--- a/tex/context/base/mkiv/mlib-pps.lua
+++ b/tex/context/base/mkiv/mlib-pps.lua
@@ -94,28 +94,18 @@ end
-- todo: get this from the lpdf module
-local f_f = formatters["%F"]
-local f_f3 = formatters["%.3F"]
-local f_gray = formatters["%.3F g %.3F G"]
-local f_rgb = formatters["%.3F %.3F %.3F rg %.3F %.3F %.3F RG"]
-local f_cmyk = formatters["%.3F %.3F %.3F %.3F k %.3F %.3F %.3F %.3F K"]
-local f_cm_b = formatters["q %.6F %.6F %.6F %.6F %.6F %.6F cm"]
-local f_scn = formatters["%.3F"]
+local f_f = formatters["%.6N"]
+local f_f3 = formatters["%.3N"]
+local f_gray = formatters["%.3N g %.3N G"]
+local f_rgb = formatters["%.3N %.3N %.3N rg %.3N %.3N %.3N RG"]
+local f_cmyk = formatters["%.3N %.3N %.3N %.3N k %.3N %.3N %.3N %.3N K"]
+local f_cm_b = formatters["q %.6N %.6N %.6N %.6N %.6N %.6N cm"]
+local f_scn = formatters["%.3N"]
local f_shade = formatters["MpSh%s"]
local f_spot = formatters["/%s cs /%s CS %s SCN %s scn"]
local s_cm_e = "Q"
-directives.register("metapost.stripzeros",function()
- f_f = formatters["%N"]
- f_f3 = formatters["%.3N"]
- f_gray = formatters["%.3N g %.3N G"]
- f_rgb = formatters["%.3N %.3N %.3N rg %.3N %.3N %.3N RG"]
- f_cmyk = formatters["%.3N %.3N %.3N %.3N k %.3N %.3N %.3N %.3N K"]
- f_cm_b = formatters["q %.6N %.6N %.6N %.6N %.6N %.6N cm"]
- f_scn = formatters["%.3N"]
-end)
-
local function checked_color_pair(color,...)
if not color then
return innercolor, outercolor
@@ -801,21 +791,12 @@ local tx_reset, tx_process do
----- pat = tsplitat(":")
local pat = lpeg.tsplitter(":",tonumber) -- so that %F can do its work
- local f_gray_yes = formatters["s=%.3F,a=%i,t=%.3F"]
- local f_gray_nop = formatters["s=%.3F"]
- local f_rgb_yes = formatters["r=%.3F,g=%.3F,b=%.3F,a=%.3F,t=%.3F"]
- local f_rgb_nop = formatters["r=%.3F,g=%.3F,b=%.3F"]
- local f_cmyk_yes = formatters["c=%.3F,m=%.3F,y=%.3F,k=%.3F,a=%.3F,t=%.3F"]
- local f_cmyk_nop = formatters["c=%.3F,m=%.3F,y=%.3F,k=%.3F"]
-
- directives.register("metapost.stripzeros",function()
- f_gray_yes = formatters["s=%.3N,a=%i,t=%.3N"]
- f_gray_nop = formatters["s=%.3N"]
- f_rgb_yes = formatters["r=%.3N,g=%.3N,b=%.3N,a=%.3N,t=%.3N"]
- f_rgb_nop = formatters["r=%.3N,g=%.3N,b=%.3N"]
- f_cmyk_yes = formatters["c=%.3N,m=%.3N,y=%.3N,k=%.3N,a=%.3N,t=%.3N"]
- f_cmyk_nop = formatters["c=%.3N,m=%.3N,y=%.3N,k=%.3N"]
- end)
+ local f_gray_yes = formatters["s=%.3N,a=%i,t=%.3N"]
+ local f_gray_nop = formatters["s=%.3N"]
+ local f_rgb_yes = formatters["r=%.3N,g=%.3N,b=%.3N,a=%.3N,t=%.3N"]
+ local f_rgb_nop = formatters["r=%.3N,g=%.3N,b=%.3N"]
+ local f_cmyk_yes = formatters["c=%.3N,m=%.3N,y=%.3N,k=%.3N,a=%.3N,t=%.3N"]
+ local f_cmyk_nop = formatters["c=%.3N,m=%.3N,y=%.3N,k=%.3N"]
local ctx_MPLIBsetNtext = context.MPLIBsetNtextX
local ctx_MPLIBsetCtext = context.MPLIBsetCtextX
diff --git a/tex/context/base/mkiv/mlib-svg.lua b/tex/context/base/mkiv/mlib-svg.lua
index fee23acdf..b56c1fd54 100644
--- a/tex/context/base/mkiv/mlib-svg.lua
+++ b/tex/context/base/mkiv/mlib-svg.lua
@@ -392,13 +392,13 @@ local rgbcomponents, withcolor, thecolor do
whitesmoke = 0xF5F5F5, yellow = 0xFFFF00, yellowgreen = 0x9ACD32,
}
- local f_rgb = formatters['withcolor svgcolor(%N,%N,%N)']
- local f_gray = formatters['withcolor svggray(%N)']
- local f_rgba = formatters['withcolor svgcolor(%N,%N,%N) withtransparency (1,%N)']
- local f_graya = formatters['withcolor svggray(%N) withtransparency (1,%N)']
+ local f_rgb = formatters['withcolor svgcolor(%.3N,%.3N,%.3N)']
+ local f_gray = formatters['withcolor svggray(%.3N)']
+ local f_rgba = formatters['withcolor svgcolor(%.3N,%.3N,%.3N) withtransparency (1,%.3N)']
+ local f_graya = formatters['withcolor svggray(%.3N) withtransparency (1,%.3N)']
local f_name = formatters['withcolor "%s"']
- local f_svgcolor = formatters['svgcolor(%N,%N,%N)']
- local f_svggray = formatters['svggray(%N)']
+ local f_svgcolor = formatters['svgcolor(%.3N,%.3N,%.3N)']
+ local f_svggray = formatters['svggray(%.3N)']
local f_svgname = formatters['"%s"']
local triplets = setmetatableindex(function(t,k)
@@ -506,7 +506,7 @@ end
local grabpath, grablist do
- local f_moveto = formatters['(%N,%n)']
+ local f_moveto = formatters['(%N,%N)']
local f_curveto_z = formatters['controls(%N,%N)and(%N,%N)..(%N,%N)']
local f_curveto_n = formatters['..controls(%N,%N)and(%N,%N)..(%N,%N)']
local f_lineto_z = formatters['(%N,%N)']
@@ -2333,9 +2333,9 @@ do
do
local f_styled = formatters["\\svgstyled{%s}{%s}{%s}{%s}"]
- local f_colored = formatters["\\svgcolored{%N}{%N}{%N}{"]
- local f_placed = formatters["\\svgplaced{%N}{%N}{}{"]
- local f_poschar = formatters["\\svgposchar{%N}{%N}{%s}"]
+ local f_colored = formatters["\\svgcolored{%.3N}{%.3N}{%.3N}{"]
+ local f_placed = formatters["\\svgplaced{%.3N}{%.3N}{}{"]
+ local f_poschar = formatters["\\svgposchar{%.3N}{%.3N}{%s}"]
local f_char = formatters["\\svgchar{%s}"]
local f_scaled = formatters["\\svgscaled{%N}{%s}{%s}{%s}"]
@@ -2911,10 +2911,6 @@ do
--
-- can be option:
--
- n = n + 1 ; t[n] = "\\enabledirectives[pdf.stripzeros,metapost.stripzeros]"
- --
- -- can be option:
- --
-- n = n + 1 ; t[n] = "\\nopdfcompression"
--
n = n + 1 ; t[n] = "\\starttext"
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 5185623b7..f0a77a5a9 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 0908c5811..eeda6094f 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-doc.lua b/tex/context/base/mkiv/strc-doc.lua
index c38dc2f4d..9877a0f9c 100644
--- a/tex/context/base/mkiv/strc-doc.lua
+++ b/tex/context/base/mkiv/strc-doc.lua
@@ -885,7 +885,7 @@ function sections.findnumber(depth,what) -- needs checking (looks wrong and slow
if sectiondata and sectiondata.hidenumber ~= true then -- can be nil
local quit = what == v_previous or what == v_next
if what == v_first or what == v_previous then
- for i=index,1,-1 do
+ for i=index-1,1,-1 do
local s = collected[i]
if s then
local n = s.numbers
@@ -900,7 +900,7 @@ function sections.findnumber(depth,what) -- needs checking (looks wrong and slow
end
end
elseif what == v_last or what == v_next then
- for i=index,#collected do
+ for i=index+1,#collected do
local s = collected[i]
if s then
local n = s.numbers
diff --git a/tex/context/base/mkiv/syst-lua.lua b/tex/context/base/mkiv/syst-lua.lua
index a63c49e8f..5911d7f00 100644
--- a/tex/context/base/mkiv/syst-lua.lua
+++ b/tex/context/base/mkiv/syst-lua.lua
@@ -156,3 +156,245 @@ implement {
end
end
}
+
+-- This is a bit of a joke as I never really needed floating point expressions (okay,
+-- maybe only with scaling because there one can get numbers that are too large for
+-- dimensions to deal with). Of course one can write a parser in \TEX\ speak but then
+-- one also needs to implement a bunch of functions. It doesn't pay of so we just
+-- stick to the next gimmick. It looks inefficient but performance is actually quite
+-- efficient.
+
+local concat = table.concat
+local utfchar = utf.char
+local load, type, tonumber = load, type, tonumber
+
+local xmath = xmath or math
+local xcomplex = xcomplex or { }
+
+local cmd = tokens.commands
+
+local get_next = token.get_next
+local get_command = token.get_command
+local get_mode = token.get_mode
+local get_index = token.get_index
+local get_csname = token.get_csname
+local get_macro = token.get_macro
+
+local put_next = token.put_next
+
+local scan_token = token.scan_token
+
+local getdimen = tex.getdimen
+local getglue = tex.getglue
+local getcount = tex.getcount
+local gettoks = tex.gettoks
+local gettex = tex.get
+
+local context = context
+local dimenfactors = number.dimenfactors
+
+local result = { "return " }
+local word = { }
+local r = 1
+local w = 0
+
+local report = logs.reporter("system","expression")
+
+local function unexpected(c)
+ report("unexpected token %a",c)
+end
+
+local function expression()
+ local w = 0
+ local r = 1
+ while true do
+ local t = get_next()
+ local n = get_command(t)
+ local c = cmd[n]
+ -- todo, helper: returns number
+ if c == "letter" then
+ w = w + 1 ; word[w] = utfchar(get_mode(t))
+ else
+ if w > 0 then
+ local s = concat(word,"",1,w)
+ local d = dimenfactors[s]
+ if d then
+ r = r + 1 ; result[r] = "*"
+ r = r + 1 ; result[r] = 1/d
+ else
+ if xmath[s] then
+ r = r + 1 ; result[r] = "xmath."
+ elseif xcomplex[s] then
+ r = r + 1 ; result[r] = "xcomplex."
+ end
+ r = r + 1 ; result[r] = s
+ end
+ w = 0
+ end
+ if c == "other_char" then
+ r = r + 1 ; result[r] = utfchar(get_mode(t))
+ elseif c == "spacer" then
+ -- r = r + 1 ; result[r] = " "
+ elseif c == "relax" then
+ break
+ elseif c == "assign_int" then
+ r = r + 1 ; result[r] = getcount(get_index(t))
+ elseif c == "assign_dimen" then
+ r = r + 1 ; result[r] = getdimen(get_index(t))
+ elseif c == "assign_glue" then
+ r = r + 1 ; result[r] = getglue(get_index(t))
+ elseif c == "assign_toks" then
+ r = r + 1 ; result[r] = gettoks(get_index(t))
+ elseif c == "char_given" or c == "math_given" or c == "xmath_given" then
+ r = r + 1 ; result[r] = get_mode(t)
+ elseif c == "last_item" then
+ local n = get_csname(t)
+ if n then
+ local s = gettex(n)
+ if s then
+ r = r + 1 ; result[r] = s
+ else
+ unexpected(c)
+ end
+ else
+ unexpected(c)
+ end
+ elseif c == "call" then
+ local n = get_csname(t)
+ if n then
+ local s = get_macro(n)
+ if s then
+ r = r + 1 ; result[r] = s
+ else
+ unexpected(c)
+ end
+ else
+ unexpected(c)
+ end
+ elseif c == "the" or c == "convert" or c == "lua_expandable_call" then
+ put_next(t)
+ scan_token() -- expands
+ else
+ unexpected(c)
+ end
+ end
+ end
+ local code = concat(result,"",1,r)
+ local func = load(code)
+ if type(func) == "function" then
+ context(func())
+ else
+ report("invalid lua %a",code)
+ end
+end
+
+-- local letter_code <const> = cmd.letter
+-- local other_char_code <const> = cmd.other_char
+-- local spacer_code <const> = cmd.spacer
+-- local other_char_code <const> = cmd.other_char
+-- local relax_code <const> = cmd.relax
+-- local assign_int_code <const> = cmd.assign_int
+-- local assign_dimen_code <const> = cmd.assign_dimen
+-- local assign_glue_code <const> = cmd.assign_glue
+-- local assign_toks_code <const> = cmd.assign_toks
+-- local char_given_code <const> = cmd.char_given
+-- local math_given_code <const> = cmd.math_given
+-- local xmath_given_code <const> = cmd.xmath_given
+-- local last_item_code <const> = cmd.last_item
+-- local call_code <const> = cmd.call
+-- local the_code <const> = cmd.the
+-- local convert_code <const> = cmd.convert
+-- local lua_expandable_call_code <const> = cmd.lua_expandable_call
+--
+-- local function unexpected(c)
+-- report("unexpected token %a",c)
+-- end
+--
+-- local function expression()
+-- local w = 0
+-- local r = 1
+-- while true do
+-- local t = get_next()
+-- local n = get_command(t)
+-- if n == letter_code then
+-- w = w + 1 ; word[w] = utfchar(get_mode(t))
+-- else
+-- if w > 0 then
+-- -- we could use a metatable for all math, complex and factors
+-- local s = concat(word,"",1,w)
+-- local d = dimenfactors[s]
+-- if d then
+-- r = r + 1 ; result[r] = "*"
+-- r = r + 1 ; result[r] = 1/d
+-- else
+-- if xmath[s] then
+-- r = r + 1 ; result[r] = "xmath."
+-- elseif xcomplex[s] then
+-- r = r + 1 ; result[r] = "xcomplex."
+-- end
+-- r = r + 1 ; result[r] = s
+-- end
+-- w = 0
+-- end
+-- if n == other_char_code then
+-- r = r + 1 ; result[r] = utfchar(get_mode(t))
+-- elseif n == spacer_code then
+-- -- r = r + 1 ; result[r] = " "
+-- elseif n == relax_code then
+-- break
+-- elseif n == assign_int_code then
+-- r = r + 1 ; result[r] = getcount(get_index(t))
+-- elseif n == assign_dimen_code then
+-- r = r + 1 ; result[r] = getdimen(get_index(t))
+-- elseif n == assign_glue_code then
+-- r = r + 1 ; result[r] = getglue(get_index(t))
+-- elseif n == assign_toks_code then
+-- r = r + 1 ; result[r] = gettoks(get_index(t))
+-- elseif n == char_given_code or n == math_given_code or n == xmath_given_code then
+-- r = r + 1 ; result[r] = get_mode(t)
+-- elseif n == last_item_code then
+-- local n = get_csname(t)
+-- if n then
+-- local s = gettex(n)
+-- if s then
+-- r = r + 1 ; result[r] = s
+-- else
+-- unexpected(c)
+-- end
+-- else
+-- unexpected(c)
+-- end
+-- elseif n == call_code then
+-- local n = get_csname(t)
+-- if n then
+-- local s = get_macro(n)
+-- if s then
+-- r = r + 1 ; result[r] = s
+-- else
+-- unexpected(c)
+-- end
+-- else
+-- unexpected(c)
+-- end
+-- elseif n == the_code or n == convert_code or n == lua_expandable_call_code then
+-- put_next(t)
+-- scan_token() -- expands
+-- else
+-- unexpected(c)
+-- end
+-- end
+-- end
+-- local code = concat(result,"",1,r)
+-- local func = load(code)
+-- if type(func) == "function" then
+-- context(func())
+-- else
+-- report("invalid lua %a",code)
+-- end
+-- end
+
+implement {
+ public = true,
+ name = "expression",
+ actions = expression,
+}
diff --git a/tex/context/base/mkiv/syst-lua.mkiv b/tex/context/base/mkiv/syst-lua.mkiv
index 3683f9ed8..0e2769d04 100644
--- a/tex/context/base/mkiv/syst-lua.mkiv
+++ b/tex/context/base/mkiv/syst-lua.mkiv
@@ -81,4 +81,41 @@
\let\syst_write_execute\clf_execute % always {...}
+%D There is a probably rather useless \type {\expression} command that can mix \LUA\ numeric
+%D expressions with \TEX\ commands (for as far that makes sense) that works like this:
+%D
+%D \starttyping
+%D \mathchardef\foooo 1234
+%D \def \mymacro {123.45}
+%D \scratchdimen 123pt
+%D \scratchskip 123pt
+%D \scratchtoks {34}
+%D
+%D \testfeatureonce{10000}{\edef\foo{\expression
+%D round(
+%D 12.3 * \scratchdimen
+%D - (12.3 * \scratchskip) / 2
+%D + 2 ^ 3
+%D * (
+%D - sqrt(12)
+%D - 10pt
+%D - \foooo
+%D + \luatexversion
+%D - \mymacro
+%D + \scratchtoks
+%D + \the\scratchcounter
+%D + \number\scratchcounter
+%D )
+%D )
+%D \relax}}
+%D
+%D \expression string.format("\letterpercent f",\elapsedtime/50000) \relax
+%D \stoptyping
+%D
+%D The final \type {\relax} is mandate because we also accept spaces. Of course we
+%D could have avoided it by using outer parenthesis but this is cleaner anyway.
+%D
+%D The \MKIV\ version is a bit more limited than the \LMTX\ version because it only
+%D supports the standard math functions.
+
\protect \endinput
diff --git a/tex/context/base/mkiv/syst-lua.mkxl b/tex/context/base/mkiv/syst-lua.mkxl
index b6f1e8eaa..cceb4f160 100644
--- a/tex/context/base/mkiv/syst-lua.mkxl
+++ b/tex/context/base/mkiv/syst-lua.mkxl
@@ -58,4 +58,41 @@
\let\syst_write_execute\clf_execute % always {...}
+%D There is a probably rather useless \type {\expression} command that can mix \LUA\ numeric
+%D expressions with \TEX\ commands (for as far that makes sense) that works like this:
+%D
+%D \starttyping
+%D \mathchardef\foooo 1234
+%D \def \mymacro {123.45}
+%D \scratchdimen 123pt
+%D \scratchskip 123pt
+%D \scratchtoks {34}
+%D
+%D \testfeatureonce{10000}{\edef\foo{\expression
+%D round(
+%D 12.3 * \scratchdimen
+%D - (12.3 * \scratchskip) / 2
+%D + 2 ^ 3
+%D * (
+%D - sqrt(12)
+%D - 10pt
+%D - \foooo
+%D + \luatexversion
+%D - \mymacro
+%D + \scratchtoks
+%D + \the\scratchcounter
+%D + \number\scratchcounter
+%D )
+%D )
+%D \relax}}
+%D
+%D \expression string.format("\letterpercent f",\elapsedtime/50000) \relax
+%D \stoptyping
+%D
+%D The final \type {\relax} is mandate because we also accept spaces. Of course we
+%D could have avoided it by using outer parenthesis but this is cleaner anyway.
+%D
+%D The \LMTX\ version supports te \type {xmath} and \type {xcomplex} functions and
+%D therefore one can have expressions that don't work in \MKIV.
+
\protect \endinput
diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua
index 432b39ec5..68c9be586 100644
--- a/tex/context/base/mkiv/util-str.lua
+++ b/tex/context/base/mkiv/util-str.lua
@@ -944,7 +944,7 @@ local format_N if environment.FORMAT then
n = n + 1
if not f or f == "" then
return format("FORMAT(a%s,'%%.9f')",n)
- elseif f == ".6" then
+ elseif f == ".6" or f == "0.6" then
return format("FORMAT(a%s)",n)
else
return format("FORMAT(a%s,'%%%sf')",n,f)
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 7a794c838..a877fa0ea 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 fed4f8288..9d01bdf5e 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 92d798ff8..2882584ec 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 : 01/13/20 14:52:02
+-- merge date : 01/15/20 19:09:43
do -- begin closure to overcome local limits and interference
@@ -3655,7 +3655,7 @@ local format_N if environment.FORMAT then
n=n+1
if not f or f=="" then
return format("FORMAT(a%s,'%%.9f')",n)
- elseif f==".6" then
+ elseif f==".6" or f=="0.6" then
return format("FORMAT(a%s)",n)
else
return format("FORMAT(a%s,'%%%sf')",n,f)