diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-01-19 23:29:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-01-19 23:29:00 +0100 |
commit | 6591e18e59fb54ae285d1a95ea74fc9101c00af8 (patch) | |
tree | 63572f93283e7615dafc41427b8f2d8b26a5bb2c /tex | |
parent | e1cd565bd3872eb5665b95a0ca93e9ba6982c929 (diff) | |
download | context-6591e18e59fb54ae285d1a95ea74fc9101c00af8.tar.gz |
beta 2010.01.19 23:29
Diffstat (limited to 'tex')
26 files changed, 439 insertions, 100 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index c8abac829..e187d6c8b 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{2010.01.18 22:43} +\newcontextversion{2010.01.19 23:29} %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 5d584cabd..54fe1a898 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -72,6 +72,7 @@ \loadmarkfile{node-ini} \loadmarkfile{node-fin} \loadmarkfile{node-par} +\loadmarkfile{node-ins} \loadmarkfile{core-var} diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 2500a5c57..0d86080fa 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{2010.01.18 22:43} +\edef\contextversion{2010.01.19 23:29} %D For those who want to use this: diff --git a/tex/context/base/font-otc.lua b/tex/context/base/font-otc.lua index 1fc1f2289..198b790b5 100644 --- a/tex/context/base/font-otc.lua +++ b/tex/context/base/font-otc.lua @@ -21,6 +21,8 @@ local tfm = fonts.tfm -- instead of "script = "DFLT", langs = { 'dflt' }" we now use wildcards (we used to -- have always); some day we can write a "force always when true" trick for other -- features as well +-- +-- we could have a tnum variant as well local extra_lists = { tlig = { diff --git a/tex/context/base/l-os.lua b/tex/context/base/l-os.lua index 0b35fa4e1..3c21f5569 100644 --- a/tex/context/base/l-os.lua +++ b/tex/context/base/l-os.lua @@ -156,6 +156,7 @@ elseif os.type == "windows" then elseif name == "linux" then function os.resolvers.platform(t,k) + -- we sometims have HOSTTYPE set so let's check that first local platform, architecture = "", os.getenv("HOSTTYPE") or os.resultof("uname -m") or "" if find(architecture,"x86_64") then platform = "linux-64" @@ -169,17 +170,28 @@ elseif name == "linux" then return platform end -elseif name == "macosx" then -- a rather inconsistent mess +elseif name == "macosx" then + + --[[ + Identifying the architecture of OSX is quite a mess and this + is the best we can come up with. For some reason $HOSTTYPE is + a kind of pseudo environment variable, not known to the current + environment. And yes, uname cannot be trusted either, so there + is a change that you end up with a 32 bit run on a 64 bit system. + Also, some proper 64 bit intel macs are too cheap (low-end) and + therefore not permitted to run the 64 bit kernel. + ]]-- function os.resolvers.platform(t,k) - local platform, architecture = "", os.resultof("uname -m") or "" - if architecture == "" then - architecture = os.getenv("HOSTTYPE") or "" - end + -- local platform, architecture = "", os.getenv("HOSTTYPE") or "" + -- if architecture == "" then + -- architecture = os.resultof("echo $HOSTTYPE") or "" + -- end + local platform, architecture = "", os.resultof("echo $HOSTTYPE") or os.resultof("uname -m") or "" if architecture == "" then - architecture = os.resultof("echo $HOSTTYPE") or "" - end - if find(architecture,"i386") then + -- print("\nI have no clue what kind of OSX you're running so let's assume an 32 bit intel.\n") + platform = "osx-intel" + elseif find(architecture,"i386") then platform = "osx-intel" elseif find(architecture,"x86_64") then platform = "osx-64" @@ -254,3 +266,16 @@ function os.uuid() random(0xFFFF),random(0xFFFF),random(0xFFFF) ) end + +function os.timezone(delta) + local d = tonumber(tonumber(os.date("%H")-os.date("!%H"))) + if delta then + if d > 0 then + return format("+%02i:00",d) + else + return format("-%02i:00",-d) + end + else + return 1 + end +end diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 02f65e3ff..0588829ba 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['lpdf-ini'] = { -- This code is very experimental ! local setmetatable, getmetatable, type, next, tostring, tonumber, rawset = setmetatable, getmetatable, type, next, tostring, tonumber, rawset -local char, byte, format, gsub, concat = string.char, string.byte, string.format, string.gsub, table.concat +local char, byte, format, gsub, concat, match = string.char, string.byte, string.format, string.gsub, table.concat, string.match local utfvalues = string.utfvalues local texwrite = tex.write local sind, cosd = math.sind, math.cosd @@ -565,6 +565,23 @@ function lpdf.rotationcm(a) texwrite(format("%s %s %s %s 0 0 cm",c,s,-s,c)) end +-- ! -> universaltime + +local timestamp = os.date("%Y-%m-%dT%X") .. os.timezone(true) + +function lpdf.timestamp() + return timestamp +end + +function lpdf.pdftimestamp(str) + local Y, M, D, h, m, s, Zs, Zh, Zm = match(str,"^(%d%d%d%d)%-(%d%d)%-(%d%d)T(%d%d):(%d%d):(%d%d)([%+%-])(%d%d):(%d%d)$") + return Y and format("D:%s%s%s%s%s%s%s%s'%s'",Y,M,D,h,m,s,Zs,Zh,Zm) +end + +function lpdf.id() + return format("%s.%s",tex.jobname,timestamp) +end + -- lpdf.addtoinfo("ConTeXt.Version", tex.contextversiontoks) -- lpdf.addtoinfo("ConTeXt.Time", os.date("%Y.%m.%d %H:%M")) -- :%S -- lpdf.addtoinfo("ConTeXt.Jobname", tex.jobname) diff --git a/tex/context/base/lpdf-mis.lua b/tex/context/base/lpdf-mis.lua index 142b1281f..818c64c54 100644 --- a/tex/context/base/lpdf-mis.lua +++ b/tex/context/base/lpdf-mis.lua @@ -44,7 +44,7 @@ local tobasepoints = number.tobasepoints local variables = interfaces.variables -lpdf.addtoinfo ("Trapped", pdfboolean(false), "False") +lpdf.addtoinfo ("Trapped", pdfconstant("False")) -- ''/Trapped' in /Info, 'Trapped' in XMP lpdf.addtocatalog("Version", pdfconstant(format("1.%s",tex.pdfminorversion))) -- @@ -148,26 +148,39 @@ lpdf.registerdocumentfinalizer(flushdocumentactions) --- info function codeinjections.setupidentity(specification) - local title = specification.title or "" if title ~= "" then + local title = specification.title or "" + if title ~= "" then lpdf.addtoinfo("Title", pdfunicode(title), title) end - local subject = specification.subject or "" if subject ~= "" then + local subject = specification.subject or "" + if subject ~= "" then lpdf.addtoinfo("Subject", pdfunicode(subject), subject) end - local author = specification.author or "" if author ~= "" then - lpdf.addtoinfo("Author", pdfunicode(author), author) + local author = specification.author or "" + if author ~= "" then + lpdf.addtoinfo("Author", pdfunicode(author), author) -- '/Author' in /Info, 'Creator' in XMP end - local creator = specification.creator or "" if creator ~= "" then - lpdf.addtoinfo("Creator", pdfunicode(creator), creator) + local creator = specification.creator or "" + if creator ~= "" then + lpdf.addtoinfo("Creator", pdfunicode(creator), creator) -- '/Creator' in /Info, 'CreatorTool' in XMP end - local date = specification.date or "" if date ~= "" then - lpdf.addtoinfo("ModDate", pdfstring(date), date) + lpdf.addtoinfo("CreationDate", pdfstring(lpdf.pdftimestamp(lpdf.timestamp()))) + local date = specification.date or "" + local pdfdate = lpdf.pdftimestamp(date) + if pdfdate then + lpdf.addtoinfo("ModDate", pdfstring(pdfdate), date) + else + -- users should enter the date in 2010-01-19T23:27:50+01:00 format + -- and if not provided that way we use the creation time instead + date = lpdf.timestamp() + lpdf.addtoinfo("ModDate", pdfstring(lpdf.pdftimestamp(date)), date) end - local keywords = specification.keywords or "" if keywords ~= "" then + local keywords = specification.keywords or "" + if keywords ~= "" then keywords = string.gsub(keywords, "[%s,]+", " ") lpdf.addtoinfo("Keywords",pdfunicode(keywords), keywords) end - local id = format("%s.%s",tex.jobname,os.date("%Y%m%d.%H%M")) + local id = lpdf.id() lpdf.addtoinfo("ID", pdfstring(id), id) -- needed for pdf/x end diff --git a/tex/context/base/lpdf-xmp.lua b/tex/context/base/lpdf-xmp.lua index de826ee5b..1fd7b275c 100644 --- a/tex/context/base/lpdf-xmp.lua +++ b/tex/context/base/lpdf-xmp.lua @@ -3,7 +3,8 @@ if not modules then modules = { } end modules ['lpdf-xmp'] = { comment = "companion to lpdf-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" + license = "see context related readme files", + comment = "with help from Peter Rolf", } local format, random, char, gsub = string.format, math.random, string.char, string.gsub @@ -44,7 +45,7 @@ local xmpmetadata = [[ <rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"> <pdf:Keywords/> <pdf:Producer/> - <pdf:Trapped/> + <pdf:Trapped>False</pdf:Trapped> </rdf:Description> <rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"> <xmpMM:DocumentID/> @@ -64,7 +65,8 @@ local xpacket = [[ <?xpacket end="w"?>]] local mapping = { - ["Creator"] = "rdf:Description/dc:creator/rdf:Seq/rdf:li", + ["Creator"] = "rdf:Description/xmp:CreatorTool", + ["Author"] = "rdf:Description/dc:creator/rdf:Seq/rdf:li", ["Title"] = "rdf:Description/dc:title/rdf:Alt/rdf:li", ["ConTeXt.Jobname"] = "rdf:Description/pdfx:ConTeXt.Jobname", ["ConTeXt.Time"] = "rdf:Description/pdfx:ConTeXt.Time", @@ -73,12 +75,11 @@ local mapping = { ["ID"] = "rdf:Description/pdfx:ID", ["PTEX.Fullbanner"] = "rdf:Description/pdfx:PTEX.Fullbanner", ["CreateDate"] = "rdf:Description/xmp:CreateDate", - ["CreatorTool"] = "rdf:Description/xmp:CreatorTool", ["ModifyDate"] = "rdf:Description/xmp:ModifyDate", ["MetadataDate"] = "rdf:Description/xmp:MetadataDate", ["Keywords"] = "rdf:Description/pdf:Keywords", ["Producer"] = "rdf:Description/pdf:Producer", - ["Trapped"] = "rdf:Description/pdf:Trapped", +-- ["Trapped"] = "rdf:Description/pdf:Trapped", -- '/Trapped' in /Info, 'Trapped' in XMP ["DocumentID"] = "rdf:Description/xmpMM:DocumentID", ["InstanceID"] = "rdf:Description/xmpMM:InstanceID", } @@ -109,7 +110,7 @@ local function flushxmpinfo() local t = { } for i=1,24 do t[i] = char(96 + random(26)) end local packetid = table.concat(t) - local time = os.date("!%Y-%m-%dT%X") -- ! -> universaltime + local time = lpdf.timestamp() addxmpinfo("Producer",format("LuaTeX-%0.2f.%s",tex.luatexversion/100,tex.luatexrevision)) addxmpinfo("DocumentID",format("uuid:%s",os.uuid())) addxmpinfo("InstanceID",format("uuid:%s",os.uuid())) @@ -117,6 +118,7 @@ local function flushxmpinfo() addxmpinfo("CreateDate",time) addxmpinfo("ModifyDate",time) addxmpinfo("MetadataDate",time) + addxmpinfo("PTEX.Fullbanner", tex.pdftexbanner) local blob = xml.tostring(xmp) local md = lpdf.dictionary { Subtype = lpdf.constant("XML"), diff --git a/tex/context/base/node-ins.lua b/tex/context/base/node-ins.lua new file mode 100644 index 000000000..3499489b4 --- /dev/null +++ b/tex/context/base/node-ins.lua @@ -0,0 +1,103 @@ +if not modules then modules = { } end modules ['node-ins'] = { + version = 1.001, + comment = "companion to node-ins.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local hlist = node.id('hlist') +local vlist = node.id('vlist') +local insert = node.id('ins') + +local has_attribute = node.has_attribute +local set_attribute = node.set_attribute +local remove_nodes = nodes.remove + +local insert_moved = attributes.private("insert_moved") + +local trace_inserts = false trackers.register("inserts.moves", function(v) trace_inserts = v end) + +local function locate(head,cache) + local current = head + while current do + local id = current.id + if id == vlist or id == hlist then + current.list = locate(current.list,cache) + current= current.next + elseif id == insert then + local insert + head, current, insert = remove_nodes(head,current) + cache[#cache+1] = insert + insert.prev = nil + insert.next = nil + else + current= current.next + end + end + return head +end + +function nodes.move_inserts_outwards(head,where) + local done = false + if head then + local current = head + while current do + local id = current.id + if id == vlist or id == hlist and not has_attribute(current,insert_moved) then + set_attribute(current,insert_moved,1) + local head = current + local h, p = head.list, nil + local cache = { } + while h do + local id = h.id + if id == vlist or id == hlist then + h = locate(h,cache) + end + h = h.next + end + local n = #cache + if n > 0 then + local first = cache[1] + local last = first + for i=2,n do + local c = cache[i] + last.next, c.prev = c, last + last = c + end + -- inserts after head + local n = head.next + if n then + head.next = first + first.prev = head + last.next = n + n.prev = last + else + head.next = first + first.prev = head + end + if trace_inserts then + logs.report("inserts","%s nested inserts moved",n) + end + done = true + end + current = head + end + current = current.next + end + return head, true + end +end + +tasks.prependaction("pagebuilders", "normalizers", "nodes.move_inserts_outwards") + +tasks.disableaction("pagebuilders", "nodes.move_inserts_outwards") + +experiments.register("inserts.moves", function(v) + if v then + tasks.enableaction("pagebuilders", "nodes.move_inserts_outwards") + else + tasks.disableaction("pagebuilders", "nodes.move_inserts_outwards") + end +end) + diff --git a/tex/context/base/node-ins.mkiv b/tex/context/base/node-ins.mkiv new file mode 100644 index 000000000..304b61043 --- /dev/null +++ b/tex/context/base/node-ins.mkiv @@ -0,0 +1,55 @@ +%D \module +%D [ file=node-ins, +%D version=2010.01.19, +%D title=\CONTEXT\ Node Macros, +%D subtitle=Inserts, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Node Support / Inserts} + +%D This is very experimental and although it is used in a +%D real project it mostly serves a testbed for Taco and me so +%D as prelude to extending the inserts mechanism. +%D +%D \starttyping +%D \automoveinserts +%D +%D \hbox{\vbox{x\footnote{1}x\footnote{2}x\footnote{3}x}} +%D \vbox{x\footnote{4}x} +%D \hbox{\vbox{x\footnote{5}x}} +%D +%D \hbox{x} +%D \hbox{x\footnote{6}x} +%D \hbox{x} +%D +%D \starttabulate +%D \NC test \NC test \footnote{test} \input tufte \NC \NR +%D \NC test \NC test \footnote{test} \input tufte \NC \NR +%D \NC test \NC test \footnote{test} \input tufte \NC \NR +%D \NC test \NC test \footnote{test} \input tufte \NC \NR +%D \NC test \NC test \footnote{test} \input tufte \NC \NR +%D \NC test \NC test \footnote{test} \input tufte \NC \NR +%D \stoptabulate +%D \stoptyping + +\unprotect + +\registerctxluafile{node-ins}{1.001} + +\newtoks \everyautomovefootnotes + +\def\automoveinserts + {\the\everyautomovefootnotes} + +\appendtoks + \let\postponenotes\relax + \enableexperiments[inserts.moves]% +\to \everyautomovefootnotes + +\protect diff --git a/tex/context/base/node-tsk.lua b/tex/context/base/node-tsk.lua index f0ff6e393..59de5621b 100644 --- a/tex/context/base/node-tsk.lua +++ b/tex/context/base/node-tsk.lua @@ -201,3 +201,21 @@ tasks.new ( "after", -- for users } ) + +tasks.new ( + "pagebuilders", + { + "before", -- for users + "normalizers", + "after", -- for users + } +) + +tasks.new ( + "vboxbuilders", + { + "before", -- for users + "normalizers", + "after", -- for users + } +) diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 97114c1e6..735ebbdde 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -935,13 +935,13 @@ local function report(message,lst) logs.report("vspacing",message,count_nodes(lst,true),node_ids_to_string(lst)) end -function nodes.handle_page_spacing(where) - local newhead = texlists.contrib_head +function nodes.handle_page_spacing(newhead,where) +--~ local newhead = texlists.contrib_head if newhead then - starttiming(vspacing) +--~ starttiming(vspacing) local newtail = find_node_tail(newhead) local flush = false -stackhack = true -- todo: only when grid snapping once enabled + stackhack = true -- todo: only when grid snapping once enabled for n in traverse_nodes(newhead) do -- we could just look for glue nodes local id = n.id if id == glue then @@ -969,10 +969,11 @@ stackhack = true -- todo: only when grid snapping once enabled if stackhack then stackhack = false if trace_collect_vspacing then report("processing %s nodes: %s",newhead) end - texlists.contrib_head = collapser(newhead,"page",where,trace_page_vspacing,true) +--~ texlists.contrib_head = collapser(newhead,"page",where,trace_page_vspacing,true) +newhead = collapser(newhead,"page",where,trace_page_vspacing,true) else if trace_collect_vspacing then report("flushing %s nodes: %s",newhead) end - texlists.contrib_head = newhead +--~ texlists.contrib_head = newhead end else if stackhead then @@ -984,10 +985,12 @@ stackhack = true -- todo: only when grid snapping once enabled stackhead = newhead end stacktail = newtail - texlists.contrib_head = nil +--~ texlists.contrib_head = nil +newhead = nil end - stoptiming(vspacing) +--~ stoptiming(vspacing) end +return newhead end local ignore = table.tohash { @@ -998,9 +1001,9 @@ local ignore = table.tohash { function nodes.handle_vbox_spacing(head,where) if head and not ignore[where] and head.next then - starttiming(vspacing) +--~ starttiming(vspacing) head = collapser(head,"vbox",where,trace_vbox_vspacing,false) - stoptiming(vspacing) +--~ stoptiming(vspacing) end return head end @@ -1008,32 +1011,26 @@ end function nodes.collapse_vbox(n) -- for boxes local list = texbox[n].list if list then - starttiming(vspacing) +--~ starttiming(vspacing) texbox[n].list = vpack_node(collapser(list,"snapper","vbox",trace_vbox_vspacing,true)) - stoptiming(vspacing) +--~ stoptiming(vspacing) end end -statistics.register("v-node processing time", function() - if statistics.elapsedindeed(vspacing) then - return format("%s seconds", statistics.elapsedtime(vspacing)) - end -end) - -- these are experimental callback definitions that definitely will -- be moved elsewhere as part of a chain of vnode handling - -function vspacing.enable() - callback.register('vpack_filter', nodes.handle_vbox_spacing) -- enabled per 2009/10/16 - callback.register('buildpage_filter', nodes.handle_page_spacing) -end - -function vspacing.disable() - callback.register('vpack_filter', nil) - callback.register('buildpage_filter', nil) -end - -vspacing.enable() +-- +-- function vspacing.enable() +-- callback.register('vpack_filter', nodes.handle_vbox_spacing) -- enabled per 2009/10/16 +-- callback.register('buildpage_filter', nodes.handle_page_spacing) +-- end +-- +-- function vspacing.disable() +-- callback.register('vpack_filter', nil) +-- callback.register('buildpage_filter', nil) +-- end +-- +-- vspacing.enable() -- we will split this module hence the locals @@ -1086,3 +1083,55 @@ function nodes.repackage_graphicvadjust(head,groupcode) -- we can make an action end --~ tasks.appendaction("finalizers", "lists", "nodes.repackage_graphicvadjust") + +nodes.builders = nodes.builder or { } + +local builders = nodes.builders + +local actions = tasks.actions("vboxbuilders",2) + +function nodes.builders.vpack_filter(head,groupcode) + local done = false + if head then + starttiming(builders) + if trace_callbacks then + local before = nodes.count(head) + head, done = actions(head,groupcode) + local after = nodes.count(head) + if done then + tracer("vpack","changed",head,groupcode,before,after,true) + else + tracer("vpack","unchanged",head,groupcode,before,after,true) + end + stoptiming(builders) + else + head, done = actions(head,groupcode) + stoptiming(builders) + end + end + return head, done +end + +-- This one is special in the sense that it has no head +-- and we operate on the mlv. Also, we need to do the +-- vspacing last as it removes items from the mvl. + +local actions = tasks.actions("pagebuilders",2) + +function nodes.builders.buildpage_filter(groupcode) + starttiming(builders) + local head = texlists.contrib_head + local head, done = actions(head,groupcode) + texlists.contrib_head = head + stoptiming(builders) + return (done and head) or true +end + +callback.register('vpack_filter', nodes.builders.vpack_filter) +callback.register('buildpage_filter', nodes.builders.buildpage_filter) + +statistics.register("v-node processing time", function() + if statistics.elapsedindeed(builders) then + return format("%s seconds", statistics.elapsedtime(builders)) + end +end) diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 8c89c945b..b8191f330 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -1728,25 +1728,25 @@ \dorecurse{10} % todo: other values < 4000 {\expanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr4000+250*\recurselevel\relax]}} -\setfalse\vspacingenabled - -\newtoks\everyenablevspacing -\newtoks\everydisablevspacing - -\def\enablevspacing {\the\everyenablevspacing} -\def\disablevspacing{\the\everydisablevspacing} - -\appendtoks - \writestatus\m!systems{! ! enabling vspacing ! !}% - \settrue\vspacingenabled - \ctxlua{vspacing.enable()}% -\to \everyenablevspacing - -\appendtoks - \writestatus\m!systems{! ! disabling vspacing ! !}% - \setfalse\vspacingenabled - \ctxlua{vspacing.disable()}% -\to \everydisablevspacing +% \setfalse\vspacingenabled +% +% \newtoks\everyenablevspacing +% \newtoks\everydisablevspacing +% +% \def\enablevspacing {\the\everyenablevspacing} +% \def\disablevspacing{\the\everydisablevspacing} +% +% \appendtoks +% \writestatus\m!systems{! ! enabling vspacing ! !}% +% \settrue\vspacingenabled +% \ctxlua{vspacing.enable()}% +% \to \everyenablevspacing +% +% \appendtoks +% \writestatus\m!systems{! ! disabling vspacing ! !}% +% \setfalse\vspacingenabled +% \ctxlua{vspacing.disable()}% +% \to \everydisablevspacing \let\blank \vspacing \let\defineblank \definevspacing diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index f28a28df9..bcd5d2b8c 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -55,6 +55,13 @@ tasks.appendaction("math", "builders", "noads.mlist_to_hlist") tasks.appendaction("finalizers", "lists", "nodes.repackage_graphicvadjust") -- todo +-- rather new + +tasks.appendaction("pagebuilders", "normalizers", "nodes.move_inserts_outwards") +tasks.appendaction("pagebuilders", "normalizers", "nodes.handle_page_spacing") -- last ! + +tasks.appendaction("vboxbuilders", "normalizers", "nodes.handle_vbox_spacing") + -- speedup: only kick in when used tasks.disableaction("processors", "fonts.checkers.missing") @@ -77,3 +84,5 @@ tasks.disableaction("shipouts", "shipouts.handle_viewerlayer") tasks.disableaction("shipouts", "nodes.add_references") tasks.disableaction("shipouts", "nodes.add_destinations") + +tasks.disableaction("pagebuilders", "nodes.move_inserts_outwards") diff --git a/tex/context/base/trac-deb.mkiv b/tex/context/base/trac-deb.mkiv index 24e17f486..b004cdeb4 100644 --- a/tex/context/base/trac-deb.mkiv +++ b/tex/context/base/trac-deb.mkiv @@ -37,12 +37,15 @@ }% \to \everybye -\def\showtrackers {\ctxlua{trackers.show()}} -\def\resettrackers {\ctxlua{trackers.reset()}} -\def\enabletrackers [#1]{\ctxlua{trackers.enable("#1")}} -\def\disabletrackers[#1]{\ctxlua{trackers.disable("#1")}} - -\def\showdirectives {\ctxlua{directives.show()}} -%def\resetdirectives {\ctxlua{directives.reset()}} % would be weird to use -\def\enabledirectives [#1]{\ctxlua{directives.enable("#1")}} -\def\disabledirectives[#1]{\ctxlua{directives.disable("#1")}} +\def\showtrackers {\ctxlua{trackers.show()}} +\def\enabletrackers [#1]{\ctxlua{trackers.enable("#1")}} +\def\disabletrackers [#1]{\ctxlua{trackers.disable("#1")}} +\def\resettrackers {\ctxlua{trackers.reset()}} + +\def\showdirectives {\ctxlua{directives.show()}} +\def\enabledirectives [#1]{\ctxlua{directives.enable("#1")}} +\def\disabledirectives [#1]{\ctxlua{directives.disable("#1")}} + +\def\showexperiments {\ctxlua{experiments.show()}} +\def\enableexperiments [#1]{\ctxlua{experiments.enable("#1")}} +\def\disableexperiments[#1]{\ctxlua{experiments.disable("#1")}} diff --git a/tex/context/base/trac-tra.lua b/tex/context/base/trac-tra.lua index 63ce4233f..b6598484e 100644 --- a/tex/context/base/trac-tra.lua +++ b/tex/context/base/trac-tra.lua @@ -294,13 +294,15 @@ function setters.new(name) return t end -trackers = setters.new("trackers") -directives = setters.new("directives") +trackers = setters.new("trackers") +directives = setters.new("directives") +experiments = setters.new("experiments") -- nice trick: we overload two of the directives related functions with variants that -- do tracing (itself using a tracker) .. proof of concept -local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_directives = false local trace_directives = false trackers.register("system.directives", function(v) trace_directives = v end) +local trace_experiments = false local trace_experiments = false trackers.register("system.experiments", function(v) trace_experiments = v end) local e = directives.enable local d = directives.disable @@ -314,3 +316,16 @@ function directives.disable(...) commands.writestatus("directives","disabling: %s",concat({...}," ")) d(...) end + +local e = experiments.enable +local d = experiments.disable + +function experiments.enable(...) + commands.writestatus("experiments","enabling: %s",concat({...}," ")) + e(...) +end + +function experiments.disable(...) + commands.writestatus("experiments","disabling: %s",concat({...}," ")) + d(...) +end diff --git a/tex/context/base/typo-krn.lua b/tex/context/base/typo-krn.lua index c5a56865a..59b89ff10 100644 --- a/tex/context/base/typo-krn.lua +++ b/tex/context/base/typo-krn.lua @@ -114,9 +114,10 @@ local function process(namespace,attribute,head,force) -- but we could have multiple glyphs involved so ... local disc = prev -- disc local pre, post, replace = disc.pre, disc.post, disc.replace - if pre then -- must pair with start.prev + local prv, nxt = disc.prev, disc.next + if pre and prv then -- must pair with start.prev -- this one happens in most cases - local before = copy_node(disc.prev) + local before = copy_node(prv) pre.prev = before before.next = pre before.prev = nil @@ -126,8 +127,8 @@ local function process(namespace,attribute,head,force) disc.pre = pre free_node(before) end - if post then -- must pair with start - local after = copy_node(disc.next) + if post and nxt then -- must pair with start + local after = copy_node(nxt) local tail = find_node_tail(post) tail.next = after after.prev = tail @@ -137,9 +138,9 @@ local function process(namespace,attribute,head,force) disc.post = post free_node(after) end - if replace then -- must pair with start and start.prev - local before = copy_node(disc.prev) - local after = copy_node(disc.next) + if replace and prv and nxt then -- must pair with start and start.prev + local before = copy_node(prv) + local after = copy_node(nxt) local tail = find_node_tail(replace) replace.prev = before before.next = replace @@ -150,13 +151,13 @@ local function process(namespace,attribute,head,force) replace = process(namespace,attribute,before,attr) replace = replace.next replace.prev = nil - tail.next = nil + after.prev.next = nil disc.replace = replace free_node(after) free_node(before) else - if disc.prev.font == lastfont then - local prevchar, lastchar = disc.prev.char, start.char + if prv and prv.id == glyph and prv.font == lastfont then + local prevchar, lastchar = prv.char, start.char local tfm = fontdata[lastfont].characters[prevchar] local ickern = tfm.kerns if ickern and ickern[lastchar] then diff --git a/tex/context/interface/cont-cs.xml b/tex/context/interface/cont-cs.xml index 0732acd8b..b5ac17192 100644 --- a/tex/context/interface/cont-cs.xml +++ b/tex/context/interface/cont-cs.xml @@ -6174,6 +6174,9 @@ <cd:parameter name="vzdalenost"> <cd:constant type="cd:dimension"/> </cd:parameter> + <cd:parameter name="krok"> + <cd:constant type="cd:dimension"/> + </cd:parameter> <cd:parameter name="faktor"> <cd:constant type="cd:number"/> </cd:parameter> diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index 3cf049694..221329735 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -6174,6 +6174,9 @@ <cd:parameter name="abstand"> <cd:constant type="cd:dimension"/> </cd:parameter> + <cd:parameter name="schritt"> + <cd:constant type="cd:dimension"/> + </cd:parameter> <cd:parameter name="faktor"> <cd:constant type="cd:number"/> </cd:parameter> diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index c9485e003..fa4a6e983 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -6174,6 +6174,9 @@ <cd:parameter name="distance"> <cd:constant type="cd:dimension"/> </cd:parameter> + <cd:parameter name="step"> + <cd:constant type="cd:dimension"/> + </cd:parameter> <cd:parameter name="factor"> <cd:constant type="cd:number"/> </cd:parameter> diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index 21bc89d14..ea9864b3d 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -6174,6 +6174,9 @@ <cd:parameter name="distance"> <cd:constant type="cd:dimension"/> </cd:parameter> + <cd:parameter name="pas"> + <cd:constant type="cd:dimension"/> + </cd:parameter> <cd:parameter name="facteur"> <cd:constant type="cd:number"/> </cd:parameter> diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index de714f58b..71ba4249a 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -6174,6 +6174,9 @@ <cd:parameter name="distanza"> <cd:constant type="cd:dimension"/> </cd:parameter> + <cd:parameter name="passo"> + <cd:constant type="cd:dimension"/> + </cd:parameter> <cd:parameter name="fattore"> <cd:constant type="cd:number"/> </cd:parameter> diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index 264d6bcde..2440bb7aa 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -6174,6 +6174,9 @@ <cd:parameter name="afstand"> <cd:constant type="cd:dimension"/> </cd:parameter> + <cd:parameter name="stap"> + <cd:constant type="cd:dimension"/> + </cd:parameter> <cd:parameter name="factor"> <cd:constant type="cd:number"/> </cd:parameter> diff --git a/tex/context/interface/cont-pe.xml b/tex/context/interface/cont-pe.xml index b806de4ac..90c74a4c2 100644 --- a/tex/context/interface/cont-pe.xml +++ b/tex/context/interface/cont-pe.xml @@ -6174,6 +6174,9 @@ <cd:parameter name="فاصله"> <cd:constant type="cd:dimension"/> </cd:parameter> + <cd:parameter name="گام"> + <cd:constant type="cd:dimension"/> + </cd:parameter> <cd:parameter name="عامل"> <cd:constant type="cd:number"/> </cd:parameter> diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index f3598eecf..880fa9c8a 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -6174,6 +6174,9 @@ <cd:parameter name="distanta"> <cd:constant type="cd:dimension"/> </cd:parameter> + <cd:parameter name="pas"> + <cd:constant type="cd:dimension"/> + </cd:parameter> <cd:parameter name="factor"> <cd:constant type="cd:number"/> </cd:parameter> diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 2bea64449..d6c98106d 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 : 01/18/10 22:47:16 +-- merge date : 01/19/10 23:34:48 do -- begin closure to overcome local limits and interference @@ -10709,6 +10709,8 @@ local tfm = fonts.tfm -- instead of "script = "DFLT", langs = { 'dflt' }" we now use wildcards (we used to -- have always); some day we can write a "force always when true" trick for other -- features as well +-- +-- we could have a tnum variant as well local extra_lists = { tlig = { |