diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-01-03 20:16:56 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-01-03 20:16:56 +0100 |
commit | b04dda4c73d0f71e78f1fd4979ef04c7e9a669ed (patch) | |
tree | 4a53c427af3bca27aa5dc47f4c06ee71fb2e8508 /tex | |
parent | b28de538b3b4dc7acda5eb9eefc7a7d68c8fb49f (diff) | |
download | context-b04dda4c73d0f71e78f1fd4979ef04c7e9a669ed.tar.gz |
2019-01-03 19:35:00
Diffstat (limited to 'tex')
35 files changed, 307 insertions, 224 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 3ad3147ce..603be7c3b 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.12.30 19:28} +\newcontextversion{2019.01.03 19:27} %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 eb7d5d402..228265904 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.12.30 19:28} +\edef\contextversion{2019.01.03 19:27} %D For those who want to use this: diff --git a/tex/context/base/mkiv/anch-pgr.mkiv b/tex/context/base/mkiv/anch-pgr.mkiv index 5300a9a9c..7fa378cd1 100644 --- a/tex/context/base/mkiv/anch-pgr.mkiv +++ b/tex/context/base/mkiv/anch-pgr.mkiv @@ -157,7 +157,7 @@ \endgroup} \def\anch_positions_place_anchors_nop - {\vskip\textheight} + {\vkern\textheight} %D \macros %D {positionoverlay,startpositionoverlay} diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 71e2b89f8..24b7b11df 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -2898,7 +2898,6 @@ local collectresults do -- too many locals otherwise local getnext = nuts.getnext local getdisc = nuts.getdisc - ----- getcomponents = nuts.getcomponents local getlist = nuts.getlist local getid = nuts.getid local getattr = nuts.getattr @@ -2960,103 +2959,92 @@ local collectresults do -- too many locals otherwise -- -- report_export("skipping character: %C (no attribute)",n.char) else - -- we could add tonunicodes for ligatures (todo) - -- local components = getcomponents(n) - -- if components and (not characterdata[c] or overloads[c]) then -- we loose data - -- collectresults(components,nil,at) -- this assumes that components have the same attribute as the glyph ... we should be more tolerant (see math) - -- else - if last ~= at then - local tl = taglist[at] - local ap = getattr(n,a_taggedpar) or pap - if localparagraph and (not ap or ap < localparagraph) then - maybewrong = addtomaybe(maybewrong,c,1) - end - pushcontent() - currentnesting = tl - currentparagraph = ap - currentattribute = at - last = at + if last ~= at then + local tl = taglist[at] + local ap = getattr(n,a_taggedpar) or pap + if localparagraph and (not ap or ap < localparagraph) then + maybewrong = addtomaybe(maybewrong,c,1) + end + pushcontent() + currentnesting = tl + currentparagraph = ap + currentattribute = at + last = at + pushentry(currentnesting) + if trace_export then + report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,at) + end + -- We need to intercept this here; maybe I will also move this + -- to a regular setter at the tex end. + local r = getattr(n,a_reference) + if r then + local t = tl.taglist + referencehash[t[#t]] = r -- fulltag + end + local d = getattr(n,a_destination) + if d then + local t = tl.taglist + destinationhash[t[#t]] = d -- fulltag + end + -- + elseif last then + -- we can consider tagging the pars (lines) in the parbuilder but then we loose some + -- information unless we inject a special node (but even then we can run into nesting + -- issues) + local ap = getattr(n,a_taggedpar) or pap + if ap ~= currentparagraph then + pushcontent(currentparagraph,ap) pushentry(currentnesting) - if trace_export then - report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,at) - end - -- We need to intercept this here; maybe I will also move this - -- to a regular setter at the tex end. - local r = getattr(n,a_reference) - if r then - local t = tl.taglist - referencehash[t[#t]] = r -- fulltag - end - local d = getattr(n,a_destination) - if d then - local t = tl.taglist - destinationhash[t[#t]] = d -- fulltag - end - -- - elseif last then - -- we can consider tagging the pars (lines) in the parbuilder but then we loose some - -- information unless we inject a special node (but even then we can run into nesting - -- issues) - local ap = getattr(n,a_taggedpar) or pap - if ap ~= currentparagraph then - pushcontent(currentparagraph,ap) - pushentry(currentnesting) - currentattribute = last - currentparagraph = ap - end - if localparagraph and (not ap or ap < localparagraph) then - maybewrong = addtomaybe(maybewrong,c,2) - end - if trace_export then - report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,last) - end - else - if trace_export then - report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,at) - end + currentattribute = last + currentparagraph = ap end - local s = getattr(n,a_exportstatus) - if s then - c = s + if localparagraph and (not ap or ap < localparagraph) then + maybewrong = addtomaybe(maybewrong,c,2) end - if c == 0 then + if trace_export then + report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,last) + end + else + if trace_export then + report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,at) + end + end + local s = getattr(n,a_exportstatus) + if s then + c = s + end + if c == 0 then + if trace_export then + report_export("%w<!-- skipping last glyph -->",currentdepth) + end + elseif c == 0x20 then + local a = getattr(n,a_characters) + nofcurrentcontent = nofcurrentcontent + 1 + if a then if trace_export then - report_export("%w<!-- skipping last glyph -->",currentdepth) - end - elseif c == 0x20 then - local a = getattr(n,a_characters) - nofcurrentcontent = nofcurrentcontent + 1 - if a then - if trace_export then - report_export("%w<!-- turning last space into special space %U -->",currentdepth,a) - end - currentcontent[nofcurrentcontent] = specialspaces[a] -- special space - else - currentcontent[nofcurrentcontent] = " " + report_export("%w<!-- turning last space into special space %U -->",currentdepth,a) end + currentcontent[nofcurrentcontent] = specialspaces[a] -- special space else - local fc = fontchar[f] + currentcontent[nofcurrentcontent] = " " + end + else + local fc = fontchar[f] + if fc then + fc = fc and fc[c] if fc then - fc = fc and fc[c] - if fc then - local u = fc.unicode - if not u then - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = utfchar(c) - elseif type(u) == "table" then - for i=1,#u do - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = utfchar(u[i]) - end - else - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = utfchar(u) - end - elseif c > 0 then + local u = fc.unicode + if not u then nofcurrentcontent = nofcurrentcontent + 1 currentcontent[nofcurrentcontent] = utfchar(c) + elseif type(u) == "table" then + for i=1,#u do + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = utfchar(u[i]) + end else - -- we can have -1 as side effect of an explicit hyphen (unless we expand) + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = utfchar(u) end elseif c > 0 then nofcurrentcontent = nofcurrentcontent + 1 @@ -3064,8 +3052,13 @@ local collectresults do -- too many locals otherwise else -- we can have -1 as side effect of an explicit hyphen (unless we expand) end + elseif c > 0 then + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = utfchar(c) + else + -- we can have -1 as side effect of an explicit hyphen (unless we expand) end - -- end + end end elseif id == disc_code then -- probably too late local pre, post, replace = getdisc(n) diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 0a456e591..cf4113e3d 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.12.30 19:28} +\newcontextversion{2019.01.03 19:27} %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 a8a81ecef..4ec1d9d56 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.12.30 19:28} +\edef\contextversion{2019.01.03 19:27} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-nod.lua b/tex/context/base/mkiv/font-nod.lua index 33bd6408b..561714601 100644 --- a/tex/context/base/mkiv/font-nod.lua +++ b/tex/context/base/mkiv/font-nod.lua @@ -65,7 +65,6 @@ local getsubtype = nuts.getsubtype local getchar = nuts.getchar local getlist = nuts.getlist local getdisc = nuts.getdisc ------ getcomponents = nuts.getcomponents local isglyph = nuts.isglyph local getkern = nuts.getkern local getdirection = nuts.getdirection @@ -81,7 +80,7 @@ local flush_node_list = nuts.flush_list local protect_glyphs = nuts.protect_glyphs local nextnode = nuts.traversers.node -local nextglyph = nuts.traversers.glyph +----- nextglyph = nuts.traversers.glyph local nodepool = nuts.pool local new_glyph = nodepool.glyph @@ -501,10 +500,7 @@ local function toutf(list,result,nofresult,stopcriterium,nostrip) for n, id in nextnode, tonut(list) do if id == glyph_code then local c = getchar(n) - -- local components = getcomponents(n) - -- if components then - -- result, nofresult = toutf(components,result,nofresult,false,true) - -- elseif c > 0 then + if c > 0 then local fc = fontcharacters[getfont(n)] if fc then local fcc = fc[c] @@ -530,10 +526,10 @@ local function toutf(list,result,nofresult,stopcriterium,nostrip) nofresult = nofresult + 1 result[nofresult] = f_unicode(c) end - -- else - -- nofresult = nofresult + 1 - -- result[nofresult] = f_badcode(c) - -- end + else + nofresult = nofresult + 1 + result[nofresult] = f_badcode(c) + end elseif id == disc_code then result, nofresult = toutf(getfield(n,"replace"),result,nofresult,false,true) -- needed? elseif id == hlist_code or id == vlist_code then diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 5c64ab8e5..ae54c390e 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -203,6 +203,7 @@ local getdir = nuts.getdir local getwidth = nuts.getwidth local ischar = nuts.is_char +local isglyph = nuts.isglyph local usesfont = nuts.uses_font local insert_node_after = nuts.insert_after @@ -457,28 +458,6 @@ local copy_only_glyphs = nuts.copy_only_glyphs local set_components = setcomponents local take_components = getcomponents -local isglyph = nuts.isglyph - --- local function count_components(start,marks) --- print("!") --- if getid(start) ~= glyph_code then --- return 0 --- elseif getsubtype(start) == ligatureglyph_code then --- local i = 0 --- local components = getcomponents(start) --- while components do --- i = i + count_components(components,marks) --- components = getnext(components) --- end --- return i --- elseif not marks[getchar(start)] then --- print("YES") --- return 1 --- else --- return 0 --- end --- end - local function count_components(start,marks) local char = isglyph(start) if char then diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv index ea5974d1f..15152e994 100644 --- a/tex/context/base/mkiv/grph-inc.mkiv +++ b/tex/context/base/mkiv/grph-inc.mkiv @@ -656,46 +656,47 @@ \unexpanded\def\docheckfiguremps #1{\global\setbox\foundexternalfigure\vpack{\convertMPtoPDF{#1}11}} \unexpanded\def\docheckfiguremprun #1#2{\global\setbox\foundexternalfigure\vpack{\useMPrun{#1}{#2}}} -\unexpanded\def\relocateexternalfigure % easier here than in lua - {\global\setbox\foundexternalfigure\vpack to \ht\foundexternalfigure\bgroup - \vss - \ht\foundexternalfigure\zeropoint - \hpack to \wd\foundexternalfigure\bgroup - \box\foundexternalfigure - \hss - \egroup - \egroup} - -% \unexpanded\def\relocateexternalfigure +% \unexpanded\def\relocateexternalfigure % easier here than in lua % {\global\setbox\foundexternalfigure\vpack to \ht\foundexternalfigure\bgroup -% % -% % The \vss can (!) introduce 1 sp excess visible in xform which in itself -% % is not that important but some don't like these cosmetic side effects, for -% % instance we can get: -% % -% % vss : \vbox(845.1575+0.0)x597.23125, glue set 845.15747fil, direction TLT -% % vskip : \vbox(845.1575+0.0)x597.23125, direction TLT -% % -% % or -% % -% % 1 0 0 1 0 0.00003 cm -% % 1 0 0 1 0 0 cm -% % -% % This is a known property of using glue and can even depend on the architecture -% % (float implementation). Anyway, let's for now use a skip. Of course this can -% % shift the issue elsewhere, as vss is used a lot elsewhere. -% % -% % \vss -% \vskip\ht\foundexternalfigure -% % +% \vss % \ht\foundexternalfigure\zeropoint -% \dp\foundexternalfigure\zeropoint % \hpack to \wd\foundexternalfigure\bgroup % \box\foundexternalfigure % \hss % \egroup % \egroup} +\unexpanded\def\relocateexternalfigure + {\global\setbox\foundexternalfigure\vpack to \ht\foundexternalfigure\bgroup + % + % The \vss can (!) introduce 1 sp excess visible in xform which in itself + % is not that important but some don't like these cosmetic side effects, for + % instance we can get: + % + % vss : \vbox(845.1575+0.0)x597.23125, glue set 845.15747fil, direction TLT + % vskip : \vbox(845.1575+0.0)x597.23125, direction TLT + % + % or + % + % 1 0 0 1 0 0.00003 cm + % 1 0 0 1 0 0 cm + % + % This is a known property of using glue and can even depend on the architecture + % (float implementation). Anyway, let's for now use a skip. Of course this can + % shift the issue elsewhere, as vss is used a lot elsewhere. + % + % \vss + \vkern\ht\foundexternalfigure + % + % \parfillskip\zeropoint + \ht\foundexternalfigure\zeropoint + \dp\foundexternalfigure\zeropoint + \hpack to \wd\foundexternalfigure\bgroup + \box\foundexternalfigure + \hss + \egroup + \egroup} + \unexpanded\def\startfoundexternalfigure#1#2% ht wd {\global\setbox\foundexternalfigure\vbox to #2\bgroup\vss\hbox to #1\bgroup} diff --git a/tex/context/base/mkiv/grph-trf.mkiv b/tex/context/base/mkiv/grph-trf.mkiv index 7b4b69b60..35e812b3e 100644 --- a/tex/context/base/mkiv/grph-trf.mkiv +++ b/tex/context/base/mkiv/grph-trf.mkiv @@ -164,11 +164,38 @@ \box\nextbox \egroup} +% \def\grph_scale_apply +% {\d_grph_scale_wd\finalscaleboxxscale\d_grph_scale_wd +% \d_grph_scale_ht\finalscaleboxyscale\d_grph_scale_ht +% \d_grph_scale_dp\finalscaleboxyscale\d_grph_scale_dp +% \setbox\nextbox\hpack +% {\dostartscaling \finalscaleboxxscale \finalscaleboxyscale +% \smashedbox\nextbox +% \dostopscaling}% +% \wd\nextbox\d_grph_scale_wd +% \ht\nextbox\d_grph_scale_ht +% \dp\nextbox\d_grph_scale_dp} + \def\grph_scale_apply {\d_grph_scale_wd\finalscaleboxxscale\d_grph_scale_wd \d_grph_scale_ht\finalscaleboxyscale\d_grph_scale_ht \d_grph_scale_dp\finalscaleboxyscale\d_grph_scale_dp - \setbox\nextbox\hpack + \ifdim\d_grph_scale_wd=\wd\nextbox + \ifdim\d_grph_scale_ht=\ht\nextbox + \ifdim\d_grph_scale_dp=\dp\nextbox + % \grph_scale_apply_nop + \else + \grph_scale_apply_yes + \fi + \else + \grph_scale_apply_yes + \fi + \else + \grph_scale_apply_yes + \fi} + +\def\grph_scale_apply_yes + {\setbox\nextbox\hpack {\dostartscaling \finalscaleboxxscale \finalscaleboxyscale \smashedbox\nextbox \dostopscaling}% diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua index 1684c0dac..92b400d4f 100644 --- a/tex/context/base/mkiv/lang-hyp.lua +++ b/tex/context/base/mkiv/lang-hyp.lua @@ -1611,16 +1611,23 @@ featureset.hyphenonly = hyphenonly == v_yes -- local replaceaction = nodes.tasks.replaceaction -- no longer overload this way (too many local switches) local hyphenate = lang.hyphenate - local has_language = lang.has_language + local hyphenating = nuts.hyphenating local methods = { } local usedmethod = false local stack = { } - local function original(head) -- kernel.hyphenation(head) - hyphenate(tonode(head)) - return head - end + local original = hyphenating and + function(head) + return (hyphenating(head)) + end + or + function(head) + hyphenate(tonode(head)) + return head -- a nut + end + -- local has_language = lang.has_language + -- -- local function original(head) -- kernel.hyphenation(head) -- local h = tonode(head) -- if has_language(h) then diff --git a/tex/context/base/mkiv/math-tag.lua b/tex/context/base/mkiv/math-tag.lua index 72de3e660..07998eb08 100644 --- a/tex/context/base/mkiv/math-tag.lua +++ b/tex/context/base/mkiv/math-tag.lua @@ -338,25 +338,25 @@ process = function(start) -- we cannot use the processor as we have no finalizer else setattr(n,a_tagged,text) end - if id == hlist_code or id == vlist_code then runner(getlist(n),depth+1) elseif id == glyph_code then - -- this should not be needed (todo: use tounicode info) - local components = getcomponents(n) + -- this should not be needed + local components = getcomponents(n) -- unlikely set if components then runner(getcomponent,depth+1) end elseif id == disc_code then + -- this should not be needed local pre, post, replace = getdisc(n) if pre then - runner(pre,depth+1) -- idem + runner(pre,depth+1) end if post then - runner(post,depth+1) -- idem + runner(post,depth+1) end if replace then - runner(replace,depth+1) -- idem + runner(replace,depth+1) end end if mth == 1 then diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua index c155d7733..8074a6a4a 100644 --- a/tex/context/base/mkiv/mlib-lua.lua +++ b/tex/context/base/mkiv/mlib-lua.lua @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['mlib-lua'] = { -- maybe we need mplib.model, but how with instances -local type, tostring, select, loadstring = type, tostring, select, loadstring +local type, tostring, tonumber, select, loadstring = type, tostring, tonumber, select, loadstring local find, match, gsub, gmatch = string.find, string.match, string.gsub, string.gmatch local concat, insert, remove = table.concat, table.insert, table.remove @@ -863,6 +863,21 @@ end do + local mppair = mp.pair + + function mp.textextanchor(s) + local x, y = match(s,"tx_anchor=(%S+) (%S+)") -- todo: make an lpeg + if x and y then + x = tonumber(x) + y = tonumber(y) + end + mppair(x or 0,y or 0) + end + +end + +do + local mprint = mp.print local qprint = mp.quoted local getmacro = tokens.getters.macro diff --git a/tex/context/base/mkiv/mult-fun.lua b/tex/context/base/mkiv/mult-fun.lua index 8464e30ca..0776f36b4 100644 --- a/tex/context/base/mkiv/mult-fun.lua +++ b/tex/context/base/mkiv/mult-fun.lua @@ -3,7 +3,7 @@ return { -- "nocolormodel", "greycolormodel", "graycolormodel", "rgbcolormodel", "cmykcolormodel", "shadefactor", - "textextoffset", + "textextoffset", "textextanchor", "normaltransparent", "multiplytransparent", "screentransparent", "overlaytransparent", "softlighttransparent", "hardlighttransparent", "colordodgetransparent", "colorburntransparent", "darkentransparent", "lightentransparent", "differencetransparent", "exclusiontransparent", @@ -170,5 +170,7 @@ return { "isarray", "prefix", "isobject", -- "comment", "report", "lua", "mp", "MP", "luacall", + -- + "mirrored", "mirroredabout", }, } diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index 6cdbc61d7..b62ee35e6 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -225,6 +225,8 @@ return { "scratchtoks", "globalscratchtoks", "privatescratchtoks", "scratchbox", "globalscratchbox", "privatescratchbox", -- + "globalscratchcounterone", "globalscratchcountertwo", "globalscratchcounterthree", + -- "groupedcommand", "groupedcommandcs", "triggergroupedcommand", "triggergroupedcommandcs", "simplegroupedcommand", "pickupgroupedcommand", diff --git a/tex/context/base/mkiv/node-met.lua b/tex/context/base/mkiv/node-met.lua index 5c6a24c65..f5db4babd 100644 --- a/tex/context/base/mkiv/node-met.lua +++ b/tex/context/base/mkiv/node-met.lua @@ -125,6 +125,7 @@ nodes.unprotect_glyph = node.unprotect_glyph nodes.unprotect_glyphs = node.unprotect_glyphs nodes.kerning = node.kerning nodes.ligaturing = node.ligaturing +nodes.hyphenating = node.hyphenating nodes.mlist_to_hlist = node.mlist_to_hlist nodes.effective_glue = node.effective_glue diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua index 54de799da..d65645f8c 100644 --- a/tex/context/base/mkiv/node-nut.lua +++ b/tex/context/base/mkiv/node-nut.lua @@ -173,12 +173,14 @@ nuts.is_direct = direct.is_direct nuts.is_node = direct.is_node nuts.is_nut = direct.is_direct nuts.kerning = direct.kerning +nuts.hyphenating = direct.hyphenating nuts.last_node = direct.last_node nuts.length = direct.length nuts.ligaturing = direct.ligaturing nuts.new = direct.new nuts.protect_glyph = direct.protect_glyph nuts.protect_glyphs = direct.protect_glyphs +nuts.flush_components = direct.flush_components nuts.protrusion_skippable = direct.protrusion_skippable nuts.rangedimensions = direct.rangedimensions nuts.set_attribute = direct.set_attribute diff --git a/tex/context/base/mkiv/node-tex.lua b/tex/context/base/mkiv/node-tex.lua index 81ed80d15..5857fd2e6 100644 --- a/tex/context/base/mkiv/node-tex.lua +++ b/tex/context/base/mkiv/node-tex.lua @@ -6,35 +6,40 @@ if not modules then modules = { } end modules ['node-tex'] = { license = "see context related readme files" } -builders = builders or { } -local kernel = builders.kernel or { } -builders.kernel = kernel +builders = builders or { } +local kernel = builders.kernel or { } +builders.kernel = kernel -local nuts = nodes.nuts +local nuts = nodes.nuts -local hyphenate = lang.hyphenate -local ligaturing = nuts.ligaturing -local kerning = nuts.kerning - -kernel.originals = { - hyphenate = hyphenate, - ligaturing = ligaturing, - kerning = kerning, -} +local hyphenate = lang.hyphenate +local hyphenating = nuts.hyphenating +local ligaturing = nuts.ligaturing +local kerning = nuts.kerning +local cleanup = nuts.flush_components function kernel.hyphenation(head) - hyphenate(head) - return head + return (hyphenate(head)) -- nodes ! +end + +function kernel.hyphenating(head) + return (hyphenating(head)) end function kernel.ligaturing(head) - local head, tail = ligaturing(head) - return head + return (ligaturing(head)) end function kernel.kerning(head) - local head, tail = kerning(head) - return head + return (kerning(head)) +end + +if cleanup then + + function kernel.cleanup(head) + return (cleanup(head)) + end + end callbacks.register('hyphenate' , false, "normal hyphenation routine, called elsewhere") diff --git a/tex/context/base/mkiv/page-box.mkvi b/tex/context/base/mkiv/page-box.mkvi index 6da75b781..10d591631 100644 --- a/tex/context/base/mkiv/page-box.mkvi +++ b/tex/context/base/mkiv/page-box.mkvi @@ -251,11 +251,25 @@ \def\page_boxes_apply_offsets#1% {\setbox#1\vpack to \paperheight {\hsize\paperwidth - \vskip\topspace - \hskip\doifbothsides\backspace\backspace{\dimexpr\paperwidth-\backspace-\makeupwidth\relax}% + \vkern\topspace +% \parfillskip\zeropoint + \hkern\doifbothsides\backspace\backspace{\dimexpr\paperwidth-\backspace-\makeupwidth\relax}% \box#1}% \dp#1\zeropoint} +% \def\page_boxes_apply_offset#box% +% {\scratchwidth \wd#box% +% \scratchheight\ht#box% +% \scratchdepth \dp#box% +% \setbox#box\vpack +% {\offinterlineskip +% \vkern\topoffset +% \hkern\doifbothsides\backoffset\backoffset{-\backoffset}% +% \box#box}% +% \wd#box\scratchwidth +% \ht#box\scratchheight +% \dp#box\scratchdepth} + % \let\page_boxes_apply_clip_paper \gobbleoneargument % \let\page_boxes_apply_clip_print_left \gobbleoneargument % \let\page_boxes_apply_clip_print_right\gobbleoneargument diff --git a/tex/context/base/mkiv/page-ffl.mkiv b/tex/context/base/mkiv/page-ffl.mkiv index e94bffa64..414cae4ac 100644 --- a/tex/context/base/mkiv/page-ffl.mkiv +++ b/tex/context/base/mkiv/page-ffl.mkiv @@ -101,7 +101,7 @@ \fi \fi \directboxfromcache{\currentfacingfloat}{\number\c_strc_floats_flushed}% - \vskip\s_page_one_between_top_insert + \vkern\s_page_one_between_top_insert \egroup \ifnum\c_strc_floats_saved=\c_strc_floats_flushed \global\c_strc_floats_saved \zerocount diff --git a/tex/context/base/mkiv/page-imp.mkiv b/tex/context/base/mkiv/page-imp.mkiv index 359c120b0..7791d2b9a 100644 --- a/tex/context/base/mkiv/page-imp.mkiv +++ b/tex/context/base/mkiv/page-imp.mkiv @@ -190,8 +190,8 @@ \fi \setbox\shipoutscratchbox\vpack {\offinterlineskip - \vskip\d_page_shipouts_offset - \hskip\d_page_shipouts_offset + \vkern\d_page_shipouts_offset + \hkern\d_page_shipouts_offset \hpack {\page_otr_flush_every_stuff \page_otr_flush_special_content diff --git a/tex/context/base/mkiv/page-inf.mkiv b/tex/context/base/mkiv/page-inf.mkiv index d6a7635f9..4519083bf 100644 --- a/tex/context/base/mkiv/page-inf.mkiv +++ b/tex/context/base/mkiv/page-inf.mkiv @@ -112,12 +112,12 @@ {\vfill \settexthoffset \hsize\dimexpr\scratchdimen-2\texthoffset\relax - \hskip\texthoffset % brrrr + \hkern\texthoffset % brrrr \vbox to \zeropoint{\vss\page_info_place_info}% - \vskip\bodyfontsize}% + \vkern\bodyfontsize}% \dp\b_page_versions\zeropoint \wd\b_page_versions\scratchdimen - \setbox#1\hpack{\box#1\hskip-\scratchdimen\box\b_page_versions}} + \setbox#1\hpack{\box#1\hkern-\scratchdimen\box\b_page_versions}} \setupversion % resets [\v!final] diff --git a/tex/context/base/mkiv/page-ini.mkiv b/tex/context/base/mkiv/page-ini.mkiv index 1a9968759..38477dc27 100644 --- a/tex/context/base/mkiv/page-ini.mkiv +++ b/tex/context/base/mkiv/page-ini.mkiv @@ -80,7 +80,7 @@ \fi} \def\page_otr_flush_pending_content - {\vskip\zeropoint\relax + {\vkern\zeropoint\relax \ifvoid\normalpagebox \else \unvbox\normalpagebox \penalty\outputpenalty diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv index 1f0476e9b..005910a79 100644 --- a/tex/context/base/mkiv/page-lay.mkiv +++ b/tex/context/base/mkiv/page-lay.mkiv @@ -1260,7 +1260,7 @@ % \to \everybeforeshipout \def\goleftonpage % name will change (we could cache) - {\hskip-\dimexpr\leftmargindistance+\leftmarginwidth+\leftedgedistance+\leftedgewidth\relax} + {\hkern-\dimexpr\leftmargindistance+\leftmarginwidth+\leftedgedistance+\leftedgewidth\relax} \def\doifelsemarginswap#1#2% {\doifbothsides{#1}{#1}{#2}} diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv index 87783436f..64c4a7134 100644 --- a/tex/context/base/mkiv/page-one.mkiv +++ b/tex/context/base/mkiv/page-one.mkiv @@ -142,16 +142,17 @@ {\page_otr_command_flush_top_insertions % this is messy ... we will provide a more tight area (no big deal as we can % do that at the lua end) +% \parfillskip\zeropoint \page_one_registered_text_area_a#1#2% \unvbox <box> % \ifgridsnapping - \vskip\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax + \vkern\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax \prevdepth\openstrutdepth \page_otr_command_flush_bottom_insertions \vfil \else\ifcase\bottomraggednessmode % ragged (default) - \vskip\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax + \vkern\dimexpr\openstrutdepth-\d_page_one_natural_depth\relax \prevdepth\openstrutdepth \page_otr_command_flush_bottom_insertions \vfil @@ -160,7 +161,7 @@ \page_otr_command_flush_bottom_insertions \or % baseline - \kern\dimexpr\maxdepth-\d_page_one_natural_depth\relax + \vkern\dimexpr\maxdepth-\d_page_one_natural_depth\relax \page_otr_command_flush_bottom_insertions \fi\fi \fakepagenotes}% @@ -323,15 +324,15 @@ \def\page_one_command_flush_top_insertions_indeed {\ifgridsnapping \box\namedinsertionnumber\s!topfloat - \vskip-\topskip - \vskip\strutheight % [xx] new: see icare topbleed + \vkern-\topskip + \vkern\strutheight % [xx] new: see icare topbleed \else \ifcase\c_page_floats_insertions_topskip_mode % 0: default, do nothing \or % 1: no topskip (crossed fingers) - \vskip-\topskip - \vskip\strutheight + \vskip-\topskip % skip ! + \vkern\strutheight \fi \unvbox\namedinsertionnumber\s!topfloat \fi} diff --git a/tex/context/base/mkiv/page-spr.mkiv b/tex/context/base/mkiv/page-spr.mkiv index 6c8f4d187..bb95ee467 100644 --- a/tex/context/base/mkiv/page-spr.mkiv +++ b/tex/context/base/mkiv/page-spr.mkiv @@ -23,15 +23,32 @@ % beware, ugly overload, to be redone +% \def\normalsettextpagecontent#1#2#3% #2 and #3 will disappear +% {\setbox#1\hbox +% {\setlayoutcomponentattribute{\v!page:\v!text}% +% \vbox \layoutcomponentboxattribute to \textheight +% {\offinterlineskip +% \freezetextwidth +% \hsize\textwidth % local variant of \sethsize +% \boxmaxdepth\maxdepth +% \noindent % content can be < \hsize +% \page_otr_command_package_contents#2#3}}% +% \dp#1\zeropoint +% \ifconditional\c_page_spread_busy +% \normalsettextpagecontent_spread{#1}% +% \else +% \normalsettextpagecontent_normal{#1}% +% \fi} + \def\normalsettextpagecontent#1#2#3% #2 and #3 will disappear - {\setbox#1\hbox + {\setbox#1\hpack {\setlayoutcomponentattribute{\v!page:\v!text}% - \vbox \layoutcomponentboxattribute to \textheight + \vpack \layoutcomponentboxattribute to \textheight {\offinterlineskip \freezetextwidth \hsize\textwidth % local variant of \sethsize \boxmaxdepth\maxdepth - \noindent % content can be < \hsize + \noindent % content can be < \hsize \page_otr_command_package_contents#2#3}}% \dp#1\zeropoint \ifconditional\c_page_spread_busy diff --git a/tex/context/base/mkiv/page-txt.mkvi b/tex/context/base/mkiv/page-txt.mkvi index 00e329c01..97668c143 100644 --- a/tex/context/base/mkiv/page-txt.mkvi +++ b/tex/context/base/mkiv/page-txt.mkvi @@ -527,10 +527,10 @@ \page_layouts_place_text_line_right \page_layouts_place_text_line_left \namedlayoutelementparameter\currentlayouttextline\c!after - \kern\zeropoint}% keep the \dp, beware of \vtops, never change this! + \vkern\zeropoint}% keep the \dp, beware of \vtops, never change this! \dp\b_page_layouts_element\zeropoint \box\b_page_layouts_element - \vskip-#height\relax} + \vkern-#height\relax} \let\page_layouts_extra_at_margin_left \plusone \let\page_layouts_extra_at_margin_right\plustwo @@ -831,21 +831,21 @@ \calculatereducedvsizes \swapmargins \offinterlineskip - \vskip\dimexpr-\topheight-\topdistance\relax + \vkern\dimexpr-\topheight-\topdistance\relax \the\toptextcontent - \vskip\dimexpr\topheight+\topdistance\relax + \vkern\dimexpr\topheight+\topdistance\relax \the\headertextcontent - \vskip\dimexpr\headerheight+\headerdistance+\textdistance\relax + \vkern\dimexpr\headerheight+\headerdistance+\textdistance\relax \anch_positions_place_anchors - \vskip\dimexpr-\textdistance-\textheight\relax + \vkern\dimexpr-\textdistance-\textheight\relax \the\texttextcontent - \vskip\textheight + \vkern\textheight \the\everyendoftextbody - \vskip\footerdistance + \vkern\footerdistance \the\footertextcontent - \vskip\dimexpr\footerheight+\bottomdistance\relax + \vkern\dimexpr\footerheight+\bottomdistance\relax \the\bottomtextcontent - \vskip\bottomheight + \vkern\bottomheight \vfilll}% \smashbox\b_page_layouts_element \box\b_page_layouts_element} @@ -864,7 +864,7 @@ \calculatereducedvsizes \calculatehsizes \swapmargins - \vskip\dimexpr\headerheight+\headerdistance+\textdistance\relax + \vkern\dimexpr\headerheight+\headerdistance+\textdistance\relax \dontleavehmode %\page_prepare_backgrounds{#2}% \hpack to \makeupwidth diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 138c84361..45dffcfaa 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 5609dc05a..de9be122c 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index 850b1fe6a..4e767b3ad 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -393,6 +393,10 @@ \newtoks \scratchtoksfour \newtoks \scratchtoksfive \newtoks \scratchtokssix \newbox \scratchboxfour \newbox \scratchboxfive \newbox \scratchboxsix +\newcount\globalscratchcounterone +\newcount\globalscratchcountertwo +\newcount\globalscratchcounterthree + %D \macros %D {tempstring} diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua index b7554c7cb..67bd26de6 100644 --- a/tex/context/base/mkiv/task-ini.lua +++ b/tex/context/base/mkiv/task-ini.lua @@ -53,6 +53,7 @@ appendaction("processors", "fonts", "typesetters.fontkerns.handler", appendaction("processors", "fonts", "nodes.handlers.protectglyphs", nil, "nonut", "enabled" ) appendaction("processors", "fonts", "builders.kernel.ligaturing", nil, "nut", "disabled" ) appendaction("processors", "fonts", "builders.kernel.kerning", nil, "nut", "disabled" ) +appendaction("processors", "fonts", "builders.kernel.cleanup", nil, "nut", "enabled" ) appendaction("processors", "fonts", "nodes.handlers.stripping", nil, "nut", "disabled" ) appendaction("processors", "fonts", "nodes.handlers.flatten", nil, "nut", "disabled" ) appendaction("processors", "fonts", "fonts.goodies.colorschemes.coloring", nil, "nut", "disabled" ) diff --git a/tex/context/base/mkiv/util-evo.lua b/tex/context/base/mkiv/util-evo.lua index b6d058e39..dfb395e08 100644 --- a/tex/context/base/mkiv/util-evo.lua +++ b/tex/context/base/mkiv/util-evo.lua @@ -379,6 +379,21 @@ local function findzone(presets,name) return usedzones and usedzones[name] end +local function getzonenames(presets) + if not presets then + return { } + end + local data = presets.data + if not data then + return { } + end + local t = sortedkeys(data.zones or { }) + for i=1,#t do + t[i] = lower(t[i]) + end + return t +end + local function gettargets(zone) -- maybe also for a day local schedule = zone.schedule local min = false @@ -990,6 +1005,7 @@ evohome = { setzonestate = setzonestate, -- presets, name, temperature resetzonestate = resetzonestate, -- presets, name getzonedata = findzone, -- presets, name + getzonenames = getzonenames, -- presets -- loadpresets = loadpresets, -- filename loadhistory = loadhistory, -- presets | filename diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 4d99b4f4d..870816228 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 f4672bd0c..5ac21feab 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 9ae2c4882..accb0810d 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 : 12/30/18 19:28:22 +-- merge date : 01/03/19 19:27:26 do -- begin closure to overcome local limits and interference @@ -25519,6 +25519,7 @@ local setcomponents=nuts.setcomponents local getdir=nuts.getdir local getwidth=nuts.getwidth local ischar=nuts.is_char +local isglyph=nuts.isglyph local usesfont=nuts.uses_font local insert_node_after=nuts.insert_after local copy_node=nuts.copy @@ -25707,7 +25708,6 @@ local copy_no_components=nuts.copy_no_components local copy_only_glyphs=nuts.copy_only_glyphs local set_components=setcomponents local take_components=getcomponents -local isglyph=nuts.isglyph local function count_components(start,marks) local char=isglyph(start) if char then |