summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-12-30 10:15:04 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-12-30 10:15:04 +0100
commitfa8e5e0451dd0e800f5133b4425042579e68a522 (patch)
tree42690aa293cd1bb0e03cc5c9003ab756a2c55b0a /tex
parent58ef50aaa4e2f8acb02f7362f85aa5a958944c38 (diff)
downloadcontext-fa8e5e0451dd0e800f5133b4425042579e68a522.tar.gz
2014-12-30 09:50:00
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/cont-run.lua4
-rw-r--r--tex/context/base/context-version.pdfbin4386 -> 4386 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/data-res.lua32
-rw-r--r--tex/context/base/lpdf-tag.lua345
-rw-r--r--tex/context/base/luat-iop.lua26
-rw-r--r--tex/context/base/s-typesetting-kerning.mkiv46
-rw-r--r--tex/context/base/status-files.pdfbin24855 -> 24874 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin345890 -> 345890 bytes
-rw-r--r--tex/context/base/typo-krn.mkiv2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
12 files changed, 334 insertions, 127 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 59e353485..7d03cf1a5 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2014.12.29 10:01}
+\newcontextversion{2014.12.30 09:48}
%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/cont-run.lua b/tex/context/base/cont-run.lua
index 01090119d..da3fee9f1 100644
--- a/tex/context/base/cont-run.lua
+++ b/tex/context/base/cont-run.lua
@@ -178,7 +178,9 @@ function commands.processjob()
local suffix = environment.suffix
local filename = environment.filename -- hm, not inputfilename !
- if suffix == "xml" or arguments.forcexml then
+ if not filename or filename == "" then
+ -- skip
+ elseif suffix == "xml" or arguments.forcexml then
-- Maybe we should move the preamble parsing here as it
-- can be part of (any) loaded (sub) file. The \starttext
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 269a3647b..7b10218d4 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index f2a040c30..a533be7f9 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2014.12.29 10:01}
+\edef\contextversion{2014.12.30 09:48}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index 8ae0500cd..dbd212921 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -240,6 +240,7 @@ function resolvers.newinstance() -- todo: all vars will become lowercase and alp
foundintrees = allocate(),
hashes = allocate(),
hashed = allocate(),
+ pathlists = false,-- delayed
specification = allocate(),
lists = allocate(),
data = allocate(), -- only for loading
@@ -252,7 +253,6 @@ function resolvers.newinstance() -- todo: all vars will become lowercase and alp
savelists = true,
pattern = nil, -- lists
force_suffixes = true,
- pathstack = { },
}
setmetatableindex(variables,function(t,k)
@@ -309,8 +309,14 @@ function resolvers.reset()
end
local function reset_hashes()
- instance.lists = { }
- instance.found = { }
+ instance.lists = { }
+ instance.pathlists = false
+ instance.found = { }
+end
+
+local function reset_caches()
+ instance.lists = { }
+ instance.pathlists = false
end
local slash = P("/")
@@ -733,10 +739,11 @@ local done = { }
function resolvers.resetextrapath()
local ep = instance.extra_paths
if not ep then
- ep, done = { }, { }
- instance.extra_paths = ep
+ done = { }
+ instance.extra_paths = { }
elseif #ep > 0 then
- instance.lists, done = { }, { }
+ done = { }
+ reset_caches()
end
end
@@ -796,7 +803,7 @@ function resolvers.registerextrapath(paths,subpaths)
instance.extra_paths = ep -- register paths
end
if newn > oldn then
- instance.lists = { } -- erase the cache
+ reset_caches()
end
end
@@ -884,7 +891,7 @@ function resolvers.expandpathfromvariable(str)
return joinpath(resolvers.expandedpathlistfromvariable(str))
end
-function resolvers.cleanedpathlist(v)
+function resolvers.cleanedpathlist(v) -- can be cached if needed
local t = resolvers.expandedpathlist(v)
for i=1,#t do
t[i] = resolvers.resolve(resolvers.cleanpath(t[i]))
@@ -1351,7 +1358,7 @@ end
-- we could probably move some to a higher level but then we need to adapt
-- more code ... maybe some day
-local pathlists = setmetatableindex(function(list,filetype)
+local function makepathlist(list,filetype)
local typespec = resolvers.variableofformat(filetype)
local pathlist = resolvers.expandedpathlist(typespec,filetype and usertypes[filetype]) -- only extra path with user files
local entry = { }
@@ -1383,13 +1390,18 @@ local pathlists = setmetatableindex(function(list,filetype)
list[filetype] = false
end
return entry
-end)
+end
-- pathlist : resolved
-- dirlist : unresolved or resolved
-- filelist : unresolved
local function find_intree(filename,filetype,wantedfiles,allresults)
+ local pathlists = instance.pathlists
+ if not pathlists then
+ pathlists = setmetatableindex(allocate(),makepathlist)
+ instance.pathlists = pathlists
+ end
local pathlist = pathlists[filetype]
if pathlist then
-- list search
diff --git a/tex/context/base/lpdf-tag.lua b/tex/context/base/lpdf-tag.lua
index 904d5b196..dbe4d3f1e 100644
--- a/tex/context/base/lpdf-tag.lua
+++ b/tex/context/base/lpdf-tag.lua
@@ -157,10 +157,10 @@ local pdf_mcr = pdfconstant("MCR")
local pdf_struct_element = pdfconstant("StructElem")
local function initializepage()
- index = 0
+ index = 0
pagenum = texgetcount("realpageno")
pageref = pdfreference(pdfpagereference(pagenum))
- list = pdfarray()
+ list = pdfarray()
tree[pagenum] = list -- we can flush after done, todo
end
@@ -231,16 +231,16 @@ local function makeelement(fulltag,parent)
return e
end
-local f_BDC = formatters["/%s <</MCID %s>>BDC"]
+local f_BDC = formatters["/%s <</MCID %s>> BDC"]
-local function makecontent(parent,start,stop,slist,id)
+local function makecontent(parent,id)
local tag = parent.tag
local kids = parent.kids
local last = index
if id == "image" then
local d = pdfdictionary {
Type = pdf_mcr,
- -- Pg = pageref,
+ Pg = pageref,
MCID = last,
Alt = "image",
}
@@ -250,104 +250,108 @@ local function makecontent(parent,start,stop,slist,id)
else
local d = pdfdictionary {
Type = pdf_mcr,
- -- Pg = pageref,
+ Pg = pageref,
MCID = last,
}
-- kids[#kids+1] = pdfreference(pdfflushobject(d))
kids[#kids+1] = d
end
--
- local bliteral = pdfliteral(f_BDC(tag,last))
- local eliteral = pdfliteral("EMC") -- could be a copy
- -- use insert instead:
- local prev = getprev(start)
- if prev then
- setfield(prev,"next",bliteral)
- setfield(bliteral,"prev",prev)
- end
- setfield(start,"prev",bliteral)
- setfield(bliteral,"next",start)
- -- use insert instead:
- local next = getnext(stop)
- if next then
- setfield(next,"prev",eliteral)
- setfield(eliteral,"next",next)
- end
- setfield(stop,"next",eliteral)
- setfield(eliteral,"prev",stop)
- --
- if slist and getlist(slist) == start then
- setfield(slist,"list",bliteral)
- elseif not getprev(start) then
- report_tags("this can't happen: injection in front of nothing")
- end
index = index + 1
- list[index] = parent.pref
- return bliteral, eliteral
+ list[index] = parent.pref -- page related list
+ --
+ return f_BDC(tag,last)
end
--- -- --
-
-local level, last, ranges, range = 0, nil, { }, nil
-
-local function collectranges(head,list)
- for n in traverse_nodes(head) do
- local id = getid(n) -- 14: image, 8: literal (mp)
- if id == glyph_code then
- local at = getattr(n,a_tagged)
- if not at then
- range = nil
- elseif last ~= at then
- range = { at, "glyph", n, n, list } -- attr id start stop list
- ranges[#ranges+1] = range
- last = at
- elseif range then
- range[4] = n -- stop
- end
- elseif id == hlist_code or id == vlist_code then
- local at = getattr(n,a_image)
- if at then
+-- no need to adapt head, as we always operate on lists
+
+function nodeinjections.addtags(head)
+
+ local last = nil
+ local ranges = { }
+ local range = nil
+ local head = tonut(head)
+
+ local function collectranges(head,list)
+ for n in traverse_nodes(head) do
+ local id = getid(n) -- 14: image, 8: literal (mp)
+ if id == glyph_code then
local at = getattr(n,a_tagged)
if not at then
range = nil
+ elseif last ~= at then
+ range = { at, "glyph", n, n, list } -- attr id start stop list
+ ranges[#ranges+1] = range
+ last = at
+ elseif range then
+ range[4] = n -- stop
+ end
+ elseif id == hlist_code or id == vlist_code then
+ local at = getattr(n,a_image)
+ if at then
+ local at = getattr(n,a_tagged)
+ if not at then
+ range = nil
+ else
+ ranges[#ranges+1] = { at, "image", n, n, list } -- attr id start stop list
+ end
+ last = nil
else
- ranges[#ranges+1] = { at, "image", n, n, list } -- attr id start stop list
+ local nl = getlist(n)
+ -- slide_nodelist(nl) -- temporary hack till math gets slided (tracker item)
+ collectranges(nl,n)
end
- last = nil
- else
- local nl = getlist(n)
- -- slide_nodelist(nl) -- temporary hack till math gets slided (tracker item)
- collectranges(nl,n)
end
end
end
-end
-function nodeinjections.addtags(head)
- -- no need to adapt head, as we always operate on lists
- level, last, ranges, range = 0, nil, { }, nil
initializepage()
- head = tonut(head)
+
collectranges(head)
+
if trace_tags then
for i=1,#ranges do
local range = ranges[i]
- local attr, id, start, stop = range[1], range[2], range[3], range[4]
- local tags = taglist[attr]
+ local attr = range[1]
+ local id = range[2]
+ local start = range[3]
+ local stop = range[4]
+ local tags = taglist[attr]
if tags then -- not ok ... only first lines
- report_tags("%s => %s : %05i % t",tosequence(start,start),tosequence(stop,stop),attr,tags)
+ report_tags("%s => %s : %05i % t",tosequence(start,start),tosequence(stop,stop),attr,tags.taglist)
end
end
end
+
+ local top = nil
+ local noftop = 0
+
for i=1,#ranges do
- local range = ranges[i]
- local attr, id, start, stop, list = range[1], range[2], range[3], range[4], range[5]
+ local range = ranges[i]
+ local attr = range[1]
+ local id = range[2]
+ local start = range[3]
+ local stop = range[4]
+ local list = range[5]
local specification = taglist[attr]
- local list = specification.taglist
- local prev = root
- local noftags, tag = #list, nil
- for j=1,noftags do
- local tag = list[j]
+ local taglist = specification.taglist
+ local noftags = #taglist
+ local common = 0
+
+ if top then
+ for i=1,noftags >= noftop and noftop or noftags do
+ if top[i] == taglist[i] then
+ common = i
+ else
+ break
+ end
+ end
+ end
+
+ local prev = common > 0 and elements[taglist[common]] or root
+
+ for j=common+1,noftags do
+ local tag = taglist[j]
local prv = elements[tag] or makeelement(tag,prev)
if prv == false then
-- ignore this one
@@ -359,25 +363,198 @@ function nodeinjections.addtags(head)
prev = prv
end
end
+
if prev then
- local b, e = makecontent(prev,start,stop,list,id)
- if start == head then
- report_tags("this can't happen: parent list gets tagged")
- head = b
+ -- use insert instead:
+ local literal = pdfliteral(makecontent(prev,id))
+ local prev = getprev(start)
+ if prev then
+ setfield(prev,"next",literal)
+ setfield(literal,"prev",prev)
+ end
+ setfield(start,"prev",literal)
+ setfield(literal,"next",start)
+ if list and getlist(list) == start then
+ setfield(list,"list",literal)
end
- else
- -- ignored content
+ -- use insert instead:
+ local literal = pdfliteral("EMC")
+ local next = getnext(stop)
+ if next then
+ setfield(next,"prev",literal)
+ setfield(literal,"next",next)
+ end
+ setfield(stop,"next",literal)
+ setfield(literal,"prev",stop)
end
+ top = taglist
+ noftop = noftags
end
+
finishpage()
- -- can be separate feature
- --
- -- injectspans(tonut(head)) -- does to work yet
- --
+
head = tonode(head)
return head, true
+
end
+-- variant: more structure but funny collapsing in viewer
+
+-- function nodeinjections.addtags(head)
+--
+-- local last, ranges, range = nil, { }, nil
+--
+-- local function collectranges(head,list)
+-- for n in traverse_nodes(head) do
+-- local id = getid(n) -- 14: image, 8: literal (mp)
+-- if id == glyph_code then
+-- local at = getattr(n,a_tagged)
+-- if not at then
+-- range = nil
+-- elseif last ~= at then
+-- range = { at, "glyph", n, n, list } -- attr id start stop list
+-- ranges[#ranges+1] = range
+-- last = at
+-- elseif range then
+-- range[4] = n -- stop
+-- end
+-- elseif id == hlist_code or id == vlist_code then
+-- local at = getattr(n,a_image)
+-- if at then
+-- local at = getattr(n,a_tagged)
+-- if not at then
+-- range = nil
+-- else
+-- ranges[#ranges+1] = { at, "image", n, n, list } -- attr id start stop list
+-- end
+-- last = nil
+-- else
+-- local nl = getlist(n)
+-- -- slide_nodelist(nl) -- temporary hack till math gets slided (tracker item)
+-- collectranges(nl,n)
+-- end
+-- end
+-- end
+-- end
+--
+-- initializepage()
+--
+-- head = tonut(head)
+-- collectranges(head)
+--
+-- if trace_tags then
+-- for i=1,#ranges do
+-- local range = ranges[i]
+-- local attr = range[1]
+-- local id = range[2]
+-- local start = range[3]
+-- local stop = range[4]
+-- local tags = taglist[attr]
+-- if tags then -- not ok ... only first lines
+-- report_tags("%s => %s : %05i % t",tosequence(start,start),tosequence(stop,stop),attr,tags.taglist)
+-- end
+-- end
+-- end
+--
+-- local top = nil
+-- local noftop = 0
+-- local last = nil
+--
+-- for i=1,#ranges do
+-- local range = ranges[i]
+-- local attr = range[1]
+-- local id = range[2]
+-- local start = range[3]
+-- local stop = range[4]
+-- local list = range[5]
+-- local specification = taglist[attr]
+-- local taglist = specification.taglist
+-- local noftags = #taglist
+-- local tag = nil
+-- local common = 0
+-- -- local prev = root
+--
+-- if top then
+-- for i=1,noftags >= noftop and noftop or noftags do
+-- if top[i] == taglist[i] then
+-- common = i
+-- else
+-- break
+-- end
+-- end
+-- end
+--
+-- local result = { }
+-- local r = noftop - common
+-- if r > 0 then
+-- for i=1,r do
+-- result[i] = "EMC"
+-- end
+-- end
+--
+-- local prev = common > 0 and elements[taglist[common]] or root
+--
+-- for j=common+1,noftags do
+-- local tag = taglist[j]
+-- local prv = elements[tag] or makeelement(tag,prev)
+-- -- if prv == false then
+-- -- -- ignore this one
+-- -- prev = false
+-- -- break
+-- -- elseif prv == true then
+-- -- -- skip this one
+-- -- else
+-- prev = prv
+-- r = r + 1
+-- result[r] = makecontent(prev,id)
+-- -- end
+-- end
+--
+-- if r > 0 then
+-- local literal = pdfliteral(concat(result,"\n"))
+-- -- use insert instead:
+-- local literal = pdfliteral(result)
+-- local prev = getprev(start)
+-- if prev then
+-- setfield(prev,"next",literal)
+-- setfield(literal,"prev",prev)
+-- end
+-- setfield(start,"prev",literal)
+-- setfield(literal,"next",start)
+-- if list and getlist(list) == start then
+-- setfield(list,"list",literal)
+-- end
+-- end
+--
+-- top = taglist
+-- noftop = noftags
+-- last = stop
+--
+-- end
+--
+-- if last and noftop > 0 then
+-- local result = { }
+-- for i=1,noftop do
+-- result[i] = "EMC"
+-- end
+-- local literal = pdfliteral(concat(result,"\n"))
+-- -- use insert instead:
+-- local next = getnext(last)
+-- if next then
+-- setfield(next,"prev",literal)
+-- setfield(literal,"next",next)
+-- end
+-- setfield(last,"next",literal)
+-- setfield(literal,"prev",last)
+-- end
+--
+-- finishpage()
+--
+-- head = tonode(head)
+-- return head, true
+--
+-- end
+
-- this belongs elsewhere (export is not pdf related)
function codeinjections.enabletags(tg,lb)
diff --git a/tex/context/base/luat-iop.lua b/tex/context/base/luat-iop.lua
index efb383c57..e1772af4e 100644
--- a/tex/context/base/luat-iop.lua
+++ b/tex/context/base/luat-iop.lua
@@ -6,32 +6,6 @@ if not modules then modules = { } end modules ['luat-iop'] = {
license = "see context related readme files"
}
--- local input_mode directives.register("system.inputmode", function(v) input_mode = v end)
--- local output_mode directives.register("system.outputmode",function(v) output_mode = v end)
-
--- limiters = {
--- input = {
--- paranoid = {
--- { "permit", "^[^/]+$" },
--- { "permit", "^./" },
--- { "forbid", ".." },
--- { "tree" , "TEXMF" },
--- { "tree" , "MPINPUTS" },
--- { "tree" , "TEXINPUTS" },
--- { "forbid", "^/.." },
--- { "forbid", "^[a-c]:/.." },
--- },
--- },
--- output = {
--- paranoid = {
--- { "permit", "^[^/]+$" },
--- { "permit", "^./" },
--- },
--- }
--- }
-
--- sandbox.registerroot(".","write") -- always ok
-
local cleanedpathlist = resolvers.cleanedpathlist
local registerroot = sandbox.registerroot
diff --git a/tex/context/base/s-typesetting-kerning.mkiv b/tex/context/base/s-typesetting-kerning.mkiv
index 074861713..b0c972627 100644
--- a/tex/context/base/s-typesetting-kerning.mkiv
+++ b/tex/context/base/s-typesetting-kerning.mkiv
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+\unprotect
+
\definecharacterkerning
[typesetting-kerning-demo]
[factor=.5]
@@ -113,14 +115,54 @@
\getbuffer[showcharacterkerning:explicits]
\stoptexdefinition
+\starttexdefinition showcharacterkerningsteps [#1]
+
+ \startTEXpage[\c!offset=1ex]
+
+ \showfontkerns \showglyphs
+
+ \getdummyparameters
+ [\s!font=Regular,
+ \c!sample={Wat een bende, rommelen met het font design!},
+ #1]
+
+ \definedfont[\dummyparameter\s!font*default sa 1]
+
+ \begingroup
+ \tttf \dummyparameter\s!font\space @ default
+ \endgroup
+
+ \blank
+
+ \dostepwiserecurse {00} {95} {05} {
+ \definecharacterkerning[crap][factor=.0\twodigits{##1}]%
+ \begingroup
+ \tttf .0\twodigits{##1}:\space
+ \endgroup
+ \begingroup
+ \setcharacterkerning[crap]\dummyparameter\c!sample\par
+ \endgroup
+ }
+ \removeunwantedspaces
+
+ \stopTEXpage
+
+\stoptexdefinition
+
+\protect
+
\continueifinputfile{s-typesetting-kerning.mkiv}
\starttext
- \showcharacterkerning
+ % \showcharacterkerning
-\stoptext
+ \showcharacterkerningsteps[font=file:FuturaStd-Book.otf]
+ \showcharacterkerningsteps[font=file:FuturaStd-Medium.otf]
+ \showcharacterkerningsteps[font=file:FuturaStd-Bold.otf]
+ \showcharacterkerningsteps[font=file:FuturaStd-heavy.otf]
+\stoptext
% {\hsize1mm efficient\discretionary{\kern1pt!\kern1pt}{\kern1pt!\kern1pt}{\kern1pt!\kern1pt}efficient\par}
% {\hsize1mm\definedfont[Regular]\setcharacterkerning[typesetting-kerning-demo]efficient\-efficient\par}
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index be450532c..d5af6d8ff 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index 48a7a3c42..0b601c9ba 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/typo-krn.mkiv b/tex/context/base/typo-krn.mkiv
index 92689f07b..f5f452ae5 100644
--- a/tex/context/base/typo-krn.mkiv
+++ b/tex/context/base/typo-krn.mkiv
@@ -91,7 +91,7 @@
\setuevalue{\currentcharacterkerning}%
{\doifnextoptionalelse
{\typo_kerning_apply_yes{\currentcharacterkerning}}%
- {\typo_kerning_apply_nop{\currentcharacterkerning}}}
+ {\typo_kerning_apply_nop{\currentcharacterkerning}}}%
\to \everydefinecharacterkerning
\unexpanded\def\typo_kerning_apply_yes#1[#2]%
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 83f137681..884c5885e 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 : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 12/29/14 10:01:59
+-- merge date : 12/30/14 09:48:12
do -- begin closure to overcome local limits and interference