diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-09-14 22:27:31 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-09-14 22:27:31 +0200 |
commit | 51bc89e03d05e3329b2ef74de2720937f92aa81f (patch) | |
tree | 6fed26b867ff310050fb862aa658e13dfb35e5dc /tex | |
parent | a8c525cd14d77b94662021671ef8eb62d5a7fe50 (diff) | |
download | context-51bc89e03d05e3329b2ef74de2720937f92aa81f.tar.gz |
2021-09-14 21:41:00
Diffstat (limited to 'tex')
21 files changed, 303 insertions, 239 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 98286f8e9..9f2d862ef 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{2021.09.13 09:37} +\newcontextversion{2021.09.14 21:39} %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 a39318d4b..5d7d70d08 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{2021.09.13 09:37} +\edef\contextversion{2021.09.14 21:39} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 68a07fb83..229232ea2 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.09.13 09:37} +\newcontextversion{2021.09.14 21:39} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 159c8ebc7..a8f8ac3ad 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.09.13 09:37} +\edef\contextversion{2021.09.14 21:39} %D Kind of special: diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua index b4e753182..a4d408e13 100644 --- a/tex/context/base/mkiv/font-osd.lua +++ b/tex/context/base/mkiv/font-osd.lua @@ -881,38 +881,44 @@ local function initialize_one(font,attr) -- we need a proper hook into the datas end +-- HH: somehow we can get a non context here so for now we check for .n + local function contextchain(contexts, n) local char = getchar(n) - for k=1,#contexts do - local ck = contexts[k] - local seq = ck[3] - local f = ck[4] - local l = ck[5] - if (l - f) == 1 and seq[f+1][char] then - local ok = true - local c = n - for i=l+1,#seq do - c = getnext(c) - if not c or not seq[i][ischar(c)] then - ok = false - break - end - end - if ok then - c = getprev(n) - for i=1,f-1 do - c = getprev(c) - if not c or not seq[f-i][ischar(c)] then + if not contexts.n then + return contexts[char] + else + for k=1,#contexts do + local ck = contexts[k] + local seq = ck[3] + local f = ck[4] + local l = ck[5] + if (l - f) == 1 and seq[f+1][char] then + local ok = true + local c = n + for i=l+1,#seq do + c = getnext(c) + if not c or not seq[i][ischar(c)] then ok = false + break end end - end - if ok then - return true + if ok then + c = getprev(n) + for i=1,f-1 do + c = getprev(c) + if not c or not seq[f-i][ischar(c)] then + ok = false + end + end + end + if ok then + return true + end end end + return false end - return false end local function order_matras(c) @@ -1765,7 +1771,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas local found = lookupcache[c] if found then local next = getnext(current) - if found[getchar(next)] or contextchain(found, next) then --above-base: rphf Consonant + Halant + -- if found[getchar(next)] or contextchain(found, next) then --above-base: rphf Consonant + Halant + if contextchain(found, next) then --above-base: rphf Consonant + Halant local afternext = next ~= stop and getnext(next) if afternext and zw_char[getchar(afternext)] then -- ZWJ and ZWNJ prevent creation of reph current = afternext -- getnext(next) @@ -1789,7 +1796,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas local found = lookupcache[c] if found then -- pre-base: pref Halant + Consonant local next = getnext(current) - if found[getchar(next)] or contextchain(found, next) then + -- if found[getchar(next)] or contextchain(found, next) then + if contextchain(found, next) then if (not getstate(current) and not getstate(next)) then --KE: state can also be init... setstate(current,s_pref) setstate(next,s_pref) @@ -1809,7 +1817,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas local found = lookupcache[c] if found then local next = getnext(current) - if found[getchar(next)] or contextchain(found, next) then + -- if found[getchar(next)] or contextchain(found, next) then + if contextchain(found, next) then if next ~= stop and getchar(getnext(next)) == c_zwnj then -- zwnj prevent creation of half current = next elseif (not getstate(current)) then --KE: state can also be init... @@ -1833,7 +1842,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas local found = lookupcache[c] if found then local next = getnext(current) - if found[getchar(next)] or contextchain(found, next) then + -- if found[getchar(next)] or contextchain(found, next) then + if contextchain(found, next) then if (not getstate(current) and not getstate(next)) then --KE: state can also be init... setstate(current,s_blwf) setstate(next,s_blwf) @@ -1854,7 +1864,8 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas local found = lookupcache[c] if found then local next = getnext(current) - if found[getchar(next)] or contextchain(found, next) then + -- if found[getchar(next)] or contextchain(found, next) then + if contextchain(found, next) then if (not getstate(current) and not getstate(next)) then -- KE: state can also be init... setstate(current,s_pstf) setstate(next,s_pstf) @@ -1953,7 +1964,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas return head, stop, nbspaces else if getstate(base) then -- state can also be init - setstate(base,unsetvalue) + setstate(base,unsetvalue) -- THIS RESETS THE HALF STATE end basepos = base end diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 288067563..ab89b665a 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -398,8 +398,10 @@ return { "insertheight", "insertheights", "insertlimit", + "insertmaxdepth", "insertmode", "insertmultiplier", + "insertpenalty", "insertprogress", "insertstorage", "insertstoring", @@ -474,6 +476,8 @@ return { "outputbox", "overloaded", "overloadmode", + "pageboundary", + "pagevsize", "parametercount", "parametermark", "parattribute", @@ -867,7 +871,6 @@ return { "pageshrink", "pagestretch", "pagetotal", - "pagevsize", "par", "parfillleftskip", "parfillskip", diff --git a/tex/context/base/mkiv/scrn-wid.lua b/tex/context/base/mkiv/scrn-wid.lua index e8688e4b2..e92be778f 100644 --- a/tex/context/base/mkiv/scrn-wid.lua +++ b/tex/context/base/mkiv/scrn-wid.lua @@ -300,7 +300,6 @@ implement { actions = renderings.register, arguments = { { - { "type" }, { "label" }, { "mime" }, { "filename" }, @@ -323,6 +322,8 @@ implement { { "height", "dimen" }, { "option" }, { "page", "integer" }, + { "openpage" }, + { "closepage" }, } } } diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 2eaad3b9c..bd0ed1cb8 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 05e942bc1..e13549417 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index c9e67279a..7d8c75b86 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.09.13 09:37} +\newcontextversion{2021.09.14 21:39} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 97035d34e..77f9ab4d4 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.09.13 09:37} +\immutable\edef\contextversion{2021.09.14 21:39} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt index f83fd8776..4d4c09495 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -3866,7 +3866,6 @@ do local steps = sequence.steps local nofsteps = sequence.nofsteps local skiphash = sequence.skiphash - if not steps then -- This permits injection, watch the different arguments. Watch out, the arguments passed -- are not frozen as we might extend or change this. Is this used at all apart from some @@ -3921,11 +3920,19 @@ do local lookupcache = step.coverage while start do local nxt, char, id = isnextchar(start,font,dynamic,state) -- we can move the data/state checks here +-- if forcetestrun and sequence.name == "s_s_7" then +-- if nuts.getid(start) == nodecodes.glyph then +-- print("C F D S",start,char,font,dynamic,state,nuts,getstate(start)) +-- end +-- end if char then if skiphash and skiphash[char] then -- we never needed it here but let's try start = nxt else local lookupmatch = lookupcache[char] +-- if forcetestrun and sequence.name == "s_s_7" then +-- print(lookupmatch) +-- end if lookupmatch then currentscale, currentxscale, currentyscale = getscales(start) local ok, df diff --git a/tex/context/base/mkxl/lpdf-wid.lmt b/tex/context/base/mkxl/lpdf-wid.lmt index 29b0b2a9f..5fde1b1a5 100644 --- a/tex/context/base/mkxl/lpdf-wid.lmt +++ b/tex/context/base/mkxl/lpdf-wid.lmt @@ -45,6 +45,7 @@ local nodes = nodes local context = context local texgetcount = tex.getcount +local getmacro = tokens.getters.macro local hpacknode = nodes.hpack @@ -616,32 +617,45 @@ end local ms, mu, mf = { }, { }, { } local function delayed(label) - local a = pdfreserveobject() - mu[label] = a - return pdfreference(a) + local reserved = mu[label] + if not reserved then + reserved = pdfreserveobject() + mu[label] = reserved + end + return pdfreference(reserved) +end + +local function checkedreference(ref) + local set, bug = structures.references.identify("",ref) + if not bug and #set > 0 then + return pdfaction(set) + end end local function insertrenderingwindow(specification) - local label = specification.label - -- local openpage = specification.openpage - -- local closepage = specification.closepage - if specification.option == v_auto then - if openpageaction then - -- \handlereferenceactions{\v!StartRendering{#2}} + local actions = nil + local label = specification.label + local openpage = specification.openpage + local closepage = specification.closepage + local option = settings_to_hash(specification.option) + if option[v_auto] then + if not openpage or openpage == "" then + openpage = variables.StartCurrentRendering end - if closepageaction then - -- \handlereferenceactions{\v!StopRendering {#2}} + if not closepage or closepage == "" then + closepage = variables.StopCurrentRendering end end - local actions = nil + openpage = checkedreference(openpage) + closepage = checkedreference(closepage) if openpage or closepage then actions = pdfdictionary { - PO = (openpage and lpdfaction(openpage )) or nil, - PC = (closepage and lpdfaction(closepage)) or nil, + PO = openpage, + PC = closepage, } end local page = tonumber(specification.page) or texgetcount("realpageno") -- todo - local r = mu[label] or pdfreserveobject() -- why the reserve here? + local r = mu[label] or pdfreserveobject() -- reserve, child refers to parent local a = pdfdictionary { S = pdfconstant("Rendition"), R = mf[label], @@ -671,99 +685,79 @@ local function insertrendering(specification) local option = settings_to_hash(specification.option) if not mf[label] then local filename = specification.filename - local isurl = find(filename,"://",1,true) - local mimetype = specification.mimetype or specification.mime - -- local start = pdfdictionary { - -- Type = pdfconstant("MediaOffset"), - -- S = pdfconstant("T"), -- time - -- T = pdfdictionary { -- time - -- Type = pdfconstant("Timespan"), - -- S = pdfconstant("S"), - -- V = 3, -- time in seconds - -- }, - -- } - -- local start = pdfdictionary { - -- Type = pdfconstant("MediaOffset"), - -- S = pdfconstant("F"), -- frame - -- F = 100 -- framenumber - -- } - -- local start = pdfdictionary { - -- Type = pdfconstant("MediaOffset"), - -- S = pdfconstant("M"), -- mark - -- M = "somemark", - -- } - -- local parameters = pdfdictionary { - -- BE = pdfdictionary { - -- B = start, - -- } - -- } - local parameters = pdfdictionary { - Type = pdfconstant("MediaPermissions"), - TF = pdfstring("TEMPALWAYS"), -- TEMPNEVER TEMPEXTRACT TEMPACCESS TEMPALWAYS / needed for acrobat/wmp - } - local descriptor = pdfdictionary { - Type = pdfconstant("Filespec"), - F = filename, - } - if isurl then - descriptor.FS = pdfconstant("URL") - descriptor = pdfreference(pdfflushobject(descriptor)) - elseif option[v_embed] then - descriptor = codeinjections.embedfile { - file = filename, - mimetype = mimetype, -- yes or no - title = option[v_title], - compress = option[v_compress] or false, - forcereference = option[v_list] ~= v_no, + if filename and filename ~= "" then + local isurl = find(filename,"://",1,true) + local mimetype = specification.mimetype or specification.mime + -- local start = pdfdictionary { + -- Type = pdfconstant("MediaOffset"), + -- S = pdfconstant("T"), -- time + -- T = pdfdictionary { -- time + -- Type = pdfconstant("Timespan"), + -- S = pdfconstant("S"), + -- V = 3, -- time in seconds + -- }, + -- } + -- local start = pdfdictionary { + -- Type = pdfconstant("MediaOffset"), + -- S = pdfconstant("F"), -- frame + -- F = 100 -- framenumber + -- } + -- local start = pdfdictionary { + -- Type = pdfconstant("MediaOffset"), + -- S = pdfconstant("M"), -- mark + -- M = "somemark", + -- } + -- local parameters = pdfdictionary { + -- BE = pdfdictionary { + -- B = start, + -- } + -- } + local parameters = pdfdictionary { + Type = pdfconstant("MediaPermissions"), + TF = pdfstring("TEMPALWAYS"), -- TEMPNEVER TEMPEXTRACT TEMPACCESS TEMPALWAYS / needed for acrobat/wmp } + local descriptor = pdfdictionary { + Type = pdfconstant("Filespec"), + F = filename, + } + if isurl then + descriptor.FS = pdfconstant("URL") + descriptor = pdfreference(pdfflushobject(descriptor)) + elseif option[v_embed] then + descriptor = codeinjections.embedfile { + file = filename, + mimetype = mimetype, -- yes or no + title = option[v_title], + compress = option[v_compress] or false, + forcereference = option[v_list] ~= v_no, + } + end + local clip = pdfdictionary { + Type = pdfconstant("MediaClip"), + S = pdfconstant("MCD"), + N = label, + CT = mimetype, + Alt = pdfarray { "", "file not found" }, -- language id + message + D = descriptor, + P = pdfreference(pdfflushobject(parameters)), + } + local rendition = pdfdictionary { + Type = pdfconstant("Rendition"), + S = pdfconstant("MR"), + N = pdfunicode(label), + C = pdfreference(pdfflushobject(clip)), + } + mf[label] = pdfreference(pdfflushobject(rendition)) end - local clip = pdfdictionary { - Type = pdfconstant("MediaClip"), - S = pdfconstant("MCD"), - N = label, - CT = mimetype, - Alt = pdfarray { "", "file not found" }, -- language id + message - D = descriptor, - P = pdfreference(pdfflushobject(parameters)), - } - local rendition = pdfdictionary { - Type = pdfconstant("Rendition"), - S = pdfconstant("MR"), - N = pdfunicode(label), - C = pdfreference(pdfflushobject(clip)), - } - mf[label] = pdfreference(pdfflushobject(rendition)) - end -end - -local function insertrenderingobject(specification) -- todo - local label = specification.label - if not mf[label] then - report_media("unknown medium, label %a",label) - local clip = pdfdictionary { -- does not work that well one level up - Type = pdfconstant("MediaClip"), - S = pdfconstant("MCD"), - N = label, - D = pdfreference(unknown), -- not label but objectname, hm .. todo? - } - local rendition = pdfdictionary { - Type = pdfconstant("Rendition"), - S = pdfconstant("MR"), - N = label, - C = pdfreference(pdfflushobject(clip)), - } - mf[label] = pdfreference(pdfflushobject(rendition)) end end function codeinjections.processrendering(label) local specification = interactions.renderings.rendering(label) - if not specification then - -- error - elseif specification.type == "external" then + if specification then insertrendering(specification) else - insertrenderingobject(specification) + -- error end end @@ -788,17 +782,23 @@ function codeinjections.insertrenderingwindow(specification) ms[label] = insertrenderingwindow(specification) end -local function set(operation,arguments) - codeinjections.processrendering(arguments) - return pdfdictionary { - S = pdfconstant("Rendition"), - OP = operation, - R = mf[arguments], - AN = ms[arguments] or delayed(arguments), - } +local function set(operation,label) + if not label or label == "" then + -- This one is local to the window so unlikely to be set. + label = getmacro("currentrendering") + end + if label and label ~= "" then + codeinjections.processrendering(label) + return pdfdictionary { + S = pdfconstant("Rendition"), + OP = operation, + R = mf[label], + AN = ms[label] or delayed(label), + } + end end -function executers.startrendering (arguments) return set(0,arguments) end -function executers.stoprendering (arguments) return set(1,arguments) end -function executers.pauserendering (arguments) return set(2,arguments) end -function executers.resumerendering(arguments) return set(3,arguments) end +function executers.startrendering (label) return set(0,label) end +function executers.stoprendering (label) return set(1,label) end +function executers.pauserendering (label) return set(2,label) end +function executers.resumerendering(label) return set(3,label) end diff --git a/tex/context/base/mkxl/page-ini.lmt b/tex/context/base/mkxl/page-ini.lmt index bb5ea2b5d..ef34687c6 100644 --- a/tex/context/base/mkxl/page-ini.lmt +++ b/tex/context/base/mkxl/page-ini.lmt @@ -354,3 +354,19 @@ implement { ctx_doifelse(p) end, } + +-- implement { +-- name = "pagestate", +-- public = true, +-- usage = "value", +-- actions = function() +-- local result = 0 +-- if nodes.nuts.getspeciallist("contribute_head") then +-- result = result | 1 +-- end +-- if nodes.nuts.getspeciallist("page_head") then +-- result = result | 2 +-- end +-- return tokens.values.integer, result +-- end +-- } diff --git a/tex/context/base/mkxl/page-one.mkxl b/tex/context/base/mkxl/page-one.mkxl index 116f2146d..e8f873422 100644 --- a/tex/context/base/mkxl/page-one.mkxl +++ b/tex/context/base/mkxl/page-one.mkxl @@ -66,7 +66,7 @@ -\d_page_floats_inserted_bottom -\insertheights \relax - \insertheights\zeropoint} + }% no: \insertheights\zeropoint} \protected\def\page_one_command_set_vsize {\ifgridsnapping diff --git a/tex/context/base/mkxl/page-sid.mkxl b/tex/context/base/mkxl/page-sid.mkxl index 20e92ad19..37bea4fb3 100644 --- a/tex/context/base/mkxl/page-sid.mkxl +++ b/tex/context/base/mkxl/page-sid.mkxl @@ -420,7 +420,12 @@ {\iftracesidefloats \enabletrackers[otr.forcestrutdepth]% \c_page_force_strut_depth_trace_mode\plusone \fi + % flush what we have and check \forcestrutdepth + % trigger pagebuilder + % \penalty\zerocount + \pageboundary + % catch up \page_otr_command_set_vsize} % new, no longer really needed \def\page_sides_flush_floats @@ -734,7 +739,7 @@ % \ifdim\pagegoal=\maxdimen % \pagegoal\textheight % maybe % \fi - \global\d_page_sides_page_total \pagetotal % global + \global\d_page_sides_page_total\pagetotal % global \ifnum\c_page_sides_float_type<\plusfour \global\d_page_sides_width \zeropoint \orelse\ifnum\c_page_sides_float_type>\plusfive @@ -746,7 +751,7 @@ \global\d_page_sides_width\zeropoint \fi \global\d_page_sides_hsize \dimexpr\hsize-\d_page_sides_width\relax - \global\d_page_sides_height\dimexpr\ht\floatbox+\dp\floatbox+\d_page_sides_toptotal\relax + \global\d_page_sides_height\dimexpr\htdp\floatbox+\d_page_sides_toptotal\relax \global\d_page_sides_vsize \dimexpr\d_page_sides_height+\d_page_sides_page_total\relax \scratchdimenone\d_page_sides_vsize \scratchdimentwo\pagegoal diff --git a/tex/context/base/mkxl/scrn-wid.mklx b/tex/context/base/mkxl/scrn-wid.mklx index b35047d94..76d4a14e6 100644 --- a/tex/context/base/mkxl/scrn-wid.mklx +++ b/tex/context/base/mkxl/scrn-wid.mklx @@ -605,14 +605,30 @@ \relax \fi} -%D Renderings (not yet tested in mkvi): - -% Todo: multiple instances and inheritance .. will be done when needed i.e. when I -% see usage. Probaly by that time this feature is dropped (as are other media -% rel;ated ones). +%D Renderings (adapted to \MKIV\ by Michal Vlasák). We no longer have the \MKII\ internal +%D and external rendering because over time all this widget stuff changed in \PDF\ and +%D Acrobat. +%D +%D \starttyping +%D \setupinteraction[state=start] +%D +%D \starttext +%D \startTEXpage[offset=10pt] +%D % \definerenderingwindow[myrenderingwindow][width=\textwidth, height=\textwidth] +%D % \definerenderingwindow[myrenderingwindow][width=\textwidth, height=\textwidth, openpageaction=StartRendering{myvideo}] +%D \definerenderingwindow[myrenderingwindow][width=\textwidth, height=\textwidth, openpageaction=StartCurrentRendering, closepageaction=StopCurrentRendering] +%D % \userendering[myvideo][video/mp4][edited.mp4][embed=yes, auto] +%D \userendering[myvideo][video/mp4][woodwork.mp4][embed=yes, auto] +%D % auto = openpageaction=StartCurrentRendering, closepageaction=StopCurrentRendering +%D \placerenderingwindow[myrenderingwindow][myvideo] +%D \blank +%D \goto{start}[StartRendering{myvideo}] +%D \goto{stop}[StopRendering{myvideo}] +%D \stopTEXpage +%D \stoptext +%D \stoptyping \mutable\let\currentrendering \empty -\mutable\let\currentrenderingtype \empty \mutable\let\currentrenderingwindow\empty \definereference[StartCurrentRendering] [\v!StartRendering {\currentrendering}] @@ -620,31 +636,16 @@ \definereference[PauseCurrentRendering] [\v!PauseRendering {\currentrendering}] \definereference[ResumeCurrentRendering][\v!ResumeRendering{\currentrendering}] -\permanent\tolerant\protected\def\useexternalrendering[#tag]#spacer[#mime]#spacer[#file]#spacer[#option]% +\permanent\tolerant\protected\def\userendering[#tag]#spacer[#mime]#spacer[#file]#spacer[#option]% {\clf_registerrendering - type {external}% label {#tag}% mime {#mime}% filename {#file}% option {#option}% \relax} -\permanent\tolerant\protected\def\setinternalrendering[#tag]#spacer[#option]% {content} % crappy - {\bgroup - \dowithnextbox - {\clf_registerrendering - type {internal}% - label {#tag}% - mime {IRO}% brrr - filename {#tag}% - option {#option}% - \relax - \let\objectoffset\zeropoint - \setobject{IRO}{#tag}\hpack{\box\nextbox}% - \egroup}% - \hbox} +\permanent\tolerant\protected\let\useexternalrendering\userendering -\permanent\def\renderingtype #tag{\clf_renderingvar{#tag}{type}} \permanent\def\renderingoption#tag{\clf_renderingvar{#tag}{option}} \newdimen\d_scrn_rendering_width \d_scrn_rendering_width 8cm @@ -681,13 +682,7 @@ \else \edef\currentrenderingwindow{#window}% \fi - \edef\currentrenderingtype{\renderingtype\currentrendering}% - \ifx\currentrenderingtype\s!internal - \getobjectdimensions{IRO}\currentrendering - \d_scrn_rendering_height\dimexpr\objectheight+\objectdepth\relax - \d_scrn_rendering_width\objectwidth\relax - \getobjectreferencepage{IRO}\currentrendering\m_scrn_rendering_page - \orelse\ifx\currentrenderingwindow\s!default + \ifx\currentrenderingwindow\s!default \d_scrn_rendering_height\vsize \d_scrn_rendering_width \hsize \let\m_scrn_rendering_page\realpageno @@ -696,19 +691,18 @@ \d_scrn_rendering_width \renderingwindowparameter\c!width \let\m_scrn_rendering_page\realpageno \fi - % todo: - % \handlereferenceactions{\renderingwindowparameter\c!openpageaction }\dosetuprenderingopenpageaction - % \handlereferenceactions{\renderingwindowparameter\c!closepageaction}\dosetuprenderingclosepageaction \letrenderingwindowparameter\c!offset\v!overlay \inheritedrenderingwindowframed {\vfilll \dontleavehmode \clf_insertrenderingwindow - label {\currentrendering}% - width \d_scrn_rendering_width - height \d_scrn_rendering_height - option {\renderingoption\currentrendering}% - page \m_scrn_rendering_page + label {\currentrendering}% + width \d_scrn_rendering_width + height \d_scrn_rendering_height + option {\renderingoption\currentrendering}% + page \m_scrn_rendering_page + openpage {\renderingwindowparameter\c!openpageaction}% + closepage {\renderingwindowparameter\c!closepageaction}% \relax \hfill}% \egroup} diff --git a/tex/context/base/mkxl/spac-ver.lmt b/tex/context/base/mkxl/spac-ver.lmt index cd6dd46ad..c4da389f9 100644 --- a/tex/context/base/mkxl/spac-ver.lmt +++ b/tex/context/base/mkxl/spac-ver.lmt @@ -2438,8 +2438,10 @@ do -- end -- end - local hlist_code = nodes.nodecodes.hlist - local line_code = nodes.listcodes.line + local hlist_code = nodes.nodecodes.hlist + local insert_code = nodes.nodecodes.insert + local mark_code = nodes.nodecodes.mark + local line_code = nodes.listcodes.line local nuts = nodes.nuts local getid = nuts.getid @@ -2464,23 +2466,40 @@ do end end) + local treversenode = nuts.treversers.node + function vspacing.forcestrutdepth() -- check if in mvl if texgetnest("ptr") == 0 then - triggerbuildpage() -- return true when mvl - local head, tail = getspeciallist("page_head") - if tail and getid(tail) == hlist_code and getsubtype(tail) == line_code then -- isline(tail) - local strutdp = texgetdimen("strutdp") - local delta = strutdp - getdepth(tail) - if delta > 0 then - setdepth(tail,strutdp) - texset("pagetotal",texget("pagetotal") + delta) - texset("pagedepth",strutdp) - if trace then - trace(tail) + -- this flushes the contributions + while getspeciallist("contribute_head") do + triggerbuildpage() + end + -- now we consult the last line (if present) + local head, tail = getspeciallist("page_head") + if tail then + for n, id, subtype in treversenode, tail do + if id == hlist_code then + if subtype == line_code then + local strutdp = texgetdimen("strutdp") + local delta = strutdp - getdepth(n) + if delta > 0 then + setdepth(n,strutdp) + texset("pagetotal",texget("pagetotal") + delta) + texset("pagedepth",strutdp) + if trace then + trace(n) + end + end + end + break + elseif id == insert_code or id == mark_code then + -- prev + else + break end end - end + end else local nest = texgetnest() -- if abs(nest.mode) == vmode_code and nest.head then diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index 3300d2f75..38078f08d 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -277,7 +277,11 @@ local function setvisual(n,a,what,list) -- this will become more efficient when end end elseif type(n) == "number" then - a = a | n + if not a or a == 0 or a == unsetvalue then + a = n + else + a = a | n + end end if not a or a == 0 or a == unsetvalue then return unsetvalue diff --git a/tex/context/modules/mkiv/x-res-50.mkiv b/tex/context/modules/mkiv/x-res-50.mkiv index 62a86b7a7..c86e08723 100644 --- a/tex/context/modules/mkiv/x-res-50.mkiv +++ b/tex/context/modules/mkiv/x-res-50.mkiv @@ -301,8 +301,8 @@ [width=\XMLflush{rl:width}, height=\XMLflush{rl:height}, frame=off, - openpageaction=StartCurrentRendering, - closepageaction=StopCurrentRendering] + openpageaction=StartRendering{mediaclip}, + closepageaction=StoptRendering{mediaclip}] \setlayer [main] diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 66e8b627e..b4687ad85 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-09-13 09:37 +-- merge date : 2021-09-14 21:39 do -- begin closure to overcome local limits and interference @@ -32036,36 +32036,40 @@ local function initialize_one(font,attr) end local function contextchain(contexts,n) local char=getchar(n) - for k=1,#contexts do - local ck=contexts[k] - local seq=ck[3] - local f=ck[4] - local l=ck[5] - if (l-f)==1 and seq[f+1][char] then - local ok=true - local c=n - for i=l+1,#seq do - c=getnext(c) - if not c or not seq[i][ischar(c)] then - ok=false - break - end - end - if ok then - c=getprev(n) - for i=1,f-1 do - c=getprev(c) - if not c or not seq[f-i][ischar(c)] then + if not contexts.n then + return contexts[char] + else + for k=1,#contexts do + local ck=contexts[k] + local seq=ck[3] + local f=ck[4] + local l=ck[5] + if (l-f)==1 and seq[f+1][char] then + local ok=true + local c=n + for i=l+1,#seq do + c=getnext(c) + if not c or not seq[i][ischar(c)] then ok=false + break end end - end - if ok then - return true + if ok then + c=getprev(n) + for i=1,f-1 do + c=getprev(c) + if not c or not seq[f-i][ischar(c)] then + ok=false + end + end + end + if ok then + return true + end end end + return false end - return false end local function order_matras(c) local cn=getnext(c) @@ -32751,7 +32755,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) local found=lookupcache[c] if found then local next=getnext(current) - if found[getchar(next)] or contextchain(found,next) then + if contextchain(found,next) then local afternext=next~=stop and getnext(next) if afternext and zw_char[getchar(afternext)] then current=afternext @@ -32775,7 +32779,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) local found=lookupcache[c] if found then local next=getnext(current) - if found[getchar(next)] or contextchain(found,next) then + if contextchain(found,next) then if (not getstate(current) and not getstate(next)) then setstate(current,s_pref) setstate(next,s_pref) @@ -32795,7 +32799,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) local found=lookupcache[c] if found then local next=getnext(current) - if found[getchar(next)] or contextchain(found,next) then + if contextchain(found,next) then if next~=stop and getchar(getnext(next))==c_zwnj then current=next elseif (not getstate(current)) then @@ -32819,7 +32823,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) local found=lookupcache[c] if found then local next=getnext(current) - if found[getchar(next)] or contextchain(found,next) then + if contextchain(found,next) then if (not getstate(current) and not getstate(next)) then setstate(current,s_blwf) setstate(next,s_blwf) @@ -32840,7 +32844,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) local found=lookupcache[c] if found then local next=getnext(current) - if found[getchar(next)] or contextchain(found,next) then + if contextchain(found,next) then if (not getstate(current) and not getstate(next)) then setstate(current,s_pstf) setstate(next,s_pstf) @@ -32932,7 +32936,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) return head,stop,nbspaces else if getstate(base) then - setstate(base,unsetvalue) + setstate(base,unsetvalue) end basepos=base end |