summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-sys.mkiv76
-rw-r--r--tex/context/base/data-res.lua6
-rw-r--r--tex/context/base/font-syn.lua11
-rw-r--r--tex/context/base/lpdf-mis.lua26
-rw-r--r--tex/context/base/node-ref.lua39
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua2
8 files changed, 127 insertions, 37 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 1b9d7d62e..26860f811 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.08.13 13:13}
+\newcontextversion{2009.08.14 10:48}
%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 c7bf9cdd7..f3c5cdcc5 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.08.13 13:13}
+\edef\contextversion{2009.08.14 10:48}
%D For those who want to use this:
diff --git a/tex/context/base/core-sys.mkiv b/tex/context/base/core-sys.mkiv
index 28ef1e520..f30c8a958 100644
--- a/tex/context/base/core-sys.mkiv
+++ b/tex/context/base/core-sys.mkiv
@@ -268,6 +268,82 @@
\definecomplexorsimpleempty\define
+% \startluacode
+% local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes
+% local format, match, gmatch, rep = string.format, string.match, string.gmatch, string.rep
+% local empty = {
+% "single",
+% "double",
+% "triple",
+% "quadruple",
+% "quintuple",
+% }
+% local check = {
+% "first",
+% "second",
+% "third",
+% "fourth",
+% "fifth",
+% }
+% function commands.define(str)
+% -- we could store the defaults in lua and call lua instead but why bother
+% local arg, cmd = match(str,"(.*)\\(.-)$")
+% local a = { }
+% for s in gmatch(arg,"%[(.-)%]") do
+% a[#a+1] = s
+% end
+% local n = tonumber(a[#a])
+% if n then
+% a[#a] = nil
+% else
+% n = 0
+% end
+% texsprint(ctxcatcodes,format("\\unexpanded\\def\\%s",cmd))
+% if #a > 0 then
+% texsprint(ctxcatcodes,format("{\\do%sempty\\do%s}",empty[#a],cmd))
+% texsprint(ctxcatcodes,format("\\def\\do%s",cmd))
+% for i=1,#a do
+% texsprint(ctxcatcodes,"[#",i,"]")
+% end
+% texsprint(ctxcatcodes,"{")
+% for i=#a,1,-1 do
+% texsprint(ctxcatcodes,format("\\if%sargument",check[i]))
+% texsprint(ctxcatcodes,format("\\def\\next{\\dodo%s",cmd))
+% for j=1,#a-i do
+% texsprint(ctxcatcodes,format("[%s]",a[j]))
+% end
+% for j=1,i do
+% texsprint(ctxcatcodes,format("[#%s]",j))
+% end
+% texsprint(ctxcatcodes,"}")
+% if i == 1 then
+% texsprint(ctxcatcodes,rep("\\fi",#a))
+% else
+% texsprint(ctxcatcodes,"\\else")
+% end
+% end
+% texsprint(ctxcatcodes,"\\next}")
+% texsprint(ctxcatcodes,format("\\def\\dodo%s",cmd))
+% for i=1,#a do
+% texsprint(ctxcatcodes,"[#",i,"]")
+% end
+% end
+% for i=1,n do
+% texsprint(ctxcatcodes,"#",#a+i)
+% end
+% end
+% \stopluacode
+%
+% \def\define#1#{\ctxlua{commands.define([[\detokenize{#1}]])}}
+%
+% \starttext
+% \define[2]\whatevera{#1+#2}
+% \whatevera{A}{B}
+% \define[me][too][2]\whateverb{#1+#2+#3+#4}
+% \whateverb[A]{B}{C}
+% \whateverb[A][B]{C}{D}
+% \stoptext
+
\unexpanded\def\macroname#1% brrr
{\executeifdefined{#1}\empty}
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index da51dc64a..39e4aa208 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -229,12 +229,12 @@ local function reset_hashes()
end
local function check_configuration() -- not yet ok, no time for debugging now
- local ie = instance.environment
+ local ie, iv = instance.environment, instance.variables
local function fix(varname,default)
local proname = varname .. "." .. instance.progname or "crap"
- local p, v = ie[proname], ie[varname]
+ local p, v = ie[proname], ie[varname] or iv[varname]
if not ((p and p ~= "") or (v and v ~= "")) then
- instance.variables[varname] = default -- or environment?
+ iv[varname] = default -- or environment?
end
end
local name = os.name
diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua
index 84bf7f91c..828808ec5 100644
--- a/tex/context/base/font-syn.lua
+++ b/tex/context/base/font-syn.lua
@@ -49,6 +49,8 @@ filters.ttc = fontloader.info
filters.dfont = fontloader.info
function filters.afm(name)
+ -- we could parse the afm file as well, and then report an error but
+ -- it's not worth the trouble
local pfbname = resolvers.find_file(file.removesuffix(name)..".pfb","pfb") or ""
if pfbname == "" then
pfbname = resolvers.find_file(file.removesuffix(file.basename(name))..".pfb","pfb") or ""
@@ -70,7 +72,7 @@ function filters.afm(name)
return hash
end
end
- return nil
+ return nil, "no matching pfb file"
end
function filters.pfb(name)
@@ -239,7 +241,7 @@ function names.identify(verbose) -- lsr is for kpse
logs.report("fontnames","identifying %s font %s",suffix,completename)
logs.push()
end
- local result = filters[lower(suffix)](completename)
+ local result, message = filters[lower(suffix)](completename)
if trace then
logs.pop()
end
@@ -251,6 +253,11 @@ function names.identify(verbose) -- lsr is for kpse
check(result[r],storedname,suffix,true) -- was name
end
end
+ if message and message ~= "" then
+ logs.report("fontnames","warning when identifying %s font %s: %s",suffix,completename,message)
+ end
+ else
+ logs.report("fontnames","error when identifying %s font %s: %s",suffix,completename,message or "unknown")
end
done[name] = true
end
diff --git a/tex/context/base/lpdf-mis.lua b/tex/context/base/lpdf-mis.lua
index e3ed8919d..e47da1c49 100644
--- a/tex/context/base/lpdf-mis.lua
+++ b/tex/context/base/lpdf-mis.lua
@@ -143,18 +143,20 @@ end
local function flushjavascripts()
local t = javascripts.flushpreambles()
- local a = pdfarray()
- local pdf_javascript = pdfconstant("JavaScript")
- for i=1,#t do
- local name, script = t[i][1], t[i][2]
- local j = pdfdictionary {
- S = pdf_javascript,
- JS = pdfreference(pdfimmediateobj("stream",script)),
- }
- a[#a+1] = pdfstring(name)
- a[#a+1] = pdfreference(pdfimmediateobj(tostring(j)))
- end
- lpdf.addtonames("JavaScript",pdfreference(pdfimmediateobj(tostring(pdfdictionary{ Names = a }))))
+ if #t > 0 then
+ local a = pdfarray()
+ local pdf_javascript = pdfconstant("JavaScript")
+ for i=1,#t do
+ local name, script = t[i][1], t[i][2]
+ local j = pdfdictionary {
+ S = pdf_javascript,
+ JS = pdfreference(pdfimmediateobj("stream",script)),
+ }
+ a[#a+1] = pdfstring(name)
+ a[#a+1] = pdfreference(pdfimmediateobj(tostring(j)))
+ end
+ lpdf.addtonames("JavaScript",pdfreference(pdfimmediateobj(tostring(pdfdictionary{ Names = a }))))
+ end
end
lpdf.registerdocumentfinalizer(flushjavascripts)
diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua
index 873302d6b..85d7e869e 100644
--- a/tex/context/base/node-ref.lua
+++ b/tex/context/base/node-ref.lua
@@ -40,28 +40,33 @@ local traverse = node.traverse
local find_node_tail = node.tail or node.slide
local tosequence = nodes.tosequence
---~ local copy_list = node.copy_list
---~ local flush_list = node.flush_list
---~
---~ local function dimensions(parent,start,stop) -- so we need parent for glue_set info
---~ local n = stop.next
---~ stop.next = nil
---~ local p = hpack_list(copy_list(start))
---~ stop.next = n
---~ local w, h, d = p.width, p.height, p.depth
---~ flush_list(p)
---~ return w, h, d
---~ end
-
-local function dimensions(parent,start,stop) -- so we need parent for glue_set info
+local function dimensions(parent,start,stop)
stop = stop and stop.next
- if stop then
- return list_dimensions(start,stop)
+ if parent then
+ if stop then
+ return list_dimensions(parent.glue_set,parent.glue_sign,parent.glue_order,start,stop)
+ else
+ return list_dimensions(parent.glue_set,parent.glue_sign,parent.glue_order,start)
+ end
else
- return list_dimensions(start)
+ if stop then
+ return list_dimensions(start,stop)
+ else
+ return list_dimensions(start)
+ end
end
end
+--~ more compact
+--~
+--~ local function dimensions(parent,start,stop)
+--~ if parent then
+--~ return list_dimensions(parent.glue_set,parent.glue_sign,parent.glue_order,start,stop and stop.next)
+--~ else
+--~ return list_dimensions(start,stop and stop.next)
+--~ end
+--~ end
+
local function inject_range(head,first,last,reference,make,stack,parent,pardir,txtdir)
local width, height, depth = dimensions(parent,first,last)
if pardir == "TRT" or txtdir == "+TRT" then
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index a17ea5411..6e2436369 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 : 08/13/09 13:15:16
+-- merge date : 08/14/09 10:50:13
do -- begin closure to overcome local limits and interference