diff options
Diffstat (limited to 'tex')
24 files changed, 175 insertions, 104 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index a04c2385f..848071dcb 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.07.02 14:39} +\newcontextversion{2018.07.05 23:06} %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/mkii/context.mkii b/tex/context/base/mkii/context.mkii index cae8a99d9..acdcfcaa2 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.07.02 14:39} +\edef\contextversion{2018.07.05 23:06} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-nl.mkii b/tex/context/base/mkii/mult-nl.mkii index 4d5ab2af1..a21064a23 100644 --- a/tex/context/base/mkii/mult-nl.mkii +++ b/tex/context/base/mkii/mult-nl.mkii @@ -1027,6 +1027,7 @@ \setinterfaceconstant{otherstext}{otherstext} \setinterfaceconstant{outermargin}{buitenmarge} \setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownerpassword}{ownerpassword} \setinterfaceconstant{ownnumber}{eigennummer} \setinterfaceconstant{page}{pagina} \setinterfaceconstant{pageboundaries}{paginaovergangen} @@ -1268,6 +1269,7 @@ \setinterfaceconstant{up}{up} \setinterfaceconstant{urlalternative}{urlvariant} \setinterfaceconstant{urlspace}{urlspatie} +\setinterfaceconstant{userpassword}{userpassword} \setinterfaceconstant{validate}{valideer} \setinterfaceconstant{values}{waarden} \setinterfaceconstant{vcommand}{vcommando} diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index 0e12a29ed..5493c3308 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -1027,6 +1027,7 @@ \setinterfaceconstant{otherstext}{otherstext} \setinterfaceconstant{outermargin}{حاشیهخارجی} \setinterfaceconstant{overprint}{overprint} +\setinterfaceconstant{ownerpassword}{ownerpassword} \setinterfaceconstant{ownnumber}{شمارهخود} \setinterfaceconstant{page}{صفحه} \setinterfaceconstant{pageboundaries}{مرزهایصفحه} @@ -1268,6 +1269,7 @@ \setinterfaceconstant{up}{up} \setinterfaceconstant{urlalternative}{urlalternative} \setinterfaceconstant{urlspace}{urlspace} +\setinterfaceconstant{userpassword}{userpassword} \setinterfaceconstant{validate}{تاییداعتبار} \setinterfaceconstant{values}{values} \setinterfaceconstant{vcommand}{vcommand} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 2a3392732..f15615b0e 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.07.02 14:39} +\newcontextversion{2018.07.05 23:06} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index dc3bc164b..d50b42f29 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.07.02 14:39} +\edef\contextversion{2018.07.05 23:06} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua index fcafe99ed..fc9953d88 100644 --- a/tex/context/base/mkiv/font-ocl.lua +++ b/tex/context/base/mkiv/font-ocl.lua @@ -341,15 +341,15 @@ do else - -- todo: bypass backend and directly inject xforms - local openpdf = pdfe.new + ----- prefix = "data:application/pdf," function otf.storepdfdata(pdf) local done = hashed[pdf] if not done then nofstreams = nofstreams + 1 - local n = openpdf(pdf,#pdf,f_name(nofstreams)) + local f = f_name(nofstreams) + local n = openpdf(pdf,#pdf,f) done = f_used(n) hashed[pdf] = done end @@ -436,6 +436,8 @@ local function pdftovirtual(tfmdata,pdfshapes,kind) -- kind = sbix|svg dy = 0 end if data then + -- We can delay storage by a lua function in commands: but then we need to + -- be able to provide our own mem stream name (so that we can reserve it). local setcode, name, nilcode = storepdfdata(data) if name then local bt = unicode and getactualtext(unicode) @@ -459,8 +461,8 @@ local function pdftovirtual(tfmdata,pdfshapes,kind) -- kind = sbix|svg end local otfsvg = otf.svg or { } -otf.svg = otfsvg -otf.svgenabled = true +otf.svg = otfsvg +otf.svgenabled = true do diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua index 79c015a63..6e1caf57f 100644 --- a/tex/context/base/mkiv/font-shp.lua +++ b/tex/context/base/mkiv/font-shp.lua @@ -290,7 +290,7 @@ otf.loadoutlinedata = loadoutlinedata -- not public otf.loadstreamdata = loadstreamdata -- not public otf.loadshapes = loadshapes --- experimental code, for me only ... unsupported +-- experimental code, for me only ... unsupported (todo: use %N) local f_c = string.formatters["%F %F %F %F %F %F c"] local f_l = string.formatters["%F %F l"] diff --git a/tex/context/base/mkiv/font-ttf.lua b/tex/context/base/mkiv/font-ttf.lua index 1365b250d..bdfa3e859 100644 --- a/tex/context/base/mkiv/font-ttf.lua +++ b/tex/context/base/mkiv/font-ttf.lua @@ -710,7 +710,10 @@ local function readglyph(f,nofcontours) -- read deltas here, saves space local points = { } local instructions = { } local flags = { } - local contours = readintegertable(f,nofcontours,short) + local contours = { } -- readintegertable(f,nofcontours,short) + for i=1,nofcontours do + contours[i] = readshort(f) + 1 + end local nofpoints = contours[nofcontours] local nofinstructions = readushort(f) skipbytes(f,nofinstructions) diff --git a/tex/context/base/mkiv/lpdf-ini.lua b/tex/context/base/mkiv/lpdf-ini.lua index d3550a756..3b5aeda84 100644 --- a/tex/context/base/mkiv/lpdf-ini.lua +++ b/tex/context/base/mkiv/lpdf-ini.lua @@ -776,7 +776,7 @@ end -- lpdf.deferredobject = pdfdeferredobject -- lpdf.referenceobject = pdfreferenceobject -local pagereference = pdf.pageref -- tex.pdfpageref is obsolete +local pagereference = pdf.getpageref or pdf.pageref -- tex.pdfpageref is obsolete local nofpages = 0 function lpdf.pagereference(n) diff --git a/tex/context/base/mkiv/lpdf-tag.lua b/tex/context/base/mkiv/lpdf-tag.lua index cc3823fef..3eb9363e5 100644 --- a/tex/context/base/mkiv/lpdf-tag.lua +++ b/tex/context/base/mkiv/lpdf-tag.lua @@ -331,10 +331,11 @@ function nodeinjections.addtags(head) for n, id in nextnode, head do if id == glyph_code then -- maybe also disc - local at = getattr(n,a_tagged) - if not at then - range = nil - elseif last ~= at then + local at = getattr(n,a_tagged) or false -- false: pagebody or so, so artifact + -- if not at then + -- range = nil + -- elseif ... + if last ~= at then range = { at, "glyph", n, n, list } -- attr id start stop list ranges[#ranges+1] = range last = at @@ -344,12 +345,12 @@ function nodeinjections.addtags(head) 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 + local at = getattr(n,a_tagged) or false -- false: pagebody or so, so artifact + -- if not at then + -- range = nil + -- else ranges[#ranges+1] = { at, "image", n, n, list } -- attr id start stop list - end + -- end last = nil else collectranges(getlist(n),n) @@ -379,83 +380,93 @@ function nodeinjections.addtags(head) local top = nil local noftop = 0 + + local function inject(start,stop,list,literal) + local prev = getprev(start) + if prev then + setlink(prev,literal) + end + setlink(literal,start) + if list and getlist(list) == start then + setlist(list,literal) + end + local literal = copy_node(EMCliteral) + -- use insert instead: + local next = getnext(stop) + if next then + setlink(literal,next) + end + setlink(stop,literal) + end + 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 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 + + local range = ranges[i] + local attr = range[1] + local id = range[2] + local start = range[3] + local stop = range[4] + local list = range[5] + + if attr then + + local specification = taglist[attr] + local taglist = specification.taglist + local noftags = #taglist + local common = 0 + local literal = nil + local ignore = false + + 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 - end - local prev = common > 0 and elements[taglist[common]] or root - local ignore = false - local literal = nil - - 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 - ignore = true - break - elseif prv == true then - -- skip this one - else - prev = prv + 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 + ignore = true + break + elseif prv == true then + -- skip this one + else + prev = prv + end end - end - if prev then - literal = pdfpageliteral(makecontent(prev,id,specification)) - elseif ignore then - literal = pdfpageliteral(makeignore(specification)) - end - if literal then - local prev = getprev(start) if prev then - setlink(prev,literal) - end - setlink(literal,start) - if list and getlist(list) == start then - setlist(list,literal) + literal = pdfpageliteral(makecontent(prev,id,specification)) + elseif ignore then + literal = pdfpageliteral(makeignore(specification)) + else + -- maybe also ignore or maybe better: comment or so end - local literal = copy_node(EMCliteral) - -- use insert instead: - local next = getnext(stop) - if next then - setlink(literal,next) + + if literal then + inject(start,stop,list,literal) end - setlink(stop,literal) + + top = taglist + noftop = noftags + + else + + local literal = pdfpageliteral(makeignore(specification)) + + inject(start,stop,list,literal) + end - -- if literal then - -- if list and getlist(list) == start then - -- setlink(literal,start) - -- setlist(list,literal) - -- else - -- setlink(getprev(start),literal,start) - -- end - -- -- use insert instead: - -- local literal = copy_node(EMCliteral) - -- setlink(stop,literal,getnext(stop)) - -- end - - top = taglist - noftop = noftags end finishpage() diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua index 03febbf01..8647a7b39 100644 --- a/tex/context/base/mkiv/lpdf-wid.lua +++ b/tex/context/base/mkiv/lpdf-wid.lua @@ -11,11 +11,11 @@ if not modules then modules = { } end modules ['lpdf-wid'] = { -- had renditions but they turned out to be unreliable from the start and look -- obsolete too or at least they are bound to the (obsolete) flash technology for -- rendering. They were already complex constructs. Now we have rich media which --- instead of providing a robust future proof framework fo rgeneral media types +-- instead of providing a robust future proof framework for general media types -- again seems to depend on viewers built in (yes, also kind of obsolete) flash -- technology, and we cannot expect this non-open technology to show up in open -- browsers. So, in the end we can best just use links to external resources to be --- future proof. Just look at the viewer prferences pane to see how fragile support +-- future proof. Just look at the viewer preferences pane to see how fragile support -- is. Interestingly u3d support is kind of built in, while e.g. mp4 support relies -- on wrapping in swf. We used to stay ahead of the pack with support of the fancy -- pdf features but it backfires and is not worth the trouble. And yes, for control diff --git a/tex/context/base/mkiv/meta-nod.lua b/tex/context/base/mkiv/meta-nod.lua new file mode 100644 index 000000000..119c276e2 --- /dev/null +++ b/tex/context/base/mkiv/meta-nod.lua @@ -0,0 +1,29 @@ +if not modules then modules = { } end modules ['meta-nod'] = { + version = 1.001, + comment = "companion to meta-nod.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local references = { } + +metapost.nodes = { + + initialize = function() + references = { } + end, + + register = function(s,r) + references[s] = r + end, + + resolve = function(s) + context(references[s] or ("\\number " .. (tonumber(s) or 0))) + end, + + reset = function() + references = { } + end, + +} diff --git a/tex/context/base/mkiv/meta-nod.mkiv b/tex/context/base/mkiv/meta-nod.mkiv index 5c7b3d503..bf36e315c 100644 --- a/tex/context/base/mkiv/meta-nod.mkiv +++ b/tex/context/base/mkiv/meta-nod.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +\registerctxluafile{meta-nod}{} + \unprotect \defineMPinstance @@ -105,6 +107,9 @@ \let\stopnodes\relax +%D Hm, we started out simple but it now quickly becomes the usual mess of +%D \TEX, \METAPOST\ and \LUA. Hard to understand. + \unexpanded\def\startnodes {\dosingleempty\meta_nodes_start} @@ -120,6 +125,7 @@ #2\removeunwantedspaces % for alan, will be commented: \writestatus{metanodes}{\detokenize\expandafter{\the\t_meta_nodes}}% + \ctxlua{metapost.nodes.initialize()}% \startMPcode mfun_node_init(% \the\dimexpr\metanodesparameter\c!dx\relax,% @@ -129,11 +135,9 @@ \the\t_meta_nodes ; mfun_node_flush ; \stopMPcode + \ctxlua{metapost.nodes.reset()}% \egroup} -% \unexpanded\def\grph_nodes_node[#1,#2]#3% -% {\etoksapp\t_meta_nodes{mfun_node_make(\number#1,\number#2,"\metanodesparameter\c!command{#3}");}} - \unexpanded\def\grph_nodes_node {\dodoubleempty\grph_nodes_node_two} @@ -145,10 +149,16 @@ \ifsecondargument \setupcurrentmetanodes[#3]% \fi - \edef\p_label{#4}% + \edef\p_label {#4}% + \edef\p_reference{\metanodesparameter\c!reference}% + \ifx\p_reference\empty\else + \ctxlua{metapost.nodes.register("\p_reference",\number#1)}% + \fi \normalexpanded{\endgroup\noexpand\etoksapp\t_meta_nodes{% mfun_node_make(\number#1,\number#2% - \ifx\p_label\empty \else + \ifx\p_label\empty + ,""% + \else ,"\metanodesparameter\c!command{\p_label}"% \fi );% @@ -199,8 +209,11 @@ \space mfun_nodes_fromto\begincsname\??metanodesposition\metanodesparameter\c!position\endcsname(% \metanodesparameter\c!offset,% - \number#1,\number#2% - \ifx\p_label\empty \else + % \number#1,\number#2% + \ctxlua{metapost.nodes.resolve("#1")},\ctxlua{metapost.nodes.resolve("#2")}% + \ifx\p_label\empty + ,""% + \else ,"\ifx\p_command\empty\p_label\else\p_command{\p_label}\fi"% \fi )% diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua index 5681edfd1..237efe901 100644 --- a/tex/context/base/mkiv/mlib-pps.lua +++ b/tex/context/base/mkiv/mlib-pps.lua @@ -37,6 +37,7 @@ local stoptiming = statistics.stoptiming local trace_runs = false trackers.register("metapost.runs", function(v) trace_runs = v end) local trace_textexts = false trackers.register("metapost.textexts", function(v) trace_textexts = v end) local trace_scripts = false trackers.register("metapost.scripts", function(v) trace_scripts = v end) +local trace_btexetex = false trackers.register("metapost.btexetex", function(v) trace_btexetex = v end) local report_metapost = logs.reporter("metapost") local report_textexts = logs.reporter("metapost","textexts") diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua index 6aa433627..7b10f6273 100644 --- a/tex/context/base/mkiv/mlib-run.lua +++ b/tex/context/base/mkiv/mlib-run.lua @@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['mlib-run'] = { license = "see context related readme files", } +-- todo mpx :execute -> mlib.execute(mpx,) + -- cmyk -> done, native -- spot -> done, but needs reworking (simpler) -- multitone -> @@ -38,7 +40,6 @@ local P = lpeg.P local trace_graphics = false trackers.register("metapost.graphics", function(v) trace_graphics = v end) local trace_tracingall = false trackers.register("metapost.tracingall", function(v) trace_tracingall = v end) -local trace_btexetex = false trackers.register("metapost.btexetex", function(v) trace_btexetex = v end) local report_metapost = logs.reporter("metapost") local texerrormessage = logs.texerrormessage diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 95eed4d50..2cb1e6fa2 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 757509873..5081fb91f 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-tag.mkiv b/tex/context/base/mkiv/strc-tag.mkiv index 4f7449b93..6d05135b5 100644 --- a/tex/context/base/mkiv/strc-tag.mkiv +++ b/tex/context/base/mkiv/strc-tag.mkiv @@ -492,13 +492,16 @@ % }% % \to \everyenableelements -\appendtoks - \dostartignoretagging -\to \everybeforepagebody +% This doesn't work well either, so instead we handle the ornaments in the +% tagging in a different way (see attr -> false code). -\appendtoks - \dostopignoretagging -\to \everyafterpagebody +% \appendtoks +% \dostartignoretagging +% \to \everybeforepagebody +% +% \appendtoks +% \dostopignoretagging +% \to \everyafterpagebody % \doifelseinelement{structure:section} {yes} {no} % \doifelseinelement{structure:chapter} {yes} {no} diff --git a/tex/context/base/mkiv/typo-dir.mkiv b/tex/context/base/mkiv/typo-dir.mkiv index d7d3b178d..dd0a03329 100644 --- a/tex/context/base/mkiv/typo-dir.mkiv +++ b/tex/context/base/mkiv/typo-dir.mkiv @@ -28,7 +28,7 @@ \registerctxluafile{typo-duc}{} } -\definesystemattribute[directions][public] +\definesystemattribute[directions][public,global] \installcorenamespace{directions} \installcorenamespace{directionsbidimode} diff --git a/tex/context/interface/mkii/keys-nl.xml b/tex/context/interface/mkii/keys-nl.xml index 463f1f84d..bfb8b1809 100644 --- a/tex/context/interface/mkii/keys-nl.xml +++ b/tex/context/interface/mkii/keys-nl.xml @@ -1033,6 +1033,7 @@ <cd:constant name='otherstext' value='otherstext'/> <cd:constant name='outermargin' value='buitenmarge'/> <cd:constant name='overprint' value='overprint'/> + <cd:constant name='ownerpassword' value='ownerpassword'/> <cd:constant name='ownnumber' value='eigennummer'/> <cd:constant name='page' value='pagina'/> <cd:constant name='pageboundaries' value='paginaovergangen'/> @@ -1274,6 +1275,7 @@ <cd:constant name='up' value='up'/> <cd:constant name='urlalternative' value='urlvariant'/> <cd:constant name='urlspace' value='urlspatie'/> + <cd:constant name='userpassword' value='userpassword'/> <cd:constant name='validate' value='valideer'/> <cd:constant name='values' value='waarden'/> <cd:constant name='vcommand' value='vcommando'/> diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index 880a07489..620b85ea4 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -1033,6 +1033,7 @@ <cd:constant name='otherstext' value='otherstext'/> <cd:constant name='outermargin' value='حاشیهخارجی'/> <cd:constant name='overprint' value='overprint'/> + <cd:constant name='ownerpassword' value='ownerpassword'/> <cd:constant name='ownnumber' value='شمارهخود'/> <cd:constant name='page' value='صفحه'/> <cd:constant name='pageboundaries' value='مرزهایصفحه'/> @@ -1274,6 +1275,7 @@ <cd:constant name='up' value='up'/> <cd:constant name='urlalternative' value='urlalternative'/> <cd:constant name='urlspace' value='urlspace'/> + <cd:constant name='userpassword' value='userpassword'/> <cd:constant name='validate' value='تاییداعتبار'/> <cd:constant name='values' value='values'/> <cd:constant name='vcommand' value='vcommand'/> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 1710e750c..c0cfd1900 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex a7f406e90..ee2bcebcf 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf |