summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tex/context/base/attr-ini.lua2
-rw-r--r--tex/context/base/char-def.lua2
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.mkiv12
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-spa.mkiv6
-rw-r--r--tex/context/base/data-tex.lua1
-rw-r--r--tex/context/base/data-tmp.lua4
-rw-r--r--tex/context/base/enco-def.tex5
-rw-r--r--tex/context/base/font-afm.lua9
-rw-r--r--tex/context/base/font-def.lua29
-rw-r--r--tex/context/base/font-dum.lua3
-rw-r--r--tex/context/base/font-log.lua15
-rw-r--r--tex/context/base/font-otn.lua2
-rw-r--r--tex/context/base/font-tfm.lua7
-rw-r--r--tex/context/base/l-io.lua1
-rw-r--r--tex/context/base/l-table.lua6
-rw-r--r--tex/context/base/lpdf-ini.lua115
-rw-r--r--tex/context/base/luat-cnf.lua1
-rw-r--r--tex/context/base/luat-fio.lua10
-rw-r--r--tex/context/base/luat-ini.lua9
-rw-r--r--tex/context/base/luat-ini.mkiv29
-rw-r--r--tex/context/base/luat-sto.lua1
-rw-r--r--tex/context/base/lxml-tab.lua2
-rw-r--r--tex/context/base/math-noa.lua2
-rw-r--r--tex/context/base/node-pro.lua8
-rw-r--r--tex/context/base/node-seq.lua33
-rw-r--r--tex/context/base/node-shp.lua2
-rw-r--r--tex/context/base/node-tsk.lua79
-rw-r--r--tex/context/base/strc-pag.mkiv79
-rw-r--r--tex/context/base/strc-ref.lua4
-rw-r--r--tex/context/base/strc-ref.mkiv75
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua50
33 files changed, 446 insertions, 161 deletions
diff --git a/tex/context/base/attr-ini.lua b/tex/context/base/attr-ini.lua
index 7480da873..a7d09bba1 100644
--- a/tex/context/base/attr-ini.lua
+++ b/tex/context/base/attr-ini.lua
@@ -214,7 +214,7 @@ function colors.setmodel(attribute,name,weightgray)
return colors.default
end
-function colors.register(attribute, name, colorspace, ...) -- passing 9 vars is faster
+function colors.register(attribute, name, colorspace, ...) -- passing 9 vars is faster (but not called that often)
local stamp = format(templates[colorspace],...)
local color = registered[stamp]
if not color then
diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua
index 2cc7eee39..76bdcabfb 100644
--- a/tex/context/base/char-def.lua
+++ b/tex/context/base/char-def.lua
@@ -48709,7 +48709,7 @@ characters.data={
},
[0x2009]={
category="zs",
- contextname="thinspace",
+ contextname="breakablethinspace",
description="THIN SPACE",
direction="ws",
linebreak="ba",
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index a453c1160..3c495173a 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{2009.06.10 11:22}
+\newcontextversion{2009.06.11 00:07}
%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.mkiv b/tex/context/base/context.mkiv
index 18a999574..fc3149f6b 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -299,12 +299,12 @@
\loadcorefile{lang-spa.tex}
-\loadcorefile{xtag-ini.tex}
-\loadcorefile{xtag-ext.tex}
-\loadcorefile{xtag-exp.tex}
-\loadcorefile{xtag-pre.tex}
-\loadcorefile{xtag-xsd.tex}
-\loadcorefile{xtag-rng.tex}
+\loadcorefile{xtag-ini.tex} % might go away
+\loadcorefile{xtag-ext.tex} % might go away
+\loadcorefile{xtag-exp.tex} % will go away
+\loadcorefile{xtag-pre.tex} % has old encoding code
+\loadcorefile{xtag-xsd.tex} % will go away (stub anyway)
+\loadcorefile{xtag-rng.tex} % will go away (stub anyway)
\loadcorefile{meta-xml.tex}
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index d94c0cc91..a57ccc0a2 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2009.06.10 11:22}
+\edef\contextversion{2009.06.11 00:07}
%D For those who want to use this:
diff --git a/tex/context/base/core-spa.mkiv b/tex/context/base/core-spa.mkiv
index 1a4e2825d..fbc949349 100644
--- a/tex/context/base/core-spa.mkiv
+++ b/tex/context/base/core-spa.mkiv
@@ -3581,8 +3581,8 @@
%D Taken from Taco's math module (cq. \AMS\ macros), but
%D adapted to \type {\hspace}:
-\unexpanded\def\textormathspace#1#2#3%
- {\ifmmode\mskip#1#2\else\kern#1\hspaceamount\empty{#3}\fi\relax}
+\unexpanded\def\textormathspace #1#2#3{\ifmmode\mskip#1#2\else\kern #1\hspaceamount\empty{#3}\fi\relax}
+\unexpanded\def\breakabletextormathspace#1#2#3{\ifmmode\mskip#1#2\else\hskip#1\hspaceamount\empty{#3}\fi\relax}
\newmuskip\hairmuskip \hairmuskip=.15mu
@@ -3597,6 +3597,8 @@
% needed for unicode:
+\unexpanded\def\breakablethinspace {\breakabletextormathspace+\thinmuskip 1}
+
\unexpanded\def\twoperemspace {\hskip\dimexpr\emwidth/2\relax} % == \enspace
\unexpanded\def\threeperemspace {\hskip\dimexpr\emwidth/3\relax}
\unexpanded\def\fourperemspace {\hskip\dimexpr\emwidth/4\relax}
diff --git a/tex/context/base/data-tex.lua b/tex/context/base/data-tex.lua
index 792c48fec..16b6b125f 100644
--- a/tex/context/base/data-tex.lua
+++ b/tex/context/base/data-tex.lua
@@ -134,6 +134,7 @@ function openers.text_opener(filename,file_handle,tag)
logs.show_close(filename)
file_handle:close()
t = nil
+collectgarbage("step")
end,
handle = function()
return file_handle
diff --git a/tex/context/base/data-tmp.lua b/tex/context/base/data-tmp.lua
index 31d0147ea..72875dcb7 100644
--- a/tex/context/base/data-tmp.lua
+++ b/tex/context/base/data-tmp.lua
@@ -133,7 +133,9 @@ function caches.loaddata(path,name)
local tmaname, tmcname = caches.setluanames(path,name)
local loader = loadfile(tmcname) or loadfile(tmaname)
if loader then
- return loader()
+ loader = loader()
+ collectgarbage("step")
+ return loader
else
return false
end
diff --git a/tex/context/base/enco-def.tex b/tex/context/base/enco-def.tex
index a0631ac25..b6d66bb6c 100644
--- a/tex/context/base/enco-def.tex
+++ b/tex/context/base/enco-def.tex
@@ -505,7 +505,8 @@
\definecharacter greekbeta {\beta}
\definecharacter greekgamma {\gamma}
\definecharacter greekdelta {\delta}
-\definecharacter greekepsilon {\epsilon}
+\definecharacter greekepsilon {\varepsilon}
+\definecharacter greekepsilonalt {\epsilon}
\definecharacter greekzeta {\zeta}
\definecharacter greeketa {\eta}
\definecharacter greektheta {\theta}
@@ -519,8 +520,8 @@
\definecharacter greekomicron {\omicron}
\definecharacter greekpi {\pi}
\definecharacter greekrho {\rho}
-\definecharacter greekfinalsigma {\sigma}
\definecharacter greeksigma {\sigma}
+\definecharacter greekfinalsigma {\varsigma}
\definecharacter greektau {\tau}
\definecharacter greekupsilon {\upsilon}
\definecharacter greekphi {\varphi}
diff --git a/tex/context/base/font-afm.lua b/tex/context/base/font-afm.lua
index 6cc227588..931f7d118 100644
--- a/tex/context/base/font-afm.lua
+++ b/tex/context/base/font-afm.lua
@@ -646,14 +646,7 @@ end
function afm.afm_to_tfm(specification)
local afmname = specification.filename or specification.name
- local encoding, filename = match(afmname,"^(.-)%-(.*)$") -- context: encoding-name.*
- if encoding and filename and fonts.enc.known[encoding] then
- tfm.set_normal_feature(specification,'encoding',encoding) -- will go away
- if trace_loading then
- logs.report("load afm","stripping encoding prefix from filename %s",afmname)
- end
- afmname = filename
- elseif specification.forced == "afm" or specification.format == "afm" then -- move this one up
+ if specification.forced == "afm" or specification.format == "afm" then -- move this one up
if trace_loading then
logs.report("load afm","forcing afm format for %s",afmname)
end
diff --git a/tex/context/base/font-def.lua b/tex/context/base/font-def.lua
index cb4721e7c..eca631184 100644
--- a/tex/context/base/font-def.lua
+++ b/tex/context/base/font-def.lua
@@ -43,6 +43,8 @@ tfm.internalized = tfm.internalized or { } -- internal tex numbers
tfm.readers.sequence = { 'otf', 'ttf', 'afm', 'tfm' }
+tfm.auto_afm = true
+
local readers = tfm.readers
local sequence = readers.sequence
@@ -334,10 +336,31 @@ local function check_tfm(specification,fullname)
end
end
+--~ local function check_afm(specification,fullname)
+--~ fullname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure
+--~ if fullname ~= "" then
+--~ specification.filename, specification.format = fullname, "afm"
+--~ return tfm.read_from_afm(specification)
+--~ end
+--~ end
+
local function check_afm(specification,fullname)
- fullname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure
- if fullname ~= "" then
- specification.filename, specification.format = fullname, "afm"
+ local foundname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure
+ if foundname == "" and tfm.auto_afm then
+ local encoding, shortname = match(fullname,"^(.-)%-(.*)$") -- context: encoding-name.*
+ if encoding and shortname and fonts.enc.known[encoding] then
+ shortname = resolvers.findbinfile(shortname,'afm') or "" -- just to be sure
+ if shortname ~= "" then
+ foundname = shortname
+ -- tfm.set_normal_feature(specification,'encoding',encoding) -- will go away
+ if trace_loading then
+ logs.report("load afm","stripping encoding prefix from filename %s",afmname)
+ end
+ end
+ end
+ end
+ if foundname ~= "" then
+ specification.filename, specification.format = foundname, "afm"
return tfm.read_from_afm(specification)
end
end
diff --git a/tex/context/base/font-dum.lua b/tex/context/base/font-dum.lua
index 0d28128d8..5ae53d0f4 100644
--- a/tex/context/base/font-dum.lua
+++ b/tex/context/base/font-dum.lua
@@ -111,3 +111,6 @@ end
fonts.initializers.base.otf.itlc = itlc
fonts.initializers.node.otf.itlc = itlc
+
+function fonts.register_message()
+end
diff --git a/tex/context/base/font-log.lua b/tex/context/base/font-log.lua
index 499bd4304..af0b2552f 100644
--- a/tex/context/base/font-log.lua
+++ b/tex/context/base/font-log.lua
@@ -23,18 +23,23 @@ function fonts.logger.save(tfmtable,source,specification) -- save file name in s
if tfmtable and specification and specification.specification then
local name = lower(specification.name)
if trace_defining and not fonts.used[name] then
- logs.report("define font","registering %s as %s",file.basename(specification.name),source)
+ logs.report("define font","registering %s as %s (used: %s)",file.basename(specification.name),source,file.basename(specification.filename))
end
specification.source = source
fonts.loaded[lower(specification.specification)] = specification
- fonts.used[name] = source
+ -- fonts.used[name] = source
+ fonts.used[lower(specification.filename or specification.name)] = source
end
end
-function fonts.logger.report()
+function fonts.logger.report(complete)
local t = { }
for name, used in table.sortedpairs(fonts.used) do
- t[#t+1] = file.basename(name) .. ":" .. used
+ if complete then
+ t[#t+1] = used .. "->" .. file.basename(name)
+ else
+ t[#t+1] = file.basename(name)
+ end
end
return t
end
@@ -45,7 +50,7 @@ end
statistics.register("loaded fonts", function()
if next(fonts.used) then
- local t = fonts.logger.report(separator)
+ local t = fonts.logger.report()
return (#t > 0 and format("%s files: %s",#t,concat(t,separator or " "))) or "none"
else
return nil
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index d23a8a080..719c0ca80 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -1762,7 +1762,7 @@ function otf.setcontextchain(method)
logwarning("installing contextchain handler '%s'",method)
local handler = otf.chainhandlers[method]
handlers.contextchain = function(...)
- return handler(currentfont,...)
+ return handler(currentfont,...) -- hm, get rid of ...
end
end
handlers.gsub_context = handlers.contextchain
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index 02b546269..472f69c8c 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -540,11 +540,6 @@ function tfm.do_scale(tfmtable, scaledpoints)
-- we have t.name=metricfile and t.fullname=RealName and t.filename=diskfilename
-- when collapsing fonts, luatex looks as both t.name and t.fullname as ttc files
-- can have multiple subfonts
---~ collectgarbage("collect")
---~ t.fontname = t.fontname or t.fullname
---~ t.name = t.name or t.fontname
---~ print(t.fullname,table.serialize(characters[string.byte('W')].kerns))
---~ print(t.id,t.fullname)
return t, delta
end
@@ -692,7 +687,7 @@ function tfm.enhance(tfmdata,specification)
tfmdata.shared = tfmdata.shared or { }
tfmdata.shared.features = features
-- tfmdata.shared.tfmdata = tfmdata -- circular
-tfmdata.filename = specification.name
+ tfmdata.filename = specification.name
if not features.encoding then
local name, size = specification.name, specification.size
local encoding, filename = match(name,"^(.-)%-(.*)$") -- context: encoding-name.*
diff --git a/tex/context/base/l-io.lua b/tex/context/base/l-io.lua
index 4b937a322..bcdf8791e 100644
--- a/tex/context/base/l-io.lua
+++ b/tex/context/base/l-io.lua
@@ -17,6 +17,7 @@ end
function io.loaddata(filename,textmode)
local f = io.open(filename,(textmode and 'r') or 'rb')
if f then
+ -- collectgarbage("step") -- sometimes makes a big difference in mem consumption
local data = f:read('*all')
-- garbagecollector.check(data)
f:close()
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua
index bfe33ff85..399e51eab 100644
--- a/tex/context/base/l-table.lua
+++ b/tex/context/base/l-table.lua
@@ -26,6 +26,10 @@ function table.strip(tab)
return lst
end
+local function compare(a,b)
+ return (tostring(a) < tostring(b))
+end
+
local function sortedkeys(tab)
local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed
for key,_ in next, tab do
@@ -46,7 +50,7 @@ local function sortedkeys(tab)
end
end
if kind == 0 or kind == 3 then
- sort(srt,function(a,b) return (tostring(a) < tostring(b)) end)
+ sort(srt,compare)
else
sort(srt)
end
diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua
index 4676ad7c2..92207d728 100644
--- a/tex/context/base/lpdf-ini.lua
+++ b/tex/context/base/lpdf-ini.lua
@@ -6,9 +6,10 @@ if not modules then modules = { } end modules ['back-pdf'] = {
license = "see context related readme files"
}
-local setmetatable, getmetatable, type, next, tostring = setmetatable, getmetatable, type, next, tostring
-local char, byte, format, gsub = string.char, string.byte, string.format, string.gsub
-local concat = table.concat
+-- This code is very experimental !
+
+local setmetatable, getmetatable, type, next, tostring, tonumber = setmetatable, getmetatable, type, next, tostring, tonumber
+local char, byte, format, gsub, concat = string.char, string.byte, string.format, string.gsub, table.concat
local utfvalues = string.utfvalues
lpdf = lpdf or { }
@@ -37,7 +38,7 @@ local function merge_t(a,b)
return setmetatable(t,getmetatable(a))
end
-local tostring_a, tostring_d, tosting_n, tostring_s, tostring_c
+local tostring_a, tostring_d
tostring_d = function(t)
if not next(t) then
@@ -93,27 +94,30 @@ tostring_a = function(t)
end
end
-tostring_n = function(t)
- return tostring(t[1]) -- tostring not needed
-end
-
-tostring_s = function(t)
- return tosixteen(t[1])
-end
-
-tostring_c = function(t)
- return t[1]
-end
-
-local mt_d = { __lpdftype = "dictionary", __tostring = tostring_d }
-local mt_a = { __lpdftype = "array", __tostring = tostring_a }
-local mt_s = { __lpdftype = "string", __tostring = tostring_s }
-local mt_n = { __lpdftype = "number", __tostring = tostring_n }
-local mt_c = { __lpdftype = "constant", __tostring = tostring_c }
-
-local mt_z = { __lpdftype = "null", __tostring = function(s) return "null" end }
-local mt_t = { __lpdftype = "true", __tostring = function(s) return "true" end }
-local mt_f = { __lpdftype = "false", __tostring = function(s) return "false" end }
+local tostring_s = function(t) return tosixteen(t[1]) end
+local tostring_n = function(t) return tostring(t[1]) end -- tostring not needed
+local tostring_c = function(t) return t[1] end -- already prefixed (hashed)
+local tostring_z = function() return "null" end
+local tostring_t = function() return "true" end
+local tostring_f = function() return "false" end
+
+local function value_s(t) return t[1] end -- the call is experimental
+local function value_n(t) return t[1] end -- the call is experimental
+local function value_c(t) return sub(t[1],2) end -- the call is experimental
+local function value_d(t) return t end -- the call is experimental
+local function value_a(t) return t end -- the call is experimental
+local function value_z() return nil end -- the call is experimental
+local function value_t() return true end -- the call is experimental
+local function value_b() return false end -- the call is experimental
+
+local mt_d = { __lpdftype = "dictionary", __tostring = tostring_d, __call = value_d }
+local mt_a = { __lpdftype = "array", __tostring = tostring_a, __call = value_a }
+local mt_s = { __lpdftype = "string", __tostring = tostring_s, __call = value_s }
+local mt_n = { __lpdftype = "number", __tostring = tostring_n, __call = value_n }
+local mt_c = { __lpdftype = "constant", __tostring = tostring_c, __call = value_c }
+local mt_z = { __lpdftype = "null", __tostring = tostring_z, __call = value_z }
+local mt_t = { __lpdftype = "true", __tostring = tostring_t, __call = value_t }
+local mt_f = { __lpdftype = "false", __tostring = tostring_f, __call = value_f }
function lpdf.dictionary(t)
return setmetatable(t or { },mt_d)
@@ -165,10 +169,12 @@ local p_null = { } setmetatable(p_null, mt_z)
local p_true = { } setmetatable(p_true, mt_t)
local p_false = { } setmetatable(p_false,mt_f)
-function lpdf.null () return p_null end
+function lpdf.null()
+ return p_null
+end
function lpdf.boolean(b,default)
- if (type(b) == boolean and b) or default then
+ if ((type(b) == boolean) and b) or default then
return p_true
else
return p_false
@@ -205,3 +211,58 @@ end
--~ local d = lpdf.array()
--~ d[#d+1] = { a=1, b=2, c=3, d="test" }
--~ print(d)
+
+--~ local s = lpdf.boolean(false)
+--~ print(s()) -- fails somehow
+
+function lpdf.checkedkey(t,key,kind)
+ local pn = t[key]
+ if pn then
+ local tn = type(pn)
+ if tn == kind then
+ if kind == "string" then
+ return pn ~= "" and pn
+ elseif kind == "table" then
+ return next(pn) and pn
+ else
+ return pn
+ end
+ elseif tn == "string" and kind == "number" then
+ return tonumber(pn)
+ end
+ end
+end
+
+function lpdf.checkedvalue(value,kind) -- code not shared
+ if value then
+ local tv = type(value)
+ if tv == kind then
+ if kind == "string" then
+ return value ~= "" and value
+ elseif kind == "table" then
+ return next(value) and value
+ else
+ return value
+ end
+ elseif tv == "string" and kind == "number" then
+ return tonumber(value)
+ end
+ end
+end
+
+function lpdf.limited(n,min,max,default)
+ if not n then
+ return default
+ else
+ n = tonumber(n)
+ if not n then
+ return default
+ elseif n > max then
+ return max
+ elseif n < min then
+ return min
+ else
+ return n
+ end
+ end
+end
diff --git a/tex/context/base/luat-cnf.lua b/tex/context/base/luat-cnf.lua
index 9f237b981..4cfc7278e 100644
--- a/tex/context/base/luat-cnf.lua
+++ b/tex/context/base/luat-cnf.lua
@@ -67,6 +67,7 @@ function texconfig.init()
local i = start
while b[i] do
b[i]() ; b[i] = nil ; i = i + 1
+ -- collectgarbage('step')
end
return i - start
end
diff --git a/tex/context/base/luat-fio.lua b/tex/context/base/luat-fio.lua
index 3f42b4497..d8a9a27bf 100644
--- a/tex/context/base/luat-fio.lua
+++ b/tex/context/base/luat-fio.lua
@@ -56,19 +56,21 @@ if not resolvers.instance then
-- image
callback.register('read_map_file' , function(file) return resolvers.loadbinfile(file,"map") end)
callback.register('read_ocp_file' , function(file) return resolvers.loadbinfile(file,"ocp") end)
- -- callback.register('read_opentype_file' , function(file) return resolvers.loadbinfile(file,"otf") end)
-- output
callback.register('read_pk_file' , function(file) return resolvers.loadbinfile(file,"pk") end)
callback.register('read_sfd_file' , function(file) return resolvers.loadbinfile(file,"sfd") end)
- -- callback.register('read_truetype_file' , function(file) return resolvers.loadbinfile(file,"ttf") end)
- -- callback.register('read_type1_file' , function(file) return resolvers.loadbinfile(file,"pfb") end)
callback.register('read_vf_file' , function(file) return resolvers.loadbinfile(file,"vf" ) end)
callback.register('find_font_file' , function(name) return resolvers.findbinfile(name,"ofm") end)
- callback.register('read_font_file' , function(file) return resolvers.loadbinfile(file,"ofm") end)
callback.register('find_vf_file' , function(name) return resolvers.findbinfile(name,"ovf") end)
+
+ callback.register('read_font_file' , function(file) return resolvers.loadbinfile(file,"ofm") end)
callback.register('read_vf_file' , function(file) return resolvers.loadbinfile(file,"ovf") end)
+ -- callback.register('read_opentype_file' , function(file) return resolvers.loadbinfile(file,"otf") end)
+ -- callback.register('read_truetype_file' , function(file) return resolvers.loadbinfile(file,"ttf") end)
+ -- callback.register('read_type1_file' , function(file) return resolvers.loadbinfile(file,"pfb") end)
+
callback.register('find_write_file' , function(id,name) return name end)
callback.register('find_format_file' , function(name) return name end)
diff --git a/tex/context/base/luat-ini.lua b/tex/context/base/luat-ini.lua
index d9f39e61b..34b59d7e8 100644
--- a/tex/context/base/luat-ini.lua
+++ b/tex/context/base/luat-ini.lua
@@ -14,10 +14,11 @@ These can be used for runtime user data or third party modules and will not be
cluttered by macro package code.</p>
--ldx]]--
-userdata = userdata or { } -- might be used
-thirddata = thirddata or { } -- might be used
-moduledata = moduledata or { } -- might be used
-document = document or { }
+userdata = userdata or { } -- might be used
+thirddata = thirddata or { } -- might be used
+moduledata = moduledata or { } -- might be used
+document = document or { }
+parametersets = parametersets or { } -- experimental
--[[ldx--
<p>These can be used/set by the caller program; <t>mtx-context.lua</t> does it.</p>
diff --git a/tex/context/base/luat-ini.mkiv b/tex/context/base/luat-ini.mkiv
index 265f1b643..2a132c38e 100644
--- a/tex/context/base/luat-ini.mkiv
+++ b/tex/context/base/luat-ini.mkiv
@@ -215,4 +215,33 @@
\def\luaexpanded#1{\luaescapestring\expandafter{\normalexpanded{#1}}}
+%D Experimental:
+
+\def\startluaparameterset[#1]%
+ {\begingroup
+ \obeylualines
+ \obeyluatokens
+ \dostartluaparameterset{#1}}
+
+\long\def\dostartluaparameterset#1#2\stopluaparameterset
+ {\ctxlua{parametersets["#1"]={#2}}%
+ \endgroup}
+
+\def\luaparameterset#1#2{\ctxlua{parametersets["#1"]={#2} tex.sprint("#1")}}
+
+% todo: \mergeparameterset
+
+% usage:
+%
+% \startluaparameterset [u3d:myset:display:1]
+% toolbar=false,
+% tree=true
+% \stopluaparameterset
+%
+% options=u3d:myset:display:1
+%
+% or:
+%
+% options=\luaparameterset{u3d:myset:display:1}{toolbar=false,tree=true}
+
\protect \endinput
diff --git a/tex/context/base/luat-sto.lua b/tex/context/base/luat-sto.lua
index 10de76b28..6fea91514 100644
--- a/tex/context/base/luat-sto.lua
+++ b/tex/context/base/luat-sto.lua
@@ -78,6 +78,7 @@ function storage.dump()
code = initialize .. table.serialize(original,name) .. finalize
end
lua.bytecode[storage.max] = loadstring(code)
+ collectgarbage("step")
end
end
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index a35e64270..6ceadb678 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -668,7 +668,7 @@ function xml.tostring(root) -- 25% overhead due to collecting
return root
elseif next(root) then -- next is faster than type (and >0 test)
local result = { }
- serialize(root,function(s) result[#result+1] = s end)
+ serialize(root,function(s) result[#result+1] = s end) -- brrr, slow (direct printing is faster)
return concat(result,"")
end
end
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 6cdcc0114..bbbd5285e 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -314,7 +314,7 @@ tasks.new (
--~ tasks.appendaction("math", "normalizers", "noads.respace_characters", nil, "nohead")
--~ tasks.appendaction("math", "builders", "noads.mlist_to_hlist", nil, "notail")
-local actions = tasks.actions("math")
+local actions = tasks.actions("math",2) -- head, tail, style, penalties
local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming
diff --git a/tex/context/base/node-pro.lua b/tex/context/base/node-pro.lua
index a14ccc1a1..708237838 100644
--- a/tex/context/base/node-pro.lua
+++ b/tex/context/base/node-pro.lua
@@ -30,11 +30,7 @@ lists = lists or { }
chars = chars or { }
words = words or { } -- not used yet
--- or just:
---
--- nodes.process_page = tasks.actions("shipouts")
-
-local actions = tasks.actions("processors")
+local actions = tasks.actions("processors",2) -- head, tail, where, boolean
local n = 0
@@ -120,7 +116,7 @@ end
callback.register('pre_linebreak_filter', nodes.processors.pre_linebreak_filter)
callback.register('hpack_filter' , nodes.processors.hpack_filter)
-local actions = tasks.actions("finalizers")
+local actions = tasks.actions("finalizers",2) -- head, tail, where, boolean
-- beware, these are packaged boxes so no first_character test
-- maybe some day a hash with valid groupcodes
diff --git a/tex/context/base/node-seq.lua b/tex/context/base/node-seq.lua
index a4a8ad055..b8c432223 100644
--- a/tex/context/base/node-seq.lua
+++ b/tex/context/base/node-seq.lua
@@ -79,13 +79,13 @@ function sequencer.removeaction(t,group,action,force)
end
end
-function sequencer.compile(t,compiler)
+function sequencer.compile(t,compiler,n)
if type(t) == "string" then
-- already compiled
elseif compiler then
- t = compiler(t)
+ t = compiler(t,n)
else
- t = sequencer.tostring(t)
+ t = sequencer.tostring(t,n)
end
return loadstring(t)()
end
@@ -100,7 +100,7 @@ return function(...)
%s
end]]
-function sequencer.tostring(t)
+function sequencer.tostring(t,n) -- n not done
local list, order, kind, vars, calls = t.list, t.order, t.kind, { }, { }
for i=1,#order do
local group = order[i]
@@ -117,14 +117,23 @@ end
local template = [[
%s
-return function(head,tail,...)
+return function(head,tail%s)
local ok, done = false, false
%s
return head, tail, done
end]]
-function sequencer.nodeprocessor(t)
- local list, order, kind, vars, calls = t.list, t.order, t.kind, { }, { }
+function sequencer.nodeprocessor(t,n)
+ local list, order, kind, vars, calls, args = t.list, t.order, t.kind, { }, { }, nil
+ if n == 0 then
+ args = ""
+ elseif n == 1 then
+ args = ",one"
+ elseif n == 2 then
+ args = ",one,two"
+ else
+ args = ",..."
+ end
for i=1,#order do
local group = order[i]
local actions = list[group]
@@ -133,16 +142,16 @@ function sequencer.nodeprocessor(t)
local localized = localize(action)
vars[#vars+1] = format("local %s = %s",localized,action)
if kind[action] == "nohead" then
- calls[#calls+1] = format(" ok = %s(head,tail,...) done = done or ok -- %s %i",localized,group,i)
+ calls[#calls+1] = format(" ok = %s(head,tail%s) done = done or ok -- %s %i",localized,args,group,i)
elseif kind[action] == "notail" then
- calls[#calls+1] = format(" head, ok = %s(head,tail,...) done = done or ok -- %s %i",localized,group,i)
+ calls[#calls+1] = format(" head, ok = %s(head,tail%s) done = done or ok -- %s %i",localized,args,group,i)
else
- calls[#calls+1] = format(" head, tail, ok = %s(head,tail,...) done = done or ok -- %s %i",localized,group,i)
+ calls[#calls+1] = format(" head, tail, ok = %s(head,tail%s) done = done or ok -- %s %i",localized,args,group,i)
end
end
end
- local processor = format(template,concat(vars,"\n"),concat(calls,"\n"))
---~ print(processor)
+ local processor = format(template,concat(vars,"\n"),args,concat(calls,"\n"))
+ -- print(processor)
return processor
end
diff --git a/tex/context/base/node-shp.lua b/tex/context/base/node-shp.lua
index 0383d8c40..48dd8c5c7 100644
--- a/tex/context/base/node-shp.lua
+++ b/tex/context/base/node-shp.lua
@@ -59,7 +59,7 @@ function nodes.cleanup_page(head)
return head, false
end
-local actions = tasks.actions("shipouts")
+local actions = tasks.actions("shipouts",0) -- no extra arguments
function nodes.process_page(head) -- problem, attr loaded before node, todo ...
return actions(head) -- no tail
diff --git a/tex/context/base/node-tsk.lua b/tex/context/base/node-tsk.lua
index c10c0c32e..bfa9f1196 100644
--- a/tex/context/base/node-tsk.lua
+++ b/tex/context/base/node-tsk.lua
@@ -57,19 +57,80 @@ function tasks.showactions(name,group,action,where,kind)
end
end
-function tasks.actions(name)
+-- Optimizing for the number of arguments makes sense, but getting rid of
+-- the nested call (no problem but then we also need to register the
+-- callback with this mechanism so that it gets updated) does not save
+-- much time (24K calls on mk.tex).
+
+local created, total = 0, 0
+
+statistics.register("node list callback tasks", function()
+ if total > 0 then
+ return string.format("%s unique tasks, %s created, %s calls",table.count(tasks.data),created,total)
+ else
+ return nil
+ end
+end)
+
+function tasks.actions(name,n) -- we optimize for the number or arguments (no ...)
local data = tasks.data[name]
if data then
- return function(head,tail,...)
- local runner = data.runner
- if not runner then
- if trace_tasks then
- logs.report("nodes","creating task runner '%s'",name)
+ if n == 0 then
+ return function(head,tail)
+ local runner = data.runner
+ total = total + 1 -- will go away
+ if not runner then
+ created = created + 1
+ if trace_tasks then
+ logs.report("nodes","creating task runner '%s'",name)
+ end
+ runner = sequencer.compile(data.list,sequencer.nodeprocessor,0)
+ data.runner = runner
+ end
+ return runner(head,tail)
+ end
+ elseif n == 1 then
+ return function(head,tail,one)
+ total = total + 1 -- will go away
+ local runner = data.runner
+ if not runner then
+ created = created + 1
+ if trace_tasks then
+ logs.report("nodes","creating task runner '%s'",name)
+ end
+ runner = sequencer.compile(data.list,sequencer.nodeprocessor,1)
+ data.runner = runner
+ end
+ return runner(head,tail,one)
+ end
+ elseif n == 2 then
+ return function(head,tail,one,two)
+ total = total + 1 -- will go away
+ local runner = data.runner
+ if not runner then
+ created = created + 1
+ if trace_tasks then
+ logs.report("nodes","creating task runner '%s'",name)
+ end
+ runner = sequencer.compile(data.list,sequencer.nodeprocessor,2)
+ data.runner = runner
+ end
+ return runner(head,tail,one,two)
+ end
+ else
+ return function(head,tail,...)
+ total = total + 1 -- will go away
+ local runner = data.runner
+ if not runner then
+ created = created + 1
+ if trace_tasks then
+ logs.report("nodes","creating task runner '%s'",name)
+ end
+ runner = sequencer.compile(data.list,sequencer.nodeprocessor,3)
+ data.runner = runner
end
- runner = sequencer.compile(data.list,sequencer.nodeprocessor)
- data.runner = runner
+ return runner(head,tail,...)
end
- return runner(head,tail,...)
end
else
return nil
diff --git a/tex/context/base/strc-pag.mkiv b/tex/context/base/strc-pag.mkiv
index 1c4534ede..b4286f970 100644
--- a/tex/context/base/strc-pag.mkiv
+++ b/tex/context/base/strc-pag.mkiv
@@ -150,9 +150,62 @@
% Counters
-\def\firstpage {1} \def\prevpage {1} \def\nextpage {1} \def\lastpage {1}
-\def\firstuserpage{1} \def\prevuserpage{1} \def\nextuserpage{1} \def\lastuserpage{1}
-\def\firstsubpage {1} \def\prevsubpage {1} \def\nextsubpage {1} \def\lastsubpage {1}
+% \def\firstpage {1} \def\prevpage {1} \def\nextpage {1} \def\lastpage {1}
+% \def\firstuserpage{1} \def\prevuserpage{1} \def\nextuserpage{1} \def\lastuserpage{1}
+% \def\firstsubpage {1} \def\prevsubpage {1} \def\nextsubpage {1} \def\lastsubpage {1}
+
+% \def\firstrealpage{\firststructurecounter[\s!realpage]}
+% \def\prevrealpage {\prevstructurecounter [\s!realpage]}
+% \def\nextrealpage {\nextstructurecounter [\s!realpage]}
+% \def\lastrealpage {\laststructurecounter [\s!realpage]}
+
+% \let\firstpage\firstrealpage
+% \let\prevpage \prevrealpage
+% \let\nextpage \nextrealpage
+% \let\lastpage \lastrealpage
+
+\def\firstrealpagenumber{\convertedstructurecounter[\s!realpage][\c!type=\v!first]}
+\def\firstuserpagenumber{\convertedstructurecounter[\s!userpage][\c!type=\v!first]}
+\def\firstsubpagenumber {\convertedstructurecounter[\s!subpage ][\c!type=\v!first]}
+
+\def\lastrealpagenumber {\convertedstructurecounter[\s!realpage][\c!type=\v!last]}
+\def\lastuserpagenumber {\convertedstructurecounter[\s!userpage][\c!type=\v!last]}
+\def\lastsubpagenumber {\convertedstructurecounter[\s!subpage ][\c!type=\v!last]}
+
+\def\prevrealpagenumber {\convertedstructurecounter[\s!realpage][\c!type=\v!previous]}
+\def\prevuserpagenumber {\convertedstructurecounter[\s!userpage][\c!type=\v!previous]}
+\def\prevsubpagenumber {\convertedstructurecounter[\s!subpage ][\c!type=\v!previous]}
+
+\def\nextrealpagenumber {\convertedstructurecounter[\s!realpage][\c!type=\v!next]}
+\def\nextuserpagenumber {\convertedstructurecounter[\s!userpage][\c!type=\v!next]}
+\def\nextsubpagenumber {\convertedstructurecounter[\s!subpage ][\c!type=\v!next]}
+
+\def\firstrealpage{\firststructurecounter[\s!realpage]}
+\def\firstuserpage{\firststructurecounter[\s!userpage]}
+\def\firstsubpage {\firststructurecounter[\s!subpage ]}
+
+\def\prevrealpage {\prevstructurecounter [\s!realpage]}
+\def\prevuserpage {\prevstructurecounter [\s!userpage]}
+\def\prevsubpage {\prevstructurecounter [\s!subpage ]}
+
+\def\nextrealpage {\nextstructurecounter [\s!realpage]}
+\def\nextuserpage {\nextstructurecounter [\s!userpage]}
+\def\nextsubpage {\nextstructurecounter [\s!subpage ]}
+
+\def\lastrealpage {\laststructurecounter [\s!realpage]}
+\def\lastuserpage {\laststructurecounter [\s!userpage]}
+\def\lastsubpage {\laststructurecounter [\s!subpage ]}
+
+\let\firstpage\firstrealpage
+\let\prevpage \prevrealpage
+\let\nextpage \nextrealpage
+\let\lastpage \lastrealpage
+
+% Compatibility counters:
+
+\def\nofrealpages {\lastrealpage} \def\totalnumberofpages{\lastrealpage}
+\def\nofuserpages {\lastuserpage} \def\lastpagenumber {\lastuserpage}
+\def\nofsubpages {\lastsubpage }
% Renderers:
@@ -193,29 +246,9 @@
\def\userpage{\userfolio}
\def\subpage {\subfolio}
-% \def\firstrealpage{\firstpage}
-% \def\prevrealpage {\prevpage}
-% \def\nextrealpage {\nextpage}
-% \def\lastrealpage {\lastpage}
-
-\def\firstrealpage{\firststructurecounter[\s!realpage]}
-\def\prevrealpage {\prevstructurecounter[\s!realpage]}
-\def\nextrealpage {\nextstructurecounter[\s!realpage]}
-\def\lastrealpage {\laststructurecounter[\s!realpage]}
-
-\let\firstpage\firstrealpage
-\let\prevpage \prevrealpage
-\let\nextpage \nextrealpage
-\let\lastpage \lastrealpage
-
-\def\nofrealpages {\lastrealpage} \def\totalnumberofpages{\lastrealpage}
-\def\nofuserpages {\lastuserpage} \def\lastpagenumber {\lastuserpage}
-\def\nofsubpages {\lastsubpage }
-
% Hooks:
\appendtoks
-% \xdef\lastpage{\laststructurecounter[\s!realpage]}%
\xdef\currentpage{\the\realpageno}%
\ifnum\realpageno>\lastpage \globallet\lastpage\lastrealpage \fi
\to \everyinitializepagecounters
diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua
index 3ee01b127..92cc15df3 100644
--- a/tex/context/base/strc-ref.lua
+++ b/tex/context/base/strc-ref.lua
@@ -190,7 +190,7 @@ function jobreferences.urls.get(name,method,space) -- method: none, before, afte
local u = urls[name]
if u then
local url, file = u[1], u[2]
- if file ~= "" then
+ if file and file ~= "" then
texsprint(ctxcatcodes,url,"/",file)
else
texsprint(ctxcatcodes,url)
@@ -246,7 +246,7 @@ function jobreferences.from(name,method,space)
local url, file, description = u[1], u[2], u[3]
if description ~= "" then
texsprint(ctxcatcodes,description)
- elseif file then
+ elseif file and file ~= "" then
texsprint(ctxcatcodes,url,"/",file)
else
texsprint(ctxcatcodes,url)
diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv
index 23fc3e01e..ec88fe725 100644
--- a/tex/context/base/strc-ref.mkiv
+++ b/tex/context/base/strc-ref.mkiv
@@ -1236,27 +1236,63 @@
% inefficient, we need to save the shared one (just reuse last command in lua)
+% \def\dogotospace#1[#2]%
+% {\iflocationsplit
+% \ifsecondaryreference
+% \setbox\scratchbox\hbox % will change anyway
+% \fi % due to space insertion
+% {\let\dogotospace\dogotofixed
+% \iflocation
+% \def\processisolatedword##1%
+% {\ifisolatedwords\ifsharesimilarreferences
+% \global\advance\similarreference \plusone
+% \fi\fi
+% \hbox\bgroup
+% \doprocessreferenceelse{#2}{##1\presetgoto}{\unknownreference{#2}##1\relax}%
+% \egroup}%
+% \dosetfontattribute \??ia\c!style
+% \dosetcolorattribute\??ia\c!color
+% \processisolatedwords{#1}\processisolatedword
+% \else
+% #1\relax % \relax prevents #1's next macros from gobbling \fi
+% \fi}%
+% \else
+% \iflocation
+% \hbox{\doattributes\??ia\c!style\c!color{\doprocessreferenceelse{#2}{#1\presetgoto}{\unknownreference{#2}#1\relax}}}%
+% \else
+% #1\relax % \relax prevents #1's next macros from gobbling \fi
+% \fi
+% \fi
+% \global\similarreference\zerocount}
+
+\def\dogotoprocessisolatedword#1#2%
+ {\ifisolatedwords\ifsharesimilarreferences
+ \global\advance\similarreference \plusone
+ \fi\fi
+ \hbox\bgroup
+ \doprocessreferenceelse{#1}{#2\presetgoto}{\unknownreference{#1}#2\relax}%
+ \egroup}%
+
\def\dogotospace#1[#2]%
{\iflocationsplit
- \ifsecondaryreference
- \setbox\scratchbox\hbox % will change anyway
- \fi % due to space insertion
- {\let\dogotospace\dogotofixed
- \iflocation
- \def\processisolatedword##1%
- {\ifisolatedwords\ifsharesimilarreferences
- \global\advance\similarreference \plusone
- \fi\fi
- \hbox\bgroup
- \doprocessreferenceelse{#2}{##1\presetgoto}{\unknownreference{#2}##1\relax}%
- \egroup}%
- \doattributes\??ia\c!style\c!color{\processisolatedwords{#1}\processisolatedword}%
- \else
- #1\relax % \relax prevents #1's next macros from gobbling \fi
- \fi}%
+ \ifsecondaryreference\setbox\scratchbox\hbox\fi % due to space insertion
+ \bgroup
+ \let\dogotospace\dogotofixed
+ \iflocation
+ \dosetfontattribute \??ia\c!style
+ \dosetcolorattribute\??ia\c!color
+ \processisolatedwords{#1}{\dogotoprocessisolatedword{#2}}%
+ \else
+ #1\relax % \relax prevents #1's next macros from gobbling \fi
+ \fi
+ \egroup
\else
\iflocation
- \hbox{\doattributes\??ia\c!style\c!color{\doprocessreferenceelse{#2}{#1\presetgoto}{\unknownreference{#2}#1\relax}}}%
+ \hbox\bgroup
+ \dosetfontattribute \??ia\c!style
+ \dosetcolorattribute\??ia\c!color
+ \doprocessreferenceelse{#2}{#1\presetgoto}{\unknownreference{#2}#1\relax}%
+ \egroup%
\else
#1\relax % \relax prevents #1's next macros from gobbling \fi
\fi
@@ -1332,8 +1368,8 @@
%D specified. This is logical when one keeps in mind that a
%D valid \URL\ can also be a mail address.
-\def\usefile{\dotripleargument\dousefile}
-\def\useurl {\doquadrupleempty\douseurl}
+\unexpanded\def\usefile{\dotripleargument\dousefile} % so that they can be used in expanded arguments
+\unexpanded\def\useurl {\doquadrupleempty\douseurl } % so that they can be used in expanded arguments
\let\useURL \useurl
\let\useexternaldocument\usefile
@@ -1373,7 +1409,6 @@
\dosetfontattribute\??ur\c!style
\dosetcolorattribute\??ur\c!color
\ctxlua{jobreferences.urls.get("#1","\@@uralternative","\@@urspace")}%
- \dostopattributes
\endgroup}
%D This macro is hooked into a support macro, and thereby
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 06a81b123..d1a4c8772 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua
--- merge date : 06/10/09 11:24:52
+-- merge date : 06/11/09 00:09:35
do -- begin closure to overcome local limits and interference
@@ -483,6 +483,10 @@ function table.strip(tab)
return lst
end
+local function compare(a,b)
+ return (tostring(a) < tostring(b))
+end
+
local function sortedkeys(tab)
local srt, kind = { }, 0 -- 0=unknown 1=string, 2=number 3=mixed
for key,_ in next, tab do
@@ -503,7 +507,7 @@ local function sortedkeys(tab)
end
end
if kind == 0 or kind == 3 then
- sort(srt,function(a,b) return (tostring(a) < tostring(b)) end)
+ sort(srt,compare)
else
sort(srt)
end
@@ -1553,6 +1557,7 @@ end
function io.loaddata(filename,textmode)
local f = io.open(filename,(textmode and 'r') or 'rb')
if f then
+ -- collectgarbage("step") -- sometimes makes a big difference in mem consumption
local data = f:read('*all')
-- garbagecollector.check(data)
f:close()
@@ -3776,11 +3781,6 @@ function tfm.do_scale(tfmtable, scaledpoints)
-- we have t.name=metricfile and t.fullname=RealName and t.filename=diskfilename
-- when collapsing fonts, luatex looks as both t.name and t.fullname as ttc files
-- can have multiple subfonts
---~ collectgarbage("collect")
---~ t.fontname = t.fontname or t.fullname
---~ t.name = t.name or t.fontname
---~ print(t.fullname,table.serialize(characters[string.byte('W')].kerns))
---~ print(t.id,t.fullname)
return t, delta
end
@@ -3928,7 +3928,7 @@ function tfm.enhance(tfmdata,specification)
tfmdata.shared = tfmdata.shared or { }
tfmdata.shared.features = features
-- tfmdata.shared.tfmdata = tfmdata -- circular
-tfmdata.filename = specification.name
+ tfmdata.filename = specification.name
if not features.encoding then
local name, size = specification.name, specification.size
local encoding, filename = match(name,"^(.-)%-(.*)$") -- context: encoding-name.*
@@ -8982,7 +8982,7 @@ function otf.setcontextchain(method)
logwarning("installing contextchain handler '%s'",method)
local handler = otf.chainhandlers[method]
handlers.contextchain = function(...)
- return handler(currentfont,...)
+ return handler(currentfont,...) -- hm, get rid of ...
end
end
handlers.gsub_context = handlers.contextchain
@@ -10332,6 +10332,8 @@ tfm.internalized = tfm.internalized or { } -- internal tex numbers
tfm.readers.sequence = { 'otf', 'ttf', 'afm', 'tfm' }
+tfm.auto_afm = true
+
local readers = tfm.readers
local sequence = readers.sequence
@@ -10623,10 +10625,31 @@ local function check_tfm(specification,fullname)
end
end
+--~ local function check_afm(specification,fullname)
+--~ fullname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure
+--~ if fullname ~= "" then
+--~ specification.filename, specification.format = fullname, "afm"
+--~ return tfm.read_from_afm(specification)
+--~ end
+--~ end
+
local function check_afm(specification,fullname)
- fullname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure
- if fullname ~= "" then
- specification.filename, specification.format = fullname, "afm"
+ local foundname = resolvers.findbinfile(fullname, 'afm') or "" -- just to be sure
+ if foundname == "" and tfm.auto_afm then
+ local encoding, shortname = match(fullname,"^(.-)%-(.*)$") -- context: encoding-name.*
+ if encoding and shortname and fonts.enc.known[encoding] then
+ shortname = resolvers.findbinfile(shortname,'afm') or "" -- just to be sure
+ if shortname ~= "" then
+ foundname = shortname
+ -- tfm.set_normal_feature(specification,'encoding',encoding) -- will go away
+ if trace_loading then
+ logs.report("load afm","stripping encoding prefix from filename %s",afmname)
+ end
+ end
+ end
+ end
+ if foundname ~= "" then
+ specification.filename, specification.format = foundname, "afm"
return tfm.read_from_afm(specification)
end
end
@@ -11101,4 +11124,7 @@ end
fonts.initializers.base.otf.itlc = itlc
fonts.initializers.node.otf.itlc = itlc
+function fonts.register_message()
+end
+
end -- closure