diff options
Diffstat (limited to 'tex')
27 files changed, 475 insertions, 313 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 253b3250a..1754d01bb 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.08.14 23:10} +\newcontextversion{2018.08.15 18:45} %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 633142980..98ae174c2 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.08.14 23:10} +\edef\contextversion{2018.08.15 18:45} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cldf-bas.lua b/tex/context/base/mkiv/cldf-bas.lua index 02f8e3e5b..0f9ef4e47 100644 --- a/tex/context/base/mkiv/cldf-bas.lua +++ b/tex/context/base/mkiv/cldf-bas.lua @@ -176,6 +176,16 @@ context.registers = { newchar = function(name,u) context([[\chardef\%s=%s\relax]],name,u) end, } -function context.latelua(f) - sprint(new_latelua(f)) -- maybe just context +if LUATEXFUNCTIONALITY > 6780 then + + function context.latelua(f) + sprint(new_latelua(f)) -- maybe just context + end + +else + + function context.latelua(f) + context(new_latelua(f)) + end + end diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 84022b992..1bc20c01a 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.08.14 23:10} +\newcontextversion{2018.08.15 18:45} %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 357707a14..c6262c682 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.08.14 23:10} +\edef\contextversion{2018.08.15 18:45} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/data-tex.lua b/tex/context/base/mkiv/data-tex.lua index 2d2c9b24d..8f978a204 100644 --- a/tex/context/base/mkiv/data-tex.lua +++ b/tex/context/base/mkiv/data-tex.lua @@ -149,19 +149,19 @@ function helpers.textopener(tag,filename,filehandle,coding) currentline = currentline + 1 -- self.currentline = currentline local content = lines[currentline] - if not content then - return nil - elseif content == "" then + if content == "" then return "" -- elseif content == ctrl_d or ctrl_z then -- return nil -- we need this as \endinput does not work in prints - else + elseif content then local runner = textlineactions.runner if runner then return runner(content,filename,currentline,noflines,coding) or content else return content end + else + return nil end end end diff --git a/tex/context/base/mkiv/export-example.css b/tex/context/base/mkiv/export-example.css index f831d14a5..c39f0bec6 100644 --- a/tex/context/base/mkiv/export-example.css +++ b/tex/context/base/mkiv/export-example.css @@ -1123,6 +1123,13 @@ context|div.comment { font-family : "DejaVu Sans Mono", "Lucida Console", monospace ; } +/* blocks */ + +block, +context|div.block { + display : block ; +} + /* special */ c, diff --git a/tex/context/base/mkiv/luat-env.lua b/tex/context/base/mkiv/luat-env.lua index 5b46b4036..a01a8cf84 100644 --- a/tex/context/base/mkiv/luat-env.lua +++ b/tex/context/base/mkiv/luat-env.lua @@ -11,7 +11,7 @@ -- sense. Much of this evolved before bytecode arrays were available and so a lot of -- code has disappeared already. -local rawset, rawget, loadfile, assert = rawset, rawget, loadfile, assert +local rawset, rawget, loadfile = rawset, rawget, loadfile local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) @@ -123,7 +123,7 @@ function environment.loadluafile(filename, version) luaname = file.addsuffix(basename,luasuffixes.lua) lucname = file.addsuffix(basename,luasuffixes.luc) else - luaname = basename -- forced suffix + luaname = filename -- forced suffix lucname = nil end -- when not overloaded by explicit suffix we look for a luc file first @@ -136,7 +136,7 @@ function environment.loadluafile(filename, version) chunk = loadfile(fullname) -- this way we don't need a file exists check end if chunk then - assert(chunk)() + chunk() if version then -- we check of the version number of this chunk matches local v = version -- can be nil @@ -168,7 +168,7 @@ function environment.loadluafile(filename, version) report_lua("unknown file %a",filename) end else - assert(chunk)() + chunk() return true end end diff --git a/tex/context/base/mkiv/node-fin.lua b/tex/context/base/mkiv/node-fin.lua index 3e7a4cd1b..ff7ac7598 100644 --- a/tex/context/base/mkiv/node-fin.lua +++ b/tex/context/base/mkiv/node-fin.lua @@ -23,6 +23,7 @@ local getlist = nuts.getlist local getleader = nuts.getleader local getattr = nuts.getattr local getwidth = nuts.getwidth +local getwhd = nuts.getwhd local setlist = nuts.setlist local setleader = nuts.setleader @@ -295,7 +296,9 @@ local function process(attribute,head,inheritance,default) -- one attribute -- end nested -- end elseif id == rule_code then - check = getwidth(stack) ~= 0 +-- check = getwidth(stack) ~= 0 +local wd, ht, dp = getwhd(stack) +check = wd ~= 0 or (ht+dp) ~= 0 end -- much faster this way than using a check() and nested() function if check then @@ -491,7 +494,9 @@ local function selective(attribute,head,inheritance,default) -- two attributes -- end nested end elseif id == rule_code then - check = getwidth(stack) ~= 0 +-- check = getwidth(stack) ~= 0 +local wd, ht, dp = getwhd(stack) +check = wd ~= 0 or (ht+dp) ~= 0 end if check then @@ -601,7 +606,9 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance, end end elseif id == rule_code then - check = getwidth(stack) ~= 0 +-- check = getwidth(stack) ~= 0 +local wd, ht, dp = getwhd(stack) +check = wd ~= 0 or (ht+dp) ~= 0 end if check then local a = getattr(stack,attribute) @@ -612,9 +619,12 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance, current = a end if leader then - local list = stacked(attribute,content,current) - if leader ~= list then - setleader(stack,list) -- only if ok + local content = getlist(leader) + if content then + local list = stacked(attribute,content,current) + if leader ~= list then + setleader(stack,list) -- only if ok + end end leader = false end @@ -683,7 +693,9 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance, end end elseif id == rule_code then - check = getwidth(current) ~= 0 +-- check = getwidth(current) ~= 0 +local wd, ht, dp = getwhd(current) +check = wd ~= 0 or (ht+dp) ~= 0 end if check then @@ -700,7 +712,17 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance, attrib = a if leader then -- tricky as a leader has to be a list so we cannot inject before - local list = stacker(attribute,leader,attrib) + -- local list = stacker(attribute,leader,attrib) + -- leader = false + + local content = getlist(leader) + if content then + local list = stacker(attribute,leader,attrib) + if leader ~= list then + setleader(current,list) + end + end + leader = false end end diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua index f606e393c..ee0119d49 100644 --- a/tex/context/base/mkiv/node-fnt.lua +++ b/tex/context/base/mkiv/node-fnt.lua @@ -215,6 +215,7 @@ function handlers.characters(head,groupcode,size,packtype,direction) local prevattr = 0 local variants = nil local redundant = nil + local firstnone = nil local lastfont = nil local lastproc = nil local lastnone = nil @@ -261,7 +262,7 @@ function handlers.characters(head,groupcode,size,packtype,direction) end end - local function setnode(n,font,attr) -- we could use prevfont and prevattr when we set then first + local function setnode(n,font,attr) -- we could use prevfont and prevattr when we set them first if firstnone then protectnone() end @@ -554,30 +555,22 @@ end if LUATEXVERSION >= 1.090 then - function handlers.characters(head,groupcode,size,packtype,direction) - -- either next or not, but definitely no already processed list - starttiming(nodes) - - local usedfonts = { } - local attrfonts = { } - local basefonts = { } - local basefont = nil - local prevfont = nil - local prevattr = 0 - local variants = nil - local redundant = nil - local lastfont = nil - local lastproc = nil - local lastnone = nil - - local a, u, b, r, e = 0, 0, 0, 0, 0 - - if trace_fontrun then - start_trace(head) - end + do + + local usedfonts + local attrfonts + local basefonts + local basefont + local prevfont + local prevattr + local variants + local redundant + local firstnone + local lastfont + local lastproc + local lastnone - -- There is no gain in checking for a single glyph and then having a fast path. On the - -- metafun manual (with some 2500 single char lists) the difference is just noise. + local a, u, b, r, e local function protectnone() protect_glyphs(firstnone,lastnone) @@ -646,262 +639,292 @@ if LUATEXVERSION >= 1.090 then end end - for n, char, font in nextchar, head do - -- local attr = (none and prevattr) or getattr(n,0) or 0 -- zero attribute is reserved for fonts in context - local attr = getattr(n) or 0 -- zero attribute is reserved for fonts in context - if font ~= prevfont or attr ~= prevattr then - prevfont = font - prevattr = attr - variants = fontvariants[font] - local fontmode = fontmodes[font] - if fontmode == "none" then - setnone(n) - elseif fontmode == "base" then - setbase(n) - else - setnode(n,font,attr) + function handlers.characters(head,groupcode,size,packtype,direction) + -- either next or not, but definitely no already processed list + starttiming(nodes) + + usedfonts = { } + attrfonts = { } + basefonts = { } + basefont = nil + prevfont = nil + prevattr = 0 + variants = nil + redundant = nil + firstnone = nil + lastfont = nil + lastproc = nil + lastnone = nil + + a, u, b, r, e = 0, 0, 0, 0, 0 + + if trace_fontrun then + start_trace(head) + end + + -- There is no gain in checking for a single glyph and then having a fast path. On the + -- metafun manual (with some 2500 single char lists) the difference is just noise. + + for n, char, font in nextchar, head do + -- local attr = (none and prevattr) or getattr(n,0) or 0 -- zero attribute is reserved for fonts in context + local attr = getattr(n) or 0 -- zero attribute is reserved for fonts in context + if font ~= prevfont or attr ~= prevattr then + prevfont = font + prevattr = attr + variants = fontvariants[font] + local fontmode = fontmodes[font] + if fontmode == "none" then + setnone(n) + elseif fontmode == "base" then + setbase(n) + else + setnode(n,font,attr) + end + elseif firstnone then + lastnone = n end - elseif firstnone then - lastnone = n - end - if variants then - if (char >= 0xFE00 and char <= 0xFE0F) or (char >= 0xE0100 and char <= 0xE01EF) then - local hash = variants[char] - if hash then - local p = getprev(n) - if p then - local char = ischar(p) -- checked - local variant = hash[char] - if variant then - if trace_variants then - report_fonts("replacing %C by %C",char,variant) - end - setchar(p,variant) - if redundant then - r = r + 1 - redundant[r] = n - else - r = 1 - redundant = { n } + if variants then + if (char >= 0xFE00 and char <= 0xFE0F) or (char >= 0xE0100 and char <= 0xE01EF) then + local hash = variants[char] + if hash then + local p = getprev(n) + if p then + local char = ischar(p) -- checked + local variant = hash[char] + if variant then + if trace_variants then + report_fonts("replacing %C by %C",char,variant) + end + setchar(p,variant) + if redundant then + r = r + 1 + redundant[r] = n + else + r = 1 + redundant = { n } + end end end + elseif keep_redundant then + -- go on, can be used for tracing + elseif redundant then + r = r + 1 + redundant[r] = n + else + r = 1 + redundant = { n } end - elseif keep_redundant then - -- go on, can be used for tracing - elseif redundant then - r = r + 1 - redundant[r] = n - else - r = 1 - redundant = { n } end end end - end - if firstnone then - protectnone() - end + if firstnone then + protectnone() + end - if force_boundaryrun then + if force_boundaryrun then - -- we can inject wordboundaries and then let the hyphenator do its work - -- but we need to get rid of those nodes in order to build ligatures - -- and kern (a rather context thing) + -- we can inject wordboundaries and then let the hyphenator do its work + -- but we need to get rid of those nodes in order to build ligatures + -- and kern (a rather context thing) - for b, subtype in nextboundary, head do - if subtype == word_boundary then - if redundant then - r = r + 1 - redundant[r] = b - else - r = 1 - redundant = { b } + for b, subtype in nextboundary, head do + if subtype == word_boundary then + if redundant then + r = r + 1 + redundant[r] = b + else + r = 1 + redundant = { b } + end end end - end - end + end - if redundant then - for i=1,r do - local r = redundant[i] - local p, n = getboth(r) - if r == head then - head = n - setprev(n) - else - setlink(p,n) - end - if b > 0 then - for i=1,b do - local bi = basefonts[i] - local b1 = bi[1] - local b2 = bi[2] - if b1 == b2 then - if b1 == r then - bi[1] = false - bi[2] = false + if redundant then + for i=1,r do + local r = redundant[i] + local p, n = getboth(r) + if r == head then + head = n + setprev(n) + else + setlink(p,n) + end + if b > 0 then + for i=1,b do + local bi = basefonts[i] + local b1 = bi[1] + local b2 = bi[2] + if b1 == b2 then + if b1 == r then + bi[1] = false + bi[2] = false + end + elseif b1 == r then + bi[1] = n + elseif b2 == r then + bi[2] = p end - elseif b1 == r then - bi[1] = n - elseif b2 == r then - bi[2] = p end end + flush_node(r) end - flush_node(r) end - end - if force_discrun then - - -- basefont is not supported in disc only runs ... it would mean a lot of - -- ranges .. we could try to run basemode as a separate processor run but - -- not for now (we can consider it when the new node code is tested - for d in nextdisc, head do - -- we could use first_glyph, only doing replace is good enough because - -- pre and post are normally used for hyphens and these come from fonts - -- that part of the hyphenated word - local _, _, r = getdisc(d) - if r then - local prevfont = nil - local prevattr = nil - local none = false - for n, char, font in nextchar, r do - local attr = getattr(n) or 0 -- zero attribute is reserved for fonts in context - if font ~= prevfont or attr ~= prevattr then - prevfont = font - prevattr = attr - local fontmode = fontmodes[font] - if fontmode == "none" then - setnone(n) - elseif fontmode == "base" then - setbase(n) - else - setnode(n,font,attr) + if force_discrun then + + -- basefont is not supported in disc only runs ... it would mean a lot of + -- ranges .. we could try to run basemode as a separate processor run but + -- not for now (we can consider it when the new node code is tested + for d in nextdisc, head do + -- we could use first_glyph, only doing replace is good enough because + -- pre and post are normally used for hyphens and these come from fonts + -- that part of the hyphenated word + local _, _, r = getdisc(d) + if r then + local prevfont = nil + local prevattr = nil + local none = false + for n, char, font in nextchar, r do + local attr = getattr(n) or 0 -- zero attribute is reserved for fonts in context + if font ~= prevfont or attr ~= prevattr then + prevfont = font + prevattr = attr + local fontmode = fontmodes[font] + if fontmode == "none" then + setnone(n) + elseif fontmode == "base" then + setbase(n) + else + setnode(n,font,attr) + end + elseif firstnone then + -- lastnone = n + lastnone = nil end - elseif firstnone then - -- lastnone = n - lastnone = nil + -- we assume one font for now (and if there are more and we get into issues then + -- we can always remove the break) + break end - -- we assume one font for now (and if there are more and we get into issues then - -- we can always remove the break) - break - end - if firstnone then - protectnone() + if firstnone then + protectnone() + end + -- elseif expanders then + -- local subtype = getsubtype(d) + -- if subtype == automatic_code or subtype == explicit_code then + -- expanders[subtype](d) + -- e = e + 1 + -- end end - -- elseif expanders then - -- local subtype = getsubtype(d) - -- if subtype == automatic_code or subtype == explicit_code then - -- expanders[subtype](d) - -- e = e + 1 - -- end end - end - - end - if trace_fontrun then - stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expanders) - end + end - -- in context we always have at least 2 processors - if u == 0 then - -- skip - elseif u == 1 then - local attr = a > 0 and 0 or false -- 0 is the savest way - for i=1,#lastproc do - head = lastproc[i](head,lastfont,attr,direction) + if trace_fontrun then + stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expanders) end - else - -- local attr = a == 0 and false or 0 -- 0 is the savest way - local attr = a > 0 and 0 or false -- 0 is the savest way - for font, processors in next, usedfonts do -- unordered - for i=1,#processors do - head = processors[i](head,font,attr,direction,u) + + -- in context we always have at least 2 processors + if u == 0 then + -- skip + elseif u == 1 then + local attr = a > 0 and 0 or false -- 0 is the savest way + for i=1,#lastproc do + head = lastproc[i](head,lastfont,attr,direction) end - end - end - if a == 0 then - -- skip - elseif a == 1 then - local font, dynamics = next(attrfonts) - for attribute, processors in next, dynamics do -- unordered, attr can switch in between - for i=1,#processors do - head = processors[i](head,font,attribute,direction) + else + -- local attr = a == 0 and false or 0 -- 0 is the savest way + local attr = a > 0 and 0 or false -- 0 is the savest way + for font, processors in next, usedfonts do -- unordered + for i=1,#processors do + head = processors[i](head,font,attr,direction,u) + end end end - else - for font, dynamics in next, attrfonts do + if a == 0 then + -- skip + elseif a == 1 then + local font, dynamics = next(attrfonts) for attribute, processors in next, dynamics do -- unordered, attr can switch in between for i=1,#processors do - head = processors[i](head,font,attribute,direction,a) + head = processors[i](head,font,attribute,direction) end end - end - end - if b == 0 then - -- skip - elseif b == 1 then - -- only one font - local range = basefonts[1] - local start = range[1] - local stop = range[2] - if (start or stop) and (start ~= stop) then - local front = head == start - if stop then - start = ligaturing(start,stop) - start = kerning(start,stop) - elseif start then -- safeguard - start = ligaturing(start) - start = kerning(start) - end - if front and head ~= start then - head = start + else + for font, dynamics in next, attrfonts do + for attribute, processors in next, dynamics do -- unordered, attr can switch in between + for i=1,#processors do + head = processors[i](head,font,attribute,direction,a) + end + end end end - else - -- multiple fonts - for i=1,b do - local range = basefonts[i] + if b == 0 then + -- skip + elseif b == 1 then + -- only one font + local range = basefonts[1] local start = range[1] local stop = range[2] - if start then -- and start ~= stop but that seldom happens + if (start or stop) and (start ~= stop) then local front = head == start - local prev = getprev(start) - local next = getnext(stop) if stop then - start, stop = ligaturing(start,stop) - start, stop = kerning(start,stop) - else + start = ligaturing(start,stop) + start = kerning(start,stop) + elseif start then -- safeguard start = ligaturing(start) start = kerning(start) end - -- is done automatically - if prev then - setlink(prev,start) - end - if next then - setlink(stop,next) - end - -- till here if front and head ~= start then head = start end end + else + -- multiple fonts + for i=1,b do + local range = basefonts[i] + local start = range[1] + local stop = range[2] + if start then -- and start ~= stop but that seldom happens + local front = head == start + local prev = getprev(start) + local next = getnext(stop) + if stop then + start, stop = ligaturing(start,stop) + start, stop = kerning(start,stop) + else + start = ligaturing(start) + start = kerning(start) + end + -- is done automatically + if prev then + setlink(prev,start) + end + if next then + setlink(stop,next) + end + -- till here + if front and head ~= start then + head = start + end + end + end end + + stoptiming(nodes) + + if trace_characters then + nodes.report(head) + end + + return head end - stoptiming(nodes) - if trace_characters then - nodes.report(head) - end - return head + end end - handlers.protectglyphs = protect_glyphs handlers.unprotectglyphs = unprotect_glyphs diff --git a/tex/context/base/mkiv/pack-rul.mkiv b/tex/context/base/mkiv/pack-rul.mkiv index 93527e787..86edf7ed1 100644 --- a/tex/context/base/mkiv/pack-rul.mkiv +++ b/tex/context/base/mkiv/pack-rul.mkiv @@ -487,7 +487,7 @@ \unexpanded\def\executedefinedoverlay#1#2% we can share the definitions {\bgroup % redundant grouping - \setbox\scratchbox\hbox\bgroup % \hpack ? + \setbox\scratchbox\hbox\bgroup \ifzeropt\d_framed_target_dp \the\everyoverlay#2% saves wrapping (and lua call) \else @@ -553,40 +553,36 @@ \def\pack_framed_process_background_indeed_internal#1% % : in name {\bgroup - \setbox\b_framed_extra\hbox{%\bgroup - \ifzeropt\framedbackgroundoffset - %\csname\??overlaybuiltin\m_framed_background\endcsname - #1 - \else + \setbox\b_framed_extra\hpack\bgroup + \ifzeropt\framedbackgroundoffset\else \kern-\framedbackgroundoffset - %\hbox{\csname\??overlaybuiltin\m_framed_background\endcsname}% - \hbox{#1}% \fi - }%\egroup + \hbox\bgroup#1\egroup + \egroup \wd\b_framed_extra\zeropoint \ht\b_framed_extra\framedbackgroundheight \dp\b_framed_extra\framedbackgrounddepth \box\b_framed_extra \egroup} -\def\pack_framed_process_background_indeed_external#1% +% \def\pack_framed_process_background_indeed_external#1% +% {\pack_framed_overlay_initialize +% \bgroup +% \setbox\b_framed_extra\hpack\bgroup +% \ifzeropt\framedbackgroundoffset\else +% \kern-\framedbackgroundoffset +% \fi +% \hbox\bgroup#1\egroup +% \egroup +% \wd\b_framed_extra\zeropoint +% \ht\b_framed_extra\framedbackgroundheight +% \dp\b_framed_extra\framedbackgrounddepth +% \box\b_framed_extra +% \egroup} + +\def\pack_framed_process_background_indeed_external {\pack_framed_overlay_initialize - \bgroup - \setbox\b_framed_extra\hbox{%\bgroup - \ifzeropt\framedbackgroundoffset - %\csname\??overlay\m_framed_background\endcsname - #1% - \else - \kern-\framedbackgroundoffset - %\hbox{\csname\??overlay\m_framed_background\endcsname}% - \hbox{#1}% - \fi - }%\egroup - \wd\b_framed_extra\zeropoint - \ht\b_framed_extra\framedbackgroundheight - \dp\b_framed_extra\framedbackgrounddepth - \box\b_framed_extra - \egroup} + \pack_framed_process_background_indeed_internal} \def\pack_framed_process_backgrounds#1,#2% #2 gobbles spaces (we could avoid one catch if we have nextbackground) {\edef\m_framed_background{#1}% @@ -726,18 +722,18 @@ \def\pack_framed_stroked_box_normal {\setbox\scratchbox\vpack \bgroup - \csname \??framedtop\p_framed_frame\framedparameter\c!topframe \endcsname + \csname\??framedtop\p_framed_frame\framedparameter\c!topframe\endcsname \nointerlineskip % new (needed for fences) \hpack \bgroup - \csname \??framedleft\p_framed_frame\framedparameter\c!leftframe \endcsname + \csname\??framedleft\p_framed_frame\framedparameter\c!leftframe\endcsname \novrule \s!width \d_framed_target_wd \s!height\d_framed_target_ht \s!depth \d_framed_target_dp - \csname \??framedright\p_framed_frame\framedparameter\c!rightframe \endcsname + \csname\??framedright\p_framed_frame\framedparameter\c!rightframe\endcsname \egroup \nointerlineskip % new (needed for fences) - \csname \??framedbottom\p_framed_frame\framedparameter\c!bottomframe\endcsname + \csname\??framedbottom\p_framed_frame\framedparameter\c!bottomframe\endcsname \egroup \wd\scratchbox\d_framed_target_wd \ht\scratchbox\d_framed_target_ht @@ -836,7 +832,7 @@ %D for passing this identifier between brackets lays in the mere fact that this way %D we can use the optional argument grabbers. -\def\defaultframeoffset{.25ex} +\def\defaultframeoffset{.25\exheight} \installcorenamespace{regularframedlevel} diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv index 071a270e1..1f0476e9b 100644 --- a/tex/context/base/mkiv/page-lay.mkiv +++ b/tex/context/base/mkiv/page-lay.mkiv @@ -1154,8 +1154,8 @@ \def\compensatedinnermakeupmargin {\dimexpr\ifconditional\innermakeupcompensation+\innermakeupmargin\else\zeropoint\fi\relax} -\unexpanded\def\freezetextwidth % name will change % \makeupwidth may be set to \textwidth - {\textwidth\makeupwidth % which is a tricky but valid value +\unexpanded\def\freezetextwidth % name will change % \makeupwidth may be set to \textwidth + {\textwidth\makeupwidth % which is a tricky but valid value \edef\m_currentlayout_text_width {\layoutparameter\c!textwidth }% \edef\m_currentlayout_text_margin{\layoutparameter\c!textmargin}% \ifx\m_currentlayout_text_width\empty \else diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex e95010141..84771a875 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 5e0c029e7..e89ba0959 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-blk.mkiv b/tex/context/base/mkiv/strc-blk.mkiv index 724f7816c..f0df6dda8 100644 --- a/tex/context/base/mkiv/strc-blk.mkiv +++ b/tex/context/base/mkiv/strc-blk.mkiv @@ -52,6 +52,8 @@ % We need to prevent too much lookahead which will gobble newlines % that are needed for buffers. See blocks-002.tex as example. +% maybe: systemmode "block:<name>" + \let\m_block \empty \let\m_subblock\empty @@ -78,33 +80,67 @@ \let\strc_blocks_setup\relax +\newconstant \c_strc_blocks_index +\newconditional\c_strc_blocks_display + \unexpanded\def\dostarthiddenblock % called at lua end - {\startnointerference - \dostartnormalblock} + {\begingroup + \visiblefalse % blocks float + \startnointerference + \strc_start_block} \unexpanded\def\dostophiddenblock % called at lua end - {\dostopnormalblock - \stopnointerference} - -\newconstant\c_strc_blocks_index + {\strc_stop_block + \stopnointerference + \endgroup} -\unexpanded\def\dostartnormalblock#1#2% called at lua end +\unexpanded\def\dostartnormalblock % called at lua end {\begingroup - \visibletrue % will change - \edef\currentblock{#2}% + \visibletrue + \strc_start_block} + +\unexpanded\def\dostopnormalblock % called at lua end + {\strc_stop_block + \endgroup} + +\def\strc_start_block#1#2% + {\edef\currentblock{#2}% \c_strc_blocks_index#1\relax \strc_blocks_setup \let\strc_blocks_setup\relax - \blockparameter\c!before - \useblockstyleandcolor\c!style\c!color % maybe moev one line up (font spacing) - \blockparameter\c!inner % better \c!setups + \edef\p_alternative{\blockparameter\c!alternative}% + \ifx\p_alternative\v!text + \setfalse\c_strc_blocks_display + \else + \settrue\c_strc_blocks_display + \fi + \ifconditional\c_strc_blocks_display + \blockparameter\c!before + \fi + \begingroup + \usesetupsparameter\blockparameter\relax + \dostarttagged\t!block\currentblock + \useblockstyleandcolor\c!style\c!color + \blockparameter\c!inner % old + \ifconditional\c_strc_blocks_display + \usealignparameter\blockparameter + \else + \blockparameter\c!left + \fi \ignorespaces} -\unexpanded\def\dostopnormalblock % called at lua end +\def\strc_stop_block {\removeunwantedspaces - \blockparameter\c!after - \par % todo: alternative = text, paragraph - \endgroup} + \ifconditional\c_strc_blocks_display + \par + \else + \blockparameter\c!right + \fi + \dostoptagged + \endgroup + \ifconditional\c_strc_blocks_display + \blockparameter\c!after + \fi} \def\strc_blocks_set_state[#1][#2][#3]% state name tag {\clf_setstructureblockstate{#1}{#2}{#3}} diff --git a/tex/context/base/mkiv/strc-lst.mkvi b/tex/context/base/mkiv/strc-lst.mkvi index 5f6512b82..ae9e0c042 100644 --- a/tex/context/base/mkiv/strc-lst.mkvi +++ b/tex/context/base/mkiv/strc-lst.mkvi @@ -212,7 +212,7 @@ \def\strc_lists_write_data_to[#tag]% {\begingroup \edef\currentlist{#tag}% - \doifelse{\namedlistparameter{#tag}\c!state}\v!start + \ {\namedlistparameter{#tag}\c!state}\v!start \strc_lists_write_data_to_yes \strc_lists_write_data_to_nop} diff --git a/tex/context/base/mkiv/strc-pag.mkiv b/tex/context/base/mkiv/strc-pag.mkiv index d56f0de54..e25b47f12 100644 --- a/tex/context/base/mkiv/strc-pag.mkiv +++ b/tex/context/base/mkiv/strc-pag.mkiv @@ -309,6 +309,8 @@ % some day ifsinglesided and ifdoublesided will become obsolete +\newtoks\everysidedswitch + \appendtoks \singlesidedfalse \setfalse\layoutisdoublesided \doublesidedfalse \setfalse\layoutissinglesided @@ -317,13 +319,7 @@ \processallactionsinset[\directpagenumberingparameter\c!alternative] [ \v!singlesided=>\setsystemmode\v!singlesided\singlesidedtrue\settrue\layoutissinglesided, \v!doublesided=>\setsystemmode\v!doublesided\doublesidedtrue\settrue\layoutisdoublesided]% - \ifdefined\trackingmarginnotestrue - \ifdoublesided - \trackingmarginnotestrue - \else - \trackingmarginnotesfalse - \fi - \fi + \the\everysidedswitch \pageduplexmode \ifsinglesided \ifdoublesided\plustwo\else\zerocount\fi @@ -334,6 +330,16 @@ \strc_pagenumbers_set_location \to \everysetuppagenumbering +\appendtoks + \ifdefined\trackingmarginnotestrue + \ifdoublesided + \trackingmarginnotestrue + \else + \trackingmarginnotesfalse + \fi + \fi +\to \everysidedswitch + \ifdefined \page_backgrounds_recalculate \else \let\page_backgrounds_recalculate\relax \fi @@ -401,11 +407,10 @@ \unexpanded\def\strc_pagenumbers_check_state_change#1#2% {\edef\m_strc_pagenumbers_state_new{\namedcounterparameter#1\c!state}% \ifx\m_strc_pagenumbers_state_new\m_strc_pagenumbers_state_old \else - \doifelse\m_strc_pagenumbers_state_new\v!start - {#2\plustwo}% - {#2\zerocount}% + #2\ifx\m_strc_pagenumbers_state_new\v!start\plustwo\else\zerocount\fi \fi} + \appendtoks % todo: set state: none, start, stop, reset \strc_pagenumbers_check_state_change\s!realpage\c_strc_pagenumbers_state_realpage \to \everysetuprealpagenumber diff --git a/tex/context/base/mkiv/strc-tag.lua b/tex/context/base/mkiv/strc-tag.lua index eca886f3a..1a3ee27b4 100644 --- a/tex/context/base/mkiv/strc-tag.lua +++ b/tex/context/base/mkiv/strc-tag.lua @@ -212,6 +212,9 @@ local properties = allocate { -- todo: more "record = true" to improve forma publications = { pdf = "Div", nature = "display" }, publication = { pdf = "Div", nature = "mixed" }, pubfld = { pdf = "Span", nature = "inline" }, + + block = { pdf = "Div", nature = "display" }, + } tags.properties = properties diff --git a/tex/context/base/mkiv/strc-tag.mkiv b/tex/context/base/mkiv/strc-tag.mkiv index bcb8be304..0ff5aec48 100644 --- a/tex/context/base/mkiv/strc-tag.mkiv +++ b/tex/context/base/mkiv/strc-tag.mkiv @@ -169,6 +169,8 @@ \def\t!publication {publication} % Span \def\t!pubfld {pubfld} % Span +\def\t!block {block} % Div + % \setuptaglabeltext % [en] % [\t!document=document] diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 8a49d3769..49b2ba288 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -8196,3 +8196,23 @@ % \edef\tempstring{\the#1}% % \tx\ttbf\string#1: \tttf\meaning\tempstring % \endgroup} + +%D Not needed now, but more efficient that expanding +% +% \chardef\_E_O_T_0 +% +% \unexpanded\def\doifelsetokens#1% +% {\dodoifelsetokens#1\_E_O_T_\_e_o_t_} +% +% \def\dodoifelsetokens#1#2\_e_o_t_ +% {\ifx#1\_E_O_T_ +% \expandafter\secondoftwoarguments +% \else +% \expandafter\firstoftwoarguments +% \fi} +% +% \def\emptytokscondition#1% +% {\doemptytokscondition#1\_E_O_T_\_e_o_t_} +% +% \def\doemptytokscondition#1#2\_e_o_t_ +% {\ifx#1\_E_O_T_} diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 1df8eee8b..606cd6c16 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -1446,9 +1446,31 @@ <cd:parameter name="after"> <cd:constant type="cd:command"/> </cd:parameter> + <cd:parameter name="left"> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="right"> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="alternative"> + <cd:constant default="yes" type="paragraph"/> + <cd:constant type="text"/> + </cd:parameter> <cd:parameter name="inner"> <cd:constant type="cd:command"/> </cd:parameter> + <cd:parameter name="setups"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="align"> + <cd:constant type="left"/> + <cd:constant type="right"/> + <cd:constant type="middle"/> + <cd:constant type="flushleft"/> + <cd:constant type="flushright"/> + <cd:constant type="inner"/> + <cd:constant type="outer"/> + </cd:parameter> <cd:parameter name="style"> <cd:constant type="cd:style"/> <cd:constant type="cd:command"/> diff --git a/tex/context/interface/mkiv/i-block.xml b/tex/context/interface/mkiv/i-block.xml index fa5262506..0bd0ef51b 100644 --- a/tex/context/interface/mkiv/i-block.xml +++ b/tex/context/interface/mkiv/i-block.xml @@ -24,9 +24,25 @@ <cd:parameter name="after"> <cd:constant type="cd:command"/> </cd:parameter> + <cd:parameter name="left"> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="right"> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="alternative"> + <cd:constant type="paragraph" default="yes"/> + <cd:constant type="text"/> + </cd:parameter> <cd:parameter name="inner"> <cd:constant type="cd:command"/> </cd:parameter> + <cd:parameter name="setups"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="align"> + <cd:resolve name="value-alignsimple"/> + </cd:parameter> <cd:parameter name="style"> <cd:resolve name="value-style"/> </cd:parameter> @@ -103,4 +119,4 @@ </cd:arguments> </cd:command> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/context/interface/mkiv/i-common-argument.xml b/tex/context/interface/mkiv/i-common-argument.xml index de000148b..787475e8b 100644 --- a/tex/context/interface/mkiv/i-common-argument.xml +++ b/tex/context/interface/mkiv/i-common-argument.xml @@ -532,4 +532,4 @@ </cd:keywords> </cd:define> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 28123182c..dc007cc91 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 4bd42a9cd..915c8f545 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/interface/mkiv/i-startstop.xml b/tex/context/interface/mkiv/i-startstop.xml index ba0abb0b7..3df32a516 100644 --- a/tex/context/interface/mkiv/i-startstop.xml +++ b/tex/context/interface/mkiv/i-startstop.xml @@ -97,4 +97,4 @@ </cd:arguments> </cd:command> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 4336f8a25..e7ce88bfd 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 : 08/14/18 23:10:05 +-- merge date : 08/15/18 18:45:58 do -- begin closure to overcome local limits and interference |