summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/context/lua/luatools.lua31
-rw-r--r--scripts/context/lua/mtx-context.lua8
-rw-r--r--scripts/context/lua/mtx-convert.lua2
-rw-r--r--scripts/context/lua/mtx-update.lua268
-rw-r--r--scripts/context/lua/mtx-watch.lua4
-rw-r--r--scripts/context/lua/mtxrun.lua12
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-job.lua56
-rw-r--r--tex/context/base/core-job.mkiv6
-rw-r--r--tex/context/base/font-otf.lua118
-rw-r--r--tex/context/base/l-os.lua12
-rw-r--r--tex/context/base/l-utils.lua4
-rw-r--r--tex/context/base/luat-crl.lua2
-rw-r--r--tex/context/base/luat-lmx.lua4
-rw-r--r--tex/context/base/page-flt.tex5
-rw-r--r--tex/context/interface/keys-cz.xml2
-rw-r--r--tex/context/interface/keys-de.xml2
-rw-r--r--tex/context/interface/keys-en.xml2
-rw-r--r--tex/context/interface/keys-fr.xml2
-rw-r--r--tex/context/interface/keys-it.xml2
-rw-r--r--tex/context/interface/keys-nl.xml2
-rw-r--r--tex/context/interface/keys-ro.xml2
23 files changed, 417 insertions, 133 deletions
diff --git a/scripts/context/lua/luatools.lua b/scripts/context/lua/luatools.lua
index 165221fb4..b6a158f6e 100644
--- a/scripts/context/lua/luatools.lua
+++ b/scripts/context/lua/luatools.lua
@@ -1454,18 +1454,14 @@ function os.resultof(command)
return io.popen(command,"r"):read("*all")
end
-if not os.exec then -- still not ok
- os.exec = os.execute
-end
-if not os.spawn then -- still not ok
- os.spawn = os.execute
-end
+if not os.exec then os.exec = os.execute end
+if not os.spawn then os.spawn = os.execute end
function os.launch(str)
if os.platform == "windows" then
- os.execute("start " .. str)
+ os.execute("start " .. str) -- os.spawn ?
else
- os.execute(str .. " &")
+ os.execute(str .. " &") -- os.spawn ?
end
end
@@ -2107,17 +2103,15 @@ function utils.lua.compile(luafile, lucfile)
if utils.lua.compile_strip then
command = "-s " .. command
end
- if os.execute("texluac " .. command) == 0 then
+ if os.spawn("texluac " .. command) == 0 then
return true
- elseif os.execute("luac " .. command) == 0 then
+ elseif os.spawn("luac " .. command) == 0 then
return true
else
return false
end
end
-
-
-- filename : luat-lib.lua
-- comment : companion to luat-lib.tex
-- author : Hans Hagen, PRAGMA-ADE, Hasselt NL
@@ -6096,17 +6090,14 @@ function input.my_make_format(instance,texname)
input.report("using lua initialization file " .. luaname)
local flags = { "--ini" }
if environment.arguments["mkii"] then
- -- flags[#flags+1] = "--mkii" -- web2c error
flags[#flags+1] = "--progname=" .. instance.progname
else
- -- flags[#flags+1] = "--lua=" .. string.quote(luaname)
- flags[#flags+1] = string.quote("--lua=" .. luaname)
- -- flags[#flags+1] = "--progname=" .. instance.progname -- potential fallback
+ flags[#flags+1] = "--lua=" .. string.quote(luaname)
end
local bs = (environment.platform == "unix" and "\\\\") or "\\" -- todo: make a function
local command = "luatex ".. table.concat(flags," ") .. " " .. string.quote(fullname) .. " " .. bs .. "dump"
input.report("running command: " .. command .. "\n")
- os.exec(command)
+ os.spawn(command)
end
end
else
@@ -6139,11 +6130,9 @@ function input.my_run_format(instance,name,data,more)
end
if f then
f:close()
- -- bug, no .fmt !
- -- local command = "luatex --fmt=" .. string.quote(barename) .. " --lua=" .. string.quote(luaname) .. " " .. string.quote(data) .. " " .. string.quote(more)
- local command = "luatex " .. string.quote("--fmt=" .. barename) .. " " .. string.quote("--lua=" .. luaname) .. " " .. string.quote(data) .. " " .. string.quote(more)
+ local command = "luatex --fmt=" .. string.quote(barename) .. " --lua=" .. string.quote(luaname) .. " " .. string.quote(data) .. " " .. string.quote(more)
input.report("running command: " .. command)
- os.exec(command)
+ os.spawn(command)
else
input.report("using format name",fmtname)
input.report("no luc/lua with name",barename)
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua
index 9ecaa7198..3abd270aa 100644
--- a/scripts/context/lua/mtx-context.lua
+++ b/scripts/context/lua/mtx-context.lua
@@ -335,7 +335,7 @@ do
-- potential optimization: when mtxrun run internal
command = ctxrunner.justtext(command) -- command is still xml element here
input.report("command",command)
- local result = os.execute(command)
+ local result = os.spawn(command)
if result > 0 then
input.report("error, return code",result)
end
@@ -554,7 +554,7 @@ function scripts.context.run(ctxdata)
scripts.context.multipass.makeoptionfile(jobname,ctxdata)
for i=1, scripts.context.multipass.nofruns do
input.report(string.format("run %s: %s",i,command))
- local returncode = os.execute(command)
+ local returncode = os.spawn(command)
input.report("return code: " .. returncode)
if returncode > 0 then
input.report("fatal error, run aborted")
@@ -582,7 +582,7 @@ function scripts.context.make()
for _, name in ipairs( { "cont-en", "cont-nl", "mptopdf" } ) do
local command = "luatools --make --compile " .. name
input.report("running command: " .. command)
- os.execute(command)
+ os.spawn(command)
end
end
@@ -590,7 +590,7 @@ function scripts.context.generate()
-- hack, should also be a shared function
local command = "luatools --generate " .. name
input.report("running command: " .. command)
- os.execute(command)
+ os.spawn(command)
end
function scripts.context.ctx()
diff --git a/scripts/context/lua/mtx-convert.lua b/scripts/context/lua/mtx-convert.lua
index c9827c8b7..1bfc10c0f 100644
--- a/scripts/context/lua/mtx-convert.lua
+++ b/scripts/context/lua/mtx-convert.lua
@@ -25,7 +25,7 @@ do
dir.mkdirs(outputpath)
local tmpname = file.replacesuffix(newname,"tmp")
local command = string.format(gstemplate,gsprogram,tmpname,oldname)
- os.execute(command)
+ os.spawn(command)
os.remove(newname)
os.rename(tmpname,newname)
end
diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua
new file mode 100644
index 000000000..cfe553731
--- /dev/null
+++ b/scripts/context/lua/mtx-update.lua
@@ -0,0 +1,268 @@
+if not modules then modules = { } end modules ['mtx-update'] = {
+ version = 1.001,
+ comment = "companion to mtxrun.lua",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This script is dedicated to Mojca Miklavec, who is the driving force behind
+-- moving minimal generation from our internal machines to the context garden.
+-- Together with Arthur Reutenauer she made sure that it worked well on all
+-- platforms that matter.
+
+texmf.instance = instance -- we need to get rid of this / maybe current instance in global table
+
+scripts = scripts or { }
+scripts.update = scripts.update or { }
+
+minimals = minimals or { }
+minimals.config = minimals.config or { }
+
+scripts.update.collections = {
+ ["luatex"] = {
+ { "base/tex/", "texmf" },
+ { "base/metapost/", "texmf" },
+ { "fonts/new/", "texmf" },
+ { "fonts/common/", "texmf" },
+ { "fonts/other/", "texmf" },
+ { "context/current/", "texmf-context" },
+ { "context/img/", "texmf-context" },
+ { "misc/setuptex/", "." },
+ { "misc/web2c", "texmf" },
+ { "bin/common/%s/", "texmf-%s" },
+ { "bin/context/%s/", "texmf-%s" },
+ { "bin/metapost/%s/", "texmf-%s" },
+ { "bin/luatex/%s/", "texmf-%s" },
+ { "bin/man/", "texmf-%s" }
+ },
+ ["xetex"] = {
+ { "base/tex/", "texmf" },
+ { "base/metapost/", "texmf" },
+ { "base/xetex/", "texmf" },
+ { "fonts/new/", "texmf" },
+ { "fonts/common/", "texmf" },
+ { "fonts/other/", "texmf" },
+ { "context/current/", "texmf-context" },
+ { "context/img/", "texmf-context" },
+ { "misc/setuptex/", "." },
+ { "misc/web2c", "texmf" },
+ { "bin/common/%s/", "texmf-%s" },
+ { "bin/context/%s/", "texmf-%s" },
+ { "bin/metapost/%s/", "texmf-%s" },
+ { "bin/xetex/%s/", "texmf-%s" },
+ { "bin/man/", "texmf-%s" }
+ },
+ ["pdftex"] = {
+ { "base/tex/", "texmf" },
+ { "base/metapost/", "texmf" },
+ { "fonts/old/", "texmf" },
+ { "fonts/common/", "texmf" },
+ { "fonts/other/", "texmf" },
+ { "context/current/", "texmf-context" },
+ { "context/img/", "texmf-context" },
+ { "misc/setuptex/", "." },
+ { "misc/web2c", "texmf" },
+ { "bin/common/%s/", "texmf-%s" },
+ { "bin/context/%s/", "texmf-%s" },
+ { "bin/metapost/%s/", "texmf-%s" },
+ { "bin/pdftex/%s/", "texmf-%s" },
+ { "bin/man/", "texmf-%s" }
+ },
+ ["all"] = {
+ { "base/tex/", "texmf" },
+ { "base/metapost/", "texmf" },
+ { "base/xetex/", "texmf" },
+ { "fonts/old/", "texmf" },
+ { "fonts/new/", "texmf" },
+ { "fonts/common/", "texmf" },
+ { "fonts/other/", "texmf" },
+ { "context/current/", "texmf-context" },
+ { "context/img/", "texmf-context" },
+ { "misc/setuptex/", "." },
+ { "misc/web2c", "texmf" },
+ { "bin/common/%s/", "texmf-%s" },
+ { "bin/context/%s/", "texmf-%s" },
+ { "bin/metapost/%s/", "texmf-%s" },
+ { "bin/luatex/%s/", "texmf-%s" },
+ { "bin/xetex/%s/", "texmf-%s" },
+ { "bin/pdftex/%s/", "texmf-%s" },
+ { "bin/man/", "texmf-%s" }
+ },
+}
+
+scripts.update.platforms = {
+ ["mswin"] = "mswin",
+ ["windows"] = "mswin",
+ ["win32"] = "mswin",
+ ["win"] = "mswin",
+ ["linux"] = "linux",
+ ["linux-32"] = "linux",
+ ["linux-64"] = "linux-64",
+ ["osx"] = "osx-intel",
+ ["osx-intel"] = "osx-intel",
+ ["osx-ppc"] = "osx-ppc",
+}
+
+scripts.update.rsyncflagspath = "-rpztlv --stats --delete"
+scripts.update.rsyncflagsroot = "-rpztlv --stats"
+
+function scripts.update.prepare()
+ local texroot = environment.argument("texroot") or "tex"
+ local engines = environment.argument("engine")
+ if engines then
+ engines = engines:split(",")
+ else
+ engines = minimals.config.engines or { "all" }
+ end
+ local platforms = environment.argument("platform")
+ if platforms then
+ platforms = platforms:split(",")
+ else
+ platforms = minimals.config.platform or { os.currentplatform() }
+ end
+ return texroot, engines, platforms
+end
+
+function scripts.update.run(str)
+ if environment.argument("dryrun") then
+ logs.report("run", str)
+ else
+ -- important, otherwise formats fly to a weird place
+ -- (texlua sets luatex as the engine, we need to reset that or to fix texexec :)
+ os.setenv("engine",nil)
+ os.spawn(str)
+ end
+end
+
+function scripts.update.synchronize()
+ local texroot, engines, platforms = scripts.update.prepare()
+ local dryrun = environment.argument("dryrun")
+ os.setenv("CYGWIN","nontsec")
+ local rsyncbin = environment.argument("rsync") or "rsync"
+ local url = environment.argument("url") or "contextgarden.net::"
+ if not url:find("::$") then url = url .. "::" end
+ local ok = lfs.attributes(texroot,"mode") == "directory"
+ if not ok and not dryrun then
+ dir.mkdirs(texroot)
+ ok = lfs.attributes(texroot,"mode") == "directory"
+ end
+ if ok or dryrun then
+ if not dryrun then
+ dir.mkdirs(string.format("%s/%s", texroot, "texmf-cache"))
+ end
+ local fetched = { }
+ local individual = { }
+ local context = environment.argument("context")
+ for _, engine in ipairs(engines) do
+ local collections = scripts.update.collections[engine]
+ if collections then
+ for _, collection in ipairs(collections) do
+ for _, platform in ipairs(platforms) do
+ platform = scripts.update.platforms[platform]
+ if platform then
+ local archive = string.format(collection[1], platform)
+ local destination = string.format("%s/%s", texroot, string.format(collection[2], platform))
+ destination = destination:gsub("\\","/")
+ if platform == "windows" or platform == "mswin" then
+ destination = destination:gsub("([a-zA-Z]):/", "/cygdrive/%1/")
+ end
+ -- if one uses experimental, context=... has no effect
+ if context and not environment.argument("experimental") then
+ archive = archive:gsub("/current/", "/" .. context .. "/")
+ end
+ individual[#individual+1] = { archive, destination }
+ end
+ end
+ end
+ end
+ end
+ local combined = { }
+ local distributions = { "current" }
+ -- we need to fetch files from both "current" and "experimental" branch
+ if environment.argument("experimental") then
+ distributions = { "experimental", "current" }
+ end
+ for _, d in pairs(distributions) do
+ for _, v in pairs(individual) do
+ local archive, destination = v[1], v[2]
+ local cd = combined[destination]
+ if not cd then
+ cd = { }
+ combined[destination] = cd
+ end
+ cd[#cd+1] = 'minimals/' .. d .. '/' .. archive
+ end
+ end
+ if input.verbose then
+ for k, v in pairs(combined) do
+ logs.report("update", k)
+ for k,v in ipairs(v) do
+ logs.report("update", " <= " .. v)
+ end
+ end
+ end
+ for destination, archive in pairs(combined) do
+ local archives, command = table.concat(archive," "), ""
+ if not environment.argument("delete") or destination:find("%.$") then
+ command = string.format("%s %s %s'%s' %s", rsyncbin, scripts.update.rsyncflagsroot, url, archives, destination)
+ else
+ command = string.format("%s %s %s'%s' %s", rsyncbin, scripts.update.rsyncflagspath, url, archives, destination)
+ end
+ logs.report("mtx update", string.format("running command: %s",command))
+ if not fetched[command] then
+ scripts.update.run(command)
+ fetched[command] = command
+ end
+ end
+ else
+ logs.report("mtx update", string.format("no valid texroot: %s",texroot))
+ end
+ if environment.argument("make") then
+ scripts.update.make()
+ end
+end
+
+function scripts.update.make()
+ local texroot, engines, platforms = scripts.update.prepare()
+ input.load_tree(texroot)
+ scripts.update.run("mktexlsr")
+ scripts.update.run("luatools --generate")
+ engines = (engines[1] and engines[1] == "all" and { "pdftex", "xetex", "luatex" }) or engines
+ for _, engine in ipairs(engines) do
+ scripts.update.run(string.format("texexec --make --all --fast --%s",engine))
+ end
+end
+
+banner = banner .. " | download tools "
+
+input.runners.save_list = {
+ "update", "engine", "platform", "url", "rsync", "texroot", "dryrun", "make", "delete", "context"
+}
+
+messages.help = [[
+--update update minimal tree
+--engine tex engine (luatex, pdftex, xetex)
+--platform platform (windows, linux, linux-64, osx-intel, osx-ppc)
+--url repository url (rsync://contextgarden.net/minimals)
+--rsync rsync binary (rsync)
+--texroot installation directory (not guessed for the moment)
+--dryrun just show what will be done
+--make also make formats and generate file databases
+--delete delete unused files
+--context=string specify version (current, experimental, yyyy.mm.dd)
+]]
+
+input.verbose = true
+
+if environment.argument("update") then
+ logs.report("update","start")
+ scripts.update.synchronize()
+ logs.report("update","done")
+elseif environment.argument("make") then
+ logs.report("make","start")
+ scripts.update.make()
+ logs.report("make","done")
+else
+ input.help(banner,messages.help)
+end
diff --git a/scripts/context/lua/mtx-watch.lua b/scripts/context/lua/mtx-watch.lua
index 651865ab4..96f6f7eb2 100644
--- a/scripts/context/lua/mtx-watch.lua
+++ b/scripts/context/lua/mtx-watch.lua
@@ -76,10 +76,10 @@ function scripts.watch.watch()
if newpath ~= "" and newpath ~= "." then
local oldpath = lfs.currentdir()
lfs.chdir(newpath)
- if pipe then result = os.resultof(command) else result = os.execute(command) end
+ if pipe then result = os.resultof(command) else result = os.spawn(command) end
lfs.chdir(oldpath)
else
- if pipe then result = os.resultof(command) else result = os.execute(command) end
+ if pipe then result = os.resultof(command) else result = os.spawn(command) end
end
logs.report("watch",string.format("return value: %s", result))
done = true
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 0b6720a4e..d0c7469e0 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -1497,9 +1497,9 @@ end
function os.launch(str)
if os.platform == "windows" then
- os.execute("start " .. str)
+ os.spawn("start " .. str)
else
- os.execute(str .. " &")
+ os.spawn(str .. " &")
end
end
@@ -3914,9 +3914,9 @@ function utils.lua.compile(luafile, lucfile)
if utils.lua.compile_strip then
command = "-s " .. command
end
- if os.execute("texluac " .. command) == 0 then
+ if os.spawn("texluac " .. command) == 0 then
return true
- elseif os.execute("luac " .. command) == 0 then
+ elseif os.spawn("luac " .. command) == 0 then
return true
else
return false
@@ -7322,7 +7322,7 @@ function input.runners.execute_script(instance,fullname,internal)
input.report("executing: " .. command)
input.report("\n \n")
io.flush()
- local code = os.exec(command)
+ local code = os.exec(command) -- maybe spawn
return code == 0
end
end
@@ -7347,7 +7347,7 @@ function input.runners.execute_program(instance,fullname)
input.report("executing: " .. command)
input.report("\n \n")
io.flush()
- local code = os.exec(command) -- (fullname,unpack(after)) does not work
+ local code = os.exec(command) -- (fullname,unpack(after)) does not work / maybe spawn
return code == 0
end
end
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 09a7a2887..eff20a6e8 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2008.01.26 02:30}
+\newcontextversion{2008.01.28 21:28}
%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/context.tex b/tex/context/base/context.tex
index d0291934f..449d667f4 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -42,7 +42,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2008.01.26 02:30}
+\edef\contextversion{2008.01.28 21:28}
%D For those who want to use this:
diff --git a/tex/context/base/core-job.lua b/tex/context/base/core-job.lua
index ce2952ff6..aa3ff9a0e 100644
--- a/tex/context/base/core-job.lua
+++ b/tex/context/base/core-job.lua
@@ -29,27 +29,47 @@ cs.testcase = commands.doifelse
-- main code
-function commands.processfile(name)
- name = input.find_file(texmf.instance,name) or ""
- if name ~= "" then
- tex.sprint(tex.ctxcatcodes,string.format("\\input %s\\relax",name))
+do
+
+ local function find(name,maxreadlevel)
+ local n = "./" .. name
+ if io.exists(n) then
+ return n
+ else
+ n = file.addsuffix(name,'tex')
+ for i=1,maxreadlevel or 0 do
+ n = "../" .. n
+ if io.exists(n) then
+ return n
+ end
+ end
+ end
+ return input.find_file(texmf.instance,name) or ""
end
-end
-function commands.doifinputfileelse(name)
- commands.doifelse((input.find_file(texmf.instance,name) or "") ~= "")
-end
+ function commands.processfile(name,maxreadlevel)
+ name = find(name,maxreadlevel)
+ if name ~= "" then
+ tex.sprint(tex.ctxcatcodes,string.format("\\input %s\\relax",name))
+ end
+ end
-function commands.locatefilepath(name)
- tex.sprint(tex.texcatcodes,file.dirname(input.find_file(texmf.instance,name) or ""))
-end
+ function commands.doifinputfileelse(name,maxreadlevel)
+ commands.doifelse(find(name,maxreadlevel) ~= "")
+ end
-function commands.usepath(paths)
- input.register_extra_path(texmf.instance,paths)
- tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, ""))
-end
+ function commands.locatefilepath(name,maxreadlevel)
+ tex.sprint(tex.texcatcodes,file.dirname(find(name,maxreadlevel)))
+ end
+
+ function commands.usepath(paths,maxreadlevel)
+ input.register_extra_path(texmf.instance,paths)
+ tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, ""))
+ end
+
+ function commands.usesubpath(subpaths,maxreadlevel)
+ input.register_extra_path(texmf.instance,nil,subpaths)
+ tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, ""))
+ end
-function commands.usesubpath(subpaths)
- input.register_extra_path(texmf.instance,nil,subpaths)
- tex.sprint(tex.texcatcodes,table.concat(texmf.instance.extra_paths or {}, ""))
end
diff --git a/tex/context/base/core-job.mkiv b/tex/context/base/core-job.mkiv
index d9cc308f1..82ee878aa 100644
--- a/tex/context/base/core-job.mkiv
+++ b/tex/context/base/core-job.mkiv
@@ -13,9 +13,9 @@
\registerctxluafile{core-job}{1.001}
-\def\processfile #1{\ctxlua{commands.processfile("#1")}}
-\def\doifinputfileelse#1{\ctxlua{commands.doifinputfileelse("#1")}}
-\def\locatefilepath #1{\edef\locatedfilepath{\ctxlua{commands.locatefilepath("#1")}}}
+\def\processfile #1{\ctxlua{commands.processfile("#1",\number\maxreadlevel)}}
+\def\doifinputfileelse#1{\ctxlua{commands.doifinputfileelse("#1",\number\maxreadlevel)}}
+\def\locatefilepath #1{\edef\locatedfilepath{\ctxlua{commands.locatefilepath("#1",\number\maxreadlevel)}}}
\def\usepath [#1]{\edef\allinputpaths{\ctxlua{commands.usepath("#1")}}}
\def\usesubpath [#1]{\edef\allinputpaths{\ctxlua{commands.usesubpath("#1")}}}
diff --git a/tex/context/base/font-otf.lua b/tex/context/base/font-otf.lua
index 58edc4ea2..d283c5543 100644
--- a/tex/context/base/font-otf.lua
+++ b/tex/context/base/font-otf.lua
@@ -16,7 +16,7 @@ if not modules then modules = { } end modules ['font-otf'] = {
-- todo: dependents etc resolve too, maybe even reorder glyphs to unicode
-- todo: pack ignoreflags
--- abvf abvs blwf blwm blws dist falt half halt jalt lfbd ljmo
+-- abvf abvs blwf blws dist falt half halt jalt lfbd ljmo
-- mset opbd palt pwid qwid rand rtbd rtla ruby size tjmo twid valt vatu vert
-- vhal vjmo vkna vkrn vpal vrt2
@@ -1042,37 +1042,7 @@ do
end
fonts.otf.cidmaps = { }
-
---~ function fonts.otf.cidmap(registry,ordering,supplement)
---~ local template = "%s-%s-%s.cidmap"
---~ local filename = string.format(template,registry,ordering,supplement)
---~ local supplement = tonumber(supplement)
---~ local cidmap = fonts.otf.cidmaps[filename]
---~ if not cidmap then
---~ for i=supplement,0,-1 do
---~ logs.report("load otf",string.format("checking cidmap, registry: %s, ordering: %s, supplement: %s",registry,ordering,i))
---~ filename = string.format(template,registry,ordering,i)
---~ local fullname = input.find_file(texmf.instance,filename,'cid') or ""
---~ if fullname ~= "" then
---~ cidmap = fonts.otf.load_cidmap(fullname)
---~ if cidmap then
---~ logs.report("load otf",string.format("using cidmap file %s",filename))
---~ fonts.otf.cidmaps[filename] = cidmap
---~ if i < supplement then
---~ for j=i+1,supplement do
---~ filename = string.format(template,registry,ordering,j)
---~ fonts.otf.cidmaps[filename] = cidmap -- copy of ref
---~ end
---~ end
---~ return cidmap
---~ end
---~ end
---~ end
---~ end
---~ return cidmap
---~ end
-
-fonts.otf.cidmax = 10
+fonts.otf.cidmax = 10
function fonts.otf.cidmap(registry,ordering,supplement)
-- cf Arthur R. we can safely scan upwards since cids are downward compatible
@@ -1184,8 +1154,8 @@ function fonts.otf.enhance.before(data,filename)
end
end
if data.map then
- local uni_to_int = data.map.map
- local int_to_uni = data.map.backmap
+ local uni_to_int = data.map.map -- [unic] = slot
+ local int_to_uni = data.map.backmap -- { [0|1] = unic, ... }
for index, glyph in pairs(data.glyphs) do
if glyph.name then
local unic = glyph.unicode or glyph.unicodeenc or -1
@@ -1321,10 +1291,6 @@ function fonts.otf.enhance.after(data,filename) -- to be split
end
function fonts.otf.enhance.strip(data)
---~ if data.map then
---~ data.map.enc = nil -- not needed
---~ end
---~ data.map = { map = {}, backmap = {} }
for k, v in pairs(data.glyphs) do
local d = v.dependents
if d then v.dependents = nil end
@@ -1484,13 +1450,19 @@ function fonts.otf.analyze_subtables(data)
script = script:lower()
script = script:strip()
sft = subtables[ft]
- sft[script] = sft[script] or { }
local sfts = sft[script]
+ if not sfts then
+ sfts = { }
+ sft[script] = sfts
+ end
for _, language in ipairs(languages) do
language = language:lower()
language = language:strip()
- sfts[language] = sfts[language] or { }
local sftsl = sfts[language]
+ if not sftsl then
+ sftsl = sfts[language] or { }
+ sfts[language] = sftsl
+ end
local lookups, valid = sftsl.lookups or { }, sftsl.valid or { }
for n, subtable in ipairs(v.subtables) do
local stl = subtable.name
@@ -1980,6 +1952,19 @@ end
fonts.otf.default_language = 'latn'
fonts.otf.default_script = 'dflt'
+--~ function fonts.otf.valid_feature(otfdata,kind,script,language) -- return hash is faster
+--~ if otfdata.luatex.ctx_always[kind] then
+--~ script, language = 'dflt', 'dflt'
+--~ else
+--~ script = script or fonts.otf.default_script
+--~ language = language or fonts.otf.default_language
+--~ end
+--~ script, language = script:lower(), language:lower() -- will go away, we will lowercase values
+--~ local ft = otfdata.luatex.subtables[kind]
+--~ local st = ft[script]
+--~ return false, otfdata.luatex.always_valid, st and st[language] and st[language].valid
+--~ end
+
function fonts.otf.valid_feature(otfdata,kind,script,language) -- return hash is faster
if otfdata.luatex.ctx_always[kind] then
script, language = 'dflt', 'dflt'
@@ -1989,10 +1974,27 @@ function fonts.otf.valid_feature(otfdata,kind,script,language) -- return hash is
end
script, language = script:lower(), language:lower() -- will go away, we will lowercase values
local ft = otfdata.luatex.subtables[kind]
- local st = ft[script]
- return false, otfdata.luatex.always_valid, st and st[language] and st[language].valid
+ local st = ft[script] or ft.dflt
+ local lt = st and (st[language] or st.dflt)
+ return false, otfdata.luatex.always_valid, lt.valid
end
+--~ function fonts.otf.some_valid_feature(otfdata,kind,script,language)
+--~ if otfdata.luatex.ctx_always[kind] then
+--~ script, language = 'dflt', 'dflt'
+--~ else
+--~ script = script or fonts.otf.default_script
+--~ language = language or fonts.otf.default_language
+--~ script, language = script:lower(), language:lower() -- will go away, we will lowercase values
+--~ end
+--~ local t = otfdata.luatex.subtables[kind]
+--~ if t and t[script] and t[script][language] and t[script][language].valid then
+--~ return t[script][language].valid
+--~ else
+--~ return { }
+--~ end
+--~ end
+
function fonts.otf.some_valid_feature(otfdata,kind,script,language)
if otfdata.luatex.ctx_always[kind] then
script, language = 'dflt', 'dflt'
@@ -2002,11 +2004,14 @@ function fonts.otf.some_valid_feature(otfdata,kind,script,language)
script, language = script:lower(), language:lower() -- will go away, we will lowercase values
end
local t = otfdata.luatex.subtables[kind]
- if t and t[script] and t[script][language] and t[script][language].valid then
- return t[script][language].valid
- else
- return { }
+ if t then
+ local ts = t[script] or t.dflt
+ if ts then
+ local tsl = ts[language] or ts.dflt
+ return (tsl and tsl.valid) or { }
+ end
end
+ return { }
end
function fonts.otf.features.aux.resolve_ligatures(tfmdata,ligatures,kind)
@@ -2633,8 +2638,10 @@ do
local prepare = fonts.otf.features.prepare.feature
function fonts.initializers.node.otf.aalt(tfm,value) return prepare(tfm,'aalt',value) end
+ function fonts.initializers.node.otf.abvm(tfm,value) return prepare(tfm,'abvm',value) end
function fonts.initializers.node.otf.afrc(tfm,value) return prepare(tfm,'afrc',value) end
function fonts.initializers.node.otf.akhn(tfm,value) return prepare(tfm,'akhn',value) end
+ function fonts.initializers.node.otf.blwm(tfm,value) return prepare(tfm,'blwm',value) end
function fonts.initializers.node.otf.c2pc(tfm,value) return prepare(tfm,'c2pc',value) end
function fonts.initializers.node.otf.c2sc(tfm,value) return prepare(tfm,'c2sc',value) end
function fonts.initializers.node.otf.calt(tfm,value) return prepare(tfm,'calt',value) end
@@ -2950,7 +2957,7 @@ do
if replacements then
start.char = replacements
if fonts.otf.trace_replacements then
- report("process otf",format("%s:%s replacing %s by %s",kind,lookupname,start.char,replacements))
+ report("otf process",format("%s:%s replacing %s by %s",kind,lookupname,start.char,replacements))
end
return start, true
else
@@ -2962,7 +2969,7 @@ do
if alternatives then
start.char = alternatives[1] -- will be preference
if fonts.otf.trace_replacements then
- report("process otf",format("%s:%s alternative %s => %s",kind,lookupname,start.char,table.concat(alternatives,"|")))
+ report("otf process",format("%s:%s alternative %s => %s",kind,lookupname,start.char,table.concat(alternatives,"|")))
end
return start, true
else
@@ -2988,7 +2995,7 @@ do
end
end
if fonts.otf.trace_replacements then
- report("process otf",format("%s:%s alternative %s => %s",kind,lookupname,start.char,table.concat(multiples," ")))
+ report("otf process",format("%s:%s alternative %s => %s",kind,lookupname,start.char,table.concat(multiples," ")))
end
return start, true
else
@@ -3027,7 +3034,7 @@ do
if stop and ligatures[2] then
start = toligature(start,stop,ligatures[2],flags[1],discfound)
if fonts.otf.trace_ligatures then
- report("process otf",format("%s: inserting ligature %s (%s)",kind,start.char,utf.char(start.char)))
+ report("otf process",format("%s: inserting ligature %s (%s)",kind,start.char,utf.char(start.char)))
end
return start, true
end
@@ -3057,7 +3064,7 @@ do
component.xoffset = start.xoffset - dx
component.yoffset = start.yoffset + dy
if trace then
- report("process otf",format("%s: anchoring mark %s to basechar %s => (%s,%s) => (%s,%s)",kind,component.char,start.char,dx,dy,component.xoffset,component.yoffset))
+ report("otf process",format("%s: anchoring mark %s to basechar %s => (%s,%s) => (%s,%s)",kind,component.char,start.char,dx,dy,component.xoffset,component.yoffset))
end
done = true
break
@@ -3106,7 +3113,7 @@ do
component.xoffset = start.xoffset - dx
component.yoffset = start.yoffset + dy
if trace then
- report("process otf",format("%s:%s:%s anchoring mark %s to baselig %s => (%s,%s) => (%s,%s)",kind,anchor,n,component.char,start.char,dx,dy,component.xoffset,component.yoffset))
+ report("otf process",format("%s:%s:%s anchoring mark %s to baselig %s => (%s,%s) => (%s,%s)",kind,anchor,n,component.char,start.char,dx,dy,component.xoffset,component.yoffset))
end
done = true
break
@@ -3157,7 +3164,7 @@ do
component.xoffset = start.xoffset - dx
component.yoffset = start.yoffset + dy
if trace then
- report("process otf",format("%s:%s:%s anchoring mark %s to basemark %s => (%s,%s) => (%s,%s)",kind,anchor,markattr,start.char,component.char,dx,dy,component.xoffset,component.yoffset))
+ report("otf process",format("%s:%s:%s anchoring mark %s to basemark %s => (%s,%s) => (%s,%s)",kind,anchor,markattr,start.char,component.char,dx,dy,component.xoffset,component.yoffset))
end
done = true
break
@@ -3280,6 +3287,9 @@ do
end
else
-- todo, just start, next = node.insert_before(head,next,nodes.kern(scale(kern,factor)))
+ if fonts.otf.trace_kerns then
+ report("otf process",format("%s: inserting kern %s between %s and %s",kind,krn,prev.char,next.char))
+ end
local k = nodes.kern(scale(krn,factor))
k.next = next
k.prev = prev
@@ -3841,8 +3851,10 @@ do
local process = fonts.otf.features.process.feature
function fonts.methods.node.otf.aalt(head,font,attr) return process(head,font,attr,'aalt') end
+ function fonts.methods.node.otf.abvm(head,font,attr) return process(head,font,attr,'abvm') end
function fonts.methods.node.otf.afrc(head,font,attr) return process(head,font,attr,'afrc') end
function fonts.methods.node.otf.akhn(head,font,attr) return process(head,font,attr,'akhn') end
+ function fonts.methods.node.otf.blwm(head,font,attr) return process(head,font,attr,'blwm') end
function fonts.methods.node.otf.c2pc(head,font,attr) return process(head,font,attr,'c2pc') end
function fonts.methods.node.otf.c2sc(head,font,attr) return process(head,font,attr,'c2sc') end
function fonts.methods.node.otf.calt(head,font,attr) return process(head,font,attr,'calt') end
diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua
index 298dfa757..26303ea95 100644
--- a/tex/context/base/l-os.lua
+++ b/tex/context/base/l-os.lua
@@ -10,18 +10,14 @@ function os.resultof(command)
return io.popen(command,"r"):read("*all")
end
-if not os.exec then -- still not ok
- os.exec = os.execute
-end
-if not os.spawn then -- still not ok
- os.spawn = os.execute
-end
+if not os.exec then os.exec = os.execute end
+if not os.spawn then os.spawn = os.execute end
function os.launch(str)
if os.platform == "windows" then
- os.execute("start " .. str)
+ os.execute("start " .. str) -- os.spawn ?
else
- os.execute(str .. " &")
+ os.execute(str .. " &") -- os.spawn ?
end
end
diff --git a/tex/context/base/l-utils.lua b/tex/context/base/l-utils.lua
index c4676a83d..fbc05a26a 100644
--- a/tex/context/base/l-utils.lua
+++ b/tex/context/base/l-utils.lua
@@ -122,9 +122,9 @@ function utils.lua.compile(luafile, lucfile)
if utils.lua.compile_strip then
command = "-s " .. command
end
- if os.execute("texluac " .. command) == 0 then
+ if os.spawn("texluac " .. command) == 0 then
return true
- elseif os.execute("luac " .. command) == 0 then
+ elseif os.spawn("luac " .. command) == 0 then
return true
else
return false
diff --git a/tex/context/base/luat-crl.lua b/tex/context/base/luat-crl.lua
index 129832765..973655999 100644
--- a/tex/context/base/luat-crl.lua
+++ b/tex/context/base/luat-crl.lua
@@ -18,7 +18,7 @@ function curl.fetch(protocol, name)
if not io.exists(cachename) then
curl.cached[name] = cachename
local command = "curl --silent --create-dirs --output " .. cachename .. " " .. protocol .. "://" .. name
- os.execute(command)
+ os.spawn(command)
end
if io.exists(cachename) then
curl.cached[name] = cachename
diff --git a/tex/context/base/luat-lmx.lua b/tex/context/base/luat-lmx.lua
index 75a7098c1..65434668a 100644
--- a/tex/context/base/luat-lmx.lua
+++ b/tex/context/base/luat-lmx.lua
@@ -94,9 +94,9 @@ lmx.lmxfile = function(filename) return filename end
lmx.htmfile = function(filename) return filename end
if environment.platform == "windows" then
- lmx.popupfile = function(filename) os.execute("start " .. filename) end
+ lmx.popupfile = function(filename) os.spawn("start " .. filename) end
else
- lmx.popupfile = function(filename) os.execute(filename) end
+ lmx.popupfile = function(filename) os.spawn(filename) end
end
function lmx.show(name)
diff --git a/tex/context/base/page-flt.tex b/tex/context/base/page-flt.tex
index 0aa8deb45..73410380a 100644
--- a/tex/context/base/page-flt.tex
+++ b/tex/context/base/page-flt.tex
@@ -2290,7 +2290,7 @@
\fi}
\def\flushrestfloats
- {\doif\@@bkcache\v!no\doflushfloats}
+ {\doif\@@bkcache\v!no\doflushsavedfloats}
\def\dopostponeblock
{\bgroup % new may 2004
@@ -2340,8 +2340,7 @@
{\realfolio}{\nofpostponedpageblocks}\to\postponedpageblocks
\egroup
\showmessage\m!layouts3\nofpostponedpageblocks
- \dostartbuffer[rbuf-\nofpostponedpageblocks]%
- [\e!start\v!postponing][\e!stop\v!postponing]}
+ \dostartbuffer[rbuf-\nofpostponedpageblocks][\e!start\v!postponing][\e!stop\v!postponing]}
\def\dodostartpostponing
{\doglobal\increment\nofpostponedblocks
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index 9825860cb..73e54d41b 100644
--- a/tex/context/interface/keys-cz.xml
+++ b/tex/context/interface/keys-cz.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.01.26 02:30">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2008.01.28 21:28">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml
index 3e6509f3d..05c52afd5 100644
--- a/tex/context/interface/keys-de.xml
+++ b/tex/context/interface/keys-de.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.01.26 02:30">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2008.01.28 21:28">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index 54f807058..d17639592 100644
--- a/tex/context/interface/keys-en.xml
+++ b/tex/context/interface/keys-en.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.01.26 02:30">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2008.01.28 21:28">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml
index 08ad77896..66aefca53 100644
--- a/tex/context/interface/keys-fr.xml
+++ b/tex/context/interface/keys-fr.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.01.26 02:30">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2008.01.28 21:28">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml
index 5199ba474..0273a0f65 100644
--- a/tex/context/interface/keys-it.xml
+++ b/tex/context/interface/keys-it.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.01.26 02:30">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2008.01.28 21:28">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index 5a8574699..08d0f48d0 100644
--- a/tex/context/interface/keys-nl.xml
+++ b/tex/context/interface/keys-nl.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.01.26 02:30">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2008.01.28 21:28">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>
diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml
index fd4eee379..a4b84829e 100644
--- a/tex/context/interface/keys-ro.xml
+++ b/tex/context/interface/keys-ro.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.01.26 02:30">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2008.01.28 21:28">
<cd:variables>
<cd:variable name="lesshyphenation" value="lesshyphenation"/>