diff options
Diffstat (limited to 'tex')
30 files changed, 812 insertions, 194 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 734fea0b7..49600d565 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.04.13 14:53} +\newcontextversion{2018.04.15 23:11} %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 22b2f44c9..644aca35c 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.04.13 14:53} +\edef\contextversion{2018.04.15 23:11} %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 61c9a1493..cc45fc559 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.04.13 14:53} +\newcontextversion{2018.04.15 23:11} %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 00fd83ea8..b08b78ef4 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.04.13 14:53} +\edef\contextversion{2018.04.15 23:11} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-imp-effects.lua b/tex/context/base/mkiv/font-imp-effects.lua index a5e04500c..cb7cf10d3 100644 --- a/tex/context/base/mkiv/font-imp-effects.lua +++ b/tex/context/base/mkiv/font-imp-effects.lua @@ -267,6 +267,12 @@ local function setmathcharacters(tfmdata,characters,mathparameters,dx,dy,squeeze end end +-- local show_effect = { "lua", function(f,c) +-- report_effect("font id %i, char %C",f,c) +-- end } +-- +-- local show_effect = { "lua", "print('!')" } + local function manipulateeffect(tfmdata) local effect = tfmdata.properties.effect if effect then @@ -293,6 +299,7 @@ local function manipulateeffect(tfmdata) local oldwidth = character.width local oldheight = character.height local olddepth = character.depth + if oldwidth and oldwidth > 0 then character.width = oldwidth + wdelta local commands = character.commands @@ -300,11 +307,13 @@ local function manipulateeffect(tfmdata) if vshift then if commands then prependcommands ( commands, +-- show_effect, hshift, vshift ) else character.commands = { +-- show_effect, hshift, vshift, charcommand[unicode] @@ -313,10 +322,12 @@ local function manipulateeffect(tfmdata) else if commands then prependcommands ( commands, +-- show_effect, hshift ) else character.commands = { +-- show_effect, hshift, charcommand[unicode] } diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua index 7dfcd129e..032df0cf3 100644 --- a/tex/context/base/mkiv/font-ocl.lua +++ b/tex/context/base/mkiv/font-ocl.lua @@ -385,7 +385,7 @@ local function pdftovirtual(tfmdata,pdfshapes,kind) -- kind = sbix|svg properties.virtualized = true -- tfmdata.fonts = { - { id = 0 } + { id = 0 } -- not really needed } -- local getactualtext = otf.getactualtext diff --git a/tex/context/base/mkiv/font-otc.lua b/tex/context/base/mkiv/font-otc.lua index fb8bf7c66..c2e89599a 100644 --- a/tex/context/base/mkiv/font-otc.lua +++ b/tex/context/base/mkiv/font-otc.lua @@ -466,6 +466,8 @@ local function addfeature(data,feature,specifications) if not subtype then subtype = lookup.type end + elseif v == 0 then + lookups[k] = { { type = "gsub_remove" } } else lookups[k] = false -- { false } -- new end diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua index 45a3acb7d..a728163ce 100644 --- a/tex/context/base/mkiv/font-otj.lua +++ b/tex/context/base/mkiv/font-otj.lua @@ -302,10 +302,10 @@ end -- kind: 0=single 1=first of pair, 2=second of pair function injections.setposition(kind,current,factor,rlmode,spec,injection) - local x = factor*spec[1] - local y = factor*spec[2] - local w = factor*spec[3] - local h = factor*spec[4] + local x = factor * (spec[1] or 0) + local y = factor * (spec[2] or 0) + local w = factor * (spec[3] or 0) + local h = factor * (spec[4] or 0) if x ~= 0 or w ~= 0 or y ~= 0 or h ~= 0 then -- okay? local yoffset = y - h local leftkern = x -- both kerns are set in a pair kern compared diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 25083dfce..ac50ad00e 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -623,7 +623,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou return head, base end -local function multiple_glyphs(head,start,multiple,skiphash,what) -- what to do with skiphash matches here +local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what to do with skiphash matches here local nofmultiples = #multiple if nofmultiples > 0 then resetinjection(start) @@ -1270,6 +1270,14 @@ local function getmapping(dataset,sequence,currentlookup) end end +function chainprocs.gsub_remove(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) + if trace_chains then + logprocess("%s: removing character %s",cref(dataset,sequence,chainindex),gref(getchar(start))) + end + head, start = remove_node(head,start,true) + return head, getprev(start), true +end + function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) local mapping = currentlookup.mapping if mapping == nil then @@ -1380,7 +1388,7 @@ function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup if trace_multiples then logprocess("%s: replacing %s by multiple characters %s",cref(dataset,sequence),gref(startchar),gref(replacement)) end - return multiple_glyphs(head,start,replacement,skiphash,dataset[1]) + return multiple_glyphs(head,start,replacement,skiphash,dataset[1],stop) end end return head, start, false @@ -1986,6 +1994,9 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) logprocess("%s: %s is not yet supported (2)",cref(dataset,sequence),chainkind) end end + else + -- we skip but we could also delete as option .. what does an empty lookup actually mean + -- in opentype ... anyway, we could map it onto gsub_remove if needed end i = i + 1 if i > size or not start then diff --git a/tex/context/base/mkiv/grph-rul.lua b/tex/context/base/mkiv/grph-rul.lua index 03f678973..8daf80779 100644 --- a/tex/context/base/mkiv/grph-rul.lua +++ b/tex/context/base/mkiv/grph-rul.lua @@ -109,7 +109,6 @@ def RuleColor = %color% enddef ; direction = p.direction or "TLT", h = h * bpfactor, v = v * bpfactor, - } if not initialized then initialized = true diff --git a/tex/context/base/mkiv/lang-hyp.mkiv b/tex/context/base/mkiv/lang-hyp.mkiv index feec82659..9301fd1d8 100644 --- a/tex/context/base/mkiv/lang-hyp.mkiv +++ b/tex/context/base/mkiv/lang-hyp.mkiv @@ -48,10 +48,11 @@ \automatichyphenmode \plusone \hyphenpenaltymode \plusfour -\hyphenpenalty 50 % hyphenator -\automatichyphenpenalty 50 % - -\explicithyphenpenalty 50 % \- -\compoundhyphenpenalty 50 +\hyphenpenalty 50 % hyphenator +\automatichyphenpenalty 50 % - +\explicithyphenpenalty 50 % \- +\compoundhyphenpenalty 50 +\exceptionpenalty 1000 %D This command can change! At some point we will keep the setting with the %D paragraph and then the \type {\par} can go. diff --git a/tex/context/base/mkiv/lpdf-ano.lua b/tex/context/base/mkiv/lpdf-ano.lua index eba4d6060..3a86b22ca 100644 --- a/tex/context/base/mkiv/lpdf-ano.lua +++ b/tex/context/base/mkiv/lpdf-ano.lua @@ -119,6 +119,7 @@ end local function useautoprefix(name) local internal = autoprefix .. name usedautoprefixes[internal] = true + return internal end local function checkautoprefixes(destinations) diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 53c30d7ed..50b798b79 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -244,6 +244,7 @@ return { "efcode", "etoksapp", "etokspre", + "exceptionpenalty", "expanded", "expandglyphsinfont", "explicitdiscretionary", diff --git a/tex/context/base/mkiv/node-bck.lua b/tex/context/base/mkiv/node-bck.lua index 4ed5abe5e..054135669 100644 --- a/tex/context/base/mkiv/node-bck.lua +++ b/tex/context/base/mkiv/node-bck.lua @@ -9,6 +9,9 @@ if not modules then modules = { } end modules ['node-bck'] = { -- beware, this one takes quite some runtime, so we need a status flag -- maybe some page related state +-- todo: done (or just get rid of done altogether) ... saves no purpose +-- any longer + local attributes, nodes, node = attributes, nodes, node local enableaction = nodes.tasks.enableaction @@ -18,6 +21,7 @@ local listcodes = nodes.listcodes local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist +local alignment_code = listcodes.alignment local cell_code = listcodes.cell local nuts = nodes.nuts @@ -33,27 +37,88 @@ local getlist = nuts.getlist local getattr = nuts.getattr local getsubtype = nuts.getsubtype local getwhd = nuts.getwhd +local getwidth = nuts.getwidth local setattr = nuts.setattr local setlink = nuts.setlink local setlist = nuts.setlist +local setattributelist = nuts.setattributelist + +local takebox = nuts.takebox +local findtail = nuts.tail local traverse = nuts.traverse local traverse_id = nuts.traverse_id +local flush_node_list = nuts.flush_list + local new_rule = nodepool.rule -local new_glue = nodepool.glue - -local a_color = attributes.private('color') -local a_transparency = attributes.private('transparency') -local a_colormodel = attributes.private('colormodel') -local a_background = attributes.private('background') -local a_alignbackground = attributes.private('alignbackground') - -local function add_backgrounds(head) -- rather old code .. to be redone - local current = head - while current do - local id = getid(current) +local new_kern = nodepool.kern + +local privateattributes = attributes.private + +local linefillers = nodes.linefillers + +local a_color = privateattributes("color") +local a_transparency = privateattributes("transparency") +local a_colormodel = privateattributes("colormodel") +local a_background = privateattributes("background") +local a_alignbackground = privateattributes("alignbackground") +local a_linefiller = privateattributes("linefiller") +local a_ruled = privateattributes("ruled") + +-- actually we can be more clever now: we can store cells and row data +-- and apply it + +local function colored_a(current,list,template,id) + local width, height, depth = getwhd(current) + local total = height + depth + if width > 0 and total > 0 then + local rule = nil + -- + local a = getattr(template,a_linefiller) + if a then + local d = linefillers.data[a%1000] + if d then + rule = linefillers.filler(template,d,width,height,depth) + end + end + -- + if not rule then + rule = new_rule(width,height,depth) + end + local back = new_kern(-((id == vlist_code and total) or width)) + setattributelist(rule,template) + return setlink(rule,back,list) + end +end + +local function colored_b(current,list,template,id,indent) + local width, height, depth = getwhd(current) + local total = height + depth + if width > 0 and total > 0 then + local fore = (indent ~= 0) and new_kern(indent) + local rule = nil + -- + local a = getattr(template,a_linefiller) + if a then + local d = linefillers.data[a%1000] + if d then + rule = linefillers.filler(template,d,width-indent,height,depth) + end + end + -- + if not rule then + rule = new_rule(width-indent,height,depth) + setattributelist(rule,template) + end + local back = new_kern(-((id == vlist_code and total) or width)) + return setlink(fore,rule,back,list) + end +end + +local function add_backgrounds(head) + for current, id in traverse(head) do if id == hlist_code or id == vlist_code then local list = getlist(current) if list then @@ -63,124 +128,113 @@ local function add_backgrounds(head) -- rather old code .. to be redone list = head end end - local width, height, depth = getwhd(current) - if width > 0 then - local background = getattr(current,a_background) - if background then - -- direct to hbox - -- colorspace is already set so we can omit that and stick to color - local mode = getattr(current,a_colormodel) - if mode then - local skip = id == hlist_code and width or (height + depth) - local glue = new_glue(-skip) - local rule = new_rule(width,height,depth) - local color = getattr(current,a_color) - local transparency = getattr(current,a_transparency) - setattr(rule,a_colormodel,mode) - if color then - setattr(rule,a_color,color) - end - if transparency then - setattr(rule,a_transparency,transparency) - end --- setlink(rule,glue) --- if list then --- setlink(glue,list) --- end --- setlist(current,rule) - setlist(current,rule,glue,list) - end + local background = getattr(current,a_background) + if background then + local list = colored_a(current,list,current,id) + if list then + setlist(current,list) end end end - current = getnext(current) end return head, true end +-- We use a fake hlist with proper attributes. + +local templates = { } +local currentrow = 0 + local function add_alignbackgrounds(head) - local current = head - while current do - local id = getid(current) - if id == hlist_code then + for current in traverse_id(hlist_code,head) do -- what is valign? + if getsubtype(current) == alignment_code then local list = getlist(current) - if not list then - -- no need to look - elseif getsubtype(current) == cell_code then - local background = nil - local found = nil - -- for l in traverse(list) do - -- background = getattr(l,a_alignbackground) - -- if background then - -- found = l - -- break - -- end - -- end - -- we know that it's a fake hlist (could be user node) - -- but we cannot store tables in user nodes yet - for l in traverse_id(hpack_code,list) do - background = getattr(l,a_alignbackground) - if background then - found = l - end - break - end - -- - if background then - -- current has subtype 5 (cell) - local width, height, depth = getwhd(current) - if width > 0 then - local mode = getattr(found,a_colormodel) - if mode then - local glue = new_glue(-width) - local rule = new_rule(width,height,depth) - local color = getattr(found,a_color) - local transparency = getattr(found,a_transparency) - setattr(rule,a_colormodel,mode) - if color then - setattr(rule,a_color,color) - end - if transparency then - setattr(rule,a_transparency,transparency) - end - setlink(rule,glue) - if list then - setlink(glue,list) + if list then + for current in traverse_id(hlist_code,list) do + if getsubtype(current) == cell_code then + local list = getlist(current) + if list then + for template in traverse_id(hlist_code,list) do + local background = getattr(template,a_alignbackground) + if background then + local list = colored_a(current,list,template) + if list then + setlist(current,list) + end + end + break end - setlist(current,rule) end end end - else - add_alignbackgrounds(list) end - elseif id == vlist_code then - local list = getlist(current) - if list then - add_alignbackgrounds(list) + currentrow = currentrow + 1 + local template = templates[currentrow] + if template then + local list = colored_b(current,list,template[1],hlist_code,template[2]) + if list then + setlist(current,list) + end + flush_node_list(template) + templates[currentrow] = false end end - current = getnext(current) end return head, true end --- nodes.handlers.backgrounds = add_backgrounds --- nodes.handlers.alignbackgrounds = add_alignbackgrounds +function nodes.handlers.backgrounds(head,where) + local head, done = add_backgrounds(tonut(head)) + return tonode(head), done +end -nodes.handlers.backgrounds = function(head) local head, done = add_backgrounds (tonut(head)) return tonode(head), done end -nodes.handlers.alignbackgrounds = function(head) local head, done = add_alignbackgrounds(tonut(head)) return tonode(head), done end +function nodes.handlers.alignbackgrounds(head,where) + if where == "alignment" and head then + local head, done = add_alignbackgrounds(tonut(head)) + return tonode(head), done + else + return head, false + end +end + +-- interfaces.implement { +-- name = "enablebackgroundboxes", +-- onlyonce = true, +-- actions = enableaction, +-- arguments = { "'shipouts'", "'nodes.handlers.backgrounds'" } +-- } +-- +-- doing it in the shipout works as well but this is nicer interfaces.implement { name = "enablebackgroundboxes", onlyonce = true, - actions = enableaction, - arguments = { "'shipouts'", "'nodes.handlers.backgrounds'" } + actions = function() + enableaction("mvlbuilders", "nodes.handlers.backgrounds") + enableaction("vboxbuilders","nodes.handlers.backgrounds") + end, } interfaces.implement { name = "enablebackgroundalign", onlyonce = true, - actions = enableaction, - arguments = { "'shipouts'", "'nodes.handlers.alignbackgrounds'" } + actions = function() + enableaction("mvlbuilders", "nodes.handlers.alignbackgrounds") + enableaction("vboxbuilders","nodes.handlers.alignbackgrounds") + end, +} + +interfaces.implement { + name = "setbackgroundrowdata", + arguments = { "integer", "integer", "dimension" }, + actions = function(row,box,indent) + templates[row] = { takebox(box), indent } + end, +} + +interfaces.implement { + name = "resetbackgroundrowdata", + actions = function() + currentrow = 0 + end, } diff --git a/tex/context/base/mkiv/node-pro.lua b/tex/context/base/mkiv/node-pro.lua index 4509bac18..ad4553b56 100644 --- a/tex/context/base/mkiv/node-pro.lua +++ b/tex/context/base/mkiv/node-pro.lua @@ -126,8 +126,8 @@ do do - local setfield = nodes.setfield - local hpack = nodes.hpack + local setboth = nodes.setboth + local hpack = nodes.hpack function nodes.fullhpack(head,...) local ok = hpack_filter(head) @@ -135,8 +135,7 @@ do ok = head end local hp, b = hpack(ok,...) - setfield(hp,"prev",nil) - setfield(hp,"next",nil) + setboth(hp) return hp, b end @@ -195,7 +194,7 @@ do end end - callbacks.register('post_linebreak_filter', processors.post_linebreak_filter,"all kind of horizontal manipulations (after par break)") + callbacks.register("post_linebreak_filter", processors.post_linebreak_filter,"all kind of horizontal manipulations (after par break)") end @@ -229,7 +228,7 @@ do end end - callbacks.register('contribute_filter', processors.contribute_filter,"things done with lines") + callbacks.register("contribute_filter", processors.contribute_filter,"things done with lines") end diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua index 2b0368c2b..b8388f373 100644 --- a/tex/context/base/mkiv/node-rul.lua +++ b/tex/context/base/mkiv/node-rul.lua @@ -473,15 +473,53 @@ local function linefiller(current,data,width,location) direction = getdir(current), }) else - local linefiller = new_rule(width,height,depth) + local rule = new_rule(width,height,depth) if ca then - setattr(linefiller,a_colorspace,ma) - setattr(linefiller,a_color,ca) + setattr(rule,a_colorspace,ma) + setattr(rule,a_color,ca) end if ta then - setattr(linefiller,a_transparency,ta) + setattr(rule,a_transparency,ta) + end + return rule + end +end + +function nodes.linefillers.filler(current,data,width,height,depth) + if width and width > 0 then + local height = height or data.height or 0 + local depth = depth or data.depth or 0 + if (height + depth) ~= 0 then + local mp = data.mp + local ma = data.ma + local ca = data.ca + local ta = data.ta + if mp and mp ~= "" then + return tonut(userrule { + width = width, + height = height, + depth = depth, + type = "mp", + line = data.rulethickness, + data = mp, + ma = ma, + ca = ca, + ta = ta, + option = location, + direction = getdir(current), + }) + else + local rule = new_rule(width,height,depth) + if ca then + setattr(rule,a_colorspace,ma) + setattr(rule,a_color,ca) + end + if ta then + setattr(rule,a_transparency,ta) + end + return rule + end end - return linefiller end end diff --git a/tex/context/base/mkiv/node-rul.mkiv b/tex/context/base/mkiv/node-rul.mkiv index 643e93c42..a7ec99f7d 100644 --- a/tex/context/base/mkiv/node-rul.mkiv +++ b/tex/context/base/mkiv/node-rul.mkiv @@ -146,6 +146,8 @@ {\node_rules_set{#1}\barparameter\c!left}% {\relax\barparameter\c!right}} +% store in properties + \unexpanded\def\node_rules_set#1% maybe reverse the 1000 (also maybe use more attributes instead of settings) {\edef\currentbar{#1}% \usebarstyleandcolor\c!foregroundstyle\c!foregroundcolor @@ -571,4 +573,35 @@ \c!distance=.25\emwidth, \c!rulethickness=.25\exheight] +%D Bonus: +%D +%D \starttyping +%D \startuseMPgraphic{foo} +%D fill unitsquare +%D xyscaled (RuleWidth,RuleHeight+RuleDepth) enlarged (ExHeight/4,ExHeight/8) +%D shifted (-ExHeight/8,ExHeight/16) +%D withcolor RuleColor ; +%D \stopuseMPgraphic +%D +%D \definelinefiller[foo][mp=foo,color=darkred] +%D +%D \linefillerhbox[foo]{OEPS} +%D \stoptyping + +\unexpanded\def\node_backgrounds_filler_box#1#2[#3]% + {\bgroup + \clf_enablebackgroundboxes + \dowithnextbox{% + \node_linefiller_set{#3}% + #1% + attr \backgroundattribute \plusone + attr \linefillerattribute \the\attribute\linefillerattribute + {\box\nextbox}% + \egroup}% + #2} + +\unexpanded\def\linefillerhbox{\node_backgrounds_filler_box\hpack\hbox} +\unexpanded\def\linefillervbox{\node_backgrounds_filler_box\vpack\vbox} +\unexpanded\def\linefillervtop{\node_backgrounds_filler_box\tpack\vtop} + \protect \endinput diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex d3b0db503..44f2a3e83 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 87aefae39..6ac2e451c 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-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi index 632c67686..1107cb494 100644 --- a/tex/context/base/mkiv/strc-flt.mkvi +++ b/tex/context/base/mkiv/strc-flt.mkvi @@ -110,7 +110,7 @@ % \c!stopper=, \c!suffixseparator=, % currently rather hard coded \c!suffix=\floatcaptionsuffix, - \c!distance=\emwidth, + \c!distance=\emwidth, % plus .5\emwidth minus .25\emwidth \c!conversion=\v!numbers, \c!maxwidth=\hsize, \c!command=] @@ -505,10 +505,13 @@ \let\floatlocationmethod\empty \def\strc_floats_analyze_location - {% moved here, will do more + {% more will be moved here \let\floatlabel \empty \let\floatcolumn\empty \let\floatrow \empty + % + \edef\floatcaptionlocation{\floatcaptionparameter\c!location}% + % \setfloatmethodvariables\floatlocation} \unexpanded\def\strc_floats_place#tag% @@ -571,25 +574,49 @@ \strc_floats_set_current_tag{#tag}% \dodoubleempty\strc_floats_start_place_indeed} +%D We abuse the settings to pick up some float parameters too which makes it +%D messy. + \def\strc_floats_start_place_indeed[#settings][#userdata]% {\strc_floats_reset_variables - \edef\savedfloatlocation{\floatcaptionparameter\c!location}% + % save + \edef\m_location {\floatcaptionparameter\c!location}% + \edef\m_topoffset {\floatcaptionparameter\c!topoffset}% + \edef\m_bottomoffset{\floatcaptionparameter\c!bottomoffset}% + \edef\m_freeregion {\floatcaptionparameter\c!freeregion}% + % preset + \letfloatcaptionparameter \c!location \empty \setexpandedfloatcaptionparameter\c!topoffset {\floatparameter\c!topoffset}% \setexpandedfloatcaptionparameter\c!bottomoffset{\floatparameter\c!bottomoffset}% \setexpandedfloatcaptionparameter\c!freeregion {\floatparameter\c!freeregion}% - \setupcurrentfloatcaption[\c!location=,\c!reference=,\c!title=,\c!marking=,\c!list=,\c!bookmark=,#settings]% - \setexpandedfloatparameter\c!topoffset {\floatcaptionparameter\c!topoffset}% - \setexpandedfloatparameter\c!bottomoffset{\floatcaptionparameter\c!bottomoffset}% - \setexpandedfloatparameter\c!freeregion {\floatcaptionparameter\c!freeregion}% - \def\m_strc_floats_saved_userdata{#2}% + \letfloatcaptionparameter \c!reference \empty + \letfloatcaptionparameter \c!title \empty + \letfloatcaptionparameter \c!marking \empty + \letfloatcaptionparameter \c!list \empty + \letfloatcaptionparameter \c!bookmark \empty + % pickup + \setupcurrentfloatcaption[#settings]% + \ifsecondargument + \setupcurrentfloatuserdata[#userdata]% + \def\m_strc_floats_saved_userdata{#userdata}% + \else + \let\m_strc_floats_saved_userdata\empty + \fi + % check \edef\floatlocation{\floatcaptionparameter\c!location}% - \setfloatcaptionparameter\c!location{\savedfloatlocation}% not expanded \ifx\floatlocation\empty \edef\floatlocation{\floatparameter\c!default}% \fi - \ifsecondargument - \setupcurrentfloatuserdata[#userdata]% - \fi + % inherit + \setexpandedfloatparameter\c!topoffset {\floatcaptionparameter\c!topoffset}% + \setexpandedfloatparameter\c!bottomoffset{\floatcaptionparameter\c!bottomoffset}% + \setexpandedfloatparameter\c!freeregion {\floatcaptionparameter\c!freeregion}% + % restore + \letfloatcaptionparameter\c!location \m_location + \letfloatcaptionparameter\c!topoffset \m_topoffset + \letfloatcaptionparameter\c!bottomoffset\m_bottomoffset + \letfloatcaptionparameter\c!freeregion \m_freeregion + % \strc_floats_analyze_location \doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal \bgroup @@ -1191,11 +1218,11 @@ {\global\setbox\floatbox\hpack to \scratchwidth {\doifnotinset\v!right\floatlocation\hss \box\floatbox - \doifnotinset\v!left \floatlocation\hss}} + \doifnotinset\v!left\floatlocation\hss}} -\def\strc_floats_realign_floatbox_horizontal_two +\def\strc_floats_realign_floatbox_horizontal_two % why is this {\global\setbox\floatbox\hpack to \scratchwidth - {\doifnot{\floatparameter\c!location}\v!left \hss + {\doifnot{\floatparameter\c!location}\v!left\hss \box\floatbox \doifnot{\floatparameter\c!location}\v!right\hss}} @@ -1336,7 +1363,7 @@ % % \def\strc_floats_align_content_indeed % {\alignstrutmode\zerocount -% \doifnotcommon{\floatcaptionparameter\c!location}{\v!outermargin,\v!innermargin,\v!leftmargin,\v!rightmargin} +% \doifnotcommon\floatcaptionlocation{\v!outermargin,\v!innermargin,\v!leftmargin,\v!rightmargin} % {\shiftalignedline % {\floatparameter\c!leftmargin }{\floatparameter\c!rightmargin}% % {\floatparameter\c!innermargin}{\floatparameter\c!outermargin}}% @@ -1371,7 +1398,7 @@ \def\strc_floats_align_content_indeed {\alignstrutmode\zerocount \ifx\forcedfloatmethod\v!local \else - \doifnotcommon{\floatcaptionparameter\c!location}{\v!outermargin,\v!innermargin,\v!leftmargin,\v!rightmargin} + \doifnotcommon\floatcaptionlocation{\v!outermargin,\v!innermargin,\v!leftmargin,\v!rightmargin} {\strc_floats_shift_indeed\floatparameter}% \expandafter\strc_floats_align_indeed \fi} @@ -1462,23 +1489,21 @@ \fi\fi \strc_floats_align_content{\copy\b_strc_floats_content}}} + \def\strc_floats_prepare_page_caption - {\edef\p_strc_floats_caption_location{\floatcaptionparameter\c!location}% - \edef\p_strc_floats_caption_width {\floatcaptionparameter\c!width}% + {\edef\p_strc_floats_caption_width {\floatcaptionparameter\c!width}% \edef\p_strc_floats_caption_minwidth{\floatcaptionparameter\c!minwidth}% \edef\p_strc_floats_caption_align {\floatcaptionparameter\c!align}% \dostarttagged\t!floatcaption\empty - \ifx\p_strc_floats_caption_location\v!top - \strc_floats_prepare_page_caption_top_bottom - \else\ifx\p_strc_floats_caption_location\v!bottom - \strc_floats_prepare_page_caption_top_bottom - \else\ifx\p_strc_floats_caption_width\v!fit - \strc_floats_prepare_side_auto_caption - \else\ifx\p_strc_floats_caption_width\v!max - \strc_floats_prepare_side_auto_caption - \else - \strc_floats_prepare_side_width_caption - \fi\fi\fi\fi + \doifcommonelse\floatcaptionlocation{\v!top,\v!bottom} + {\strc_floats_prepare_page_caption_top_bottom} + {\ifx\p_strc_floats_caption_width\v!fit + \strc_floats_prepare_side_auto_caption + \else\ifx\p_strc_floats_caption_width\v!max + \strc_floats_prepare_side_auto_caption + \else + \strc_floats_prepare_side_width_caption + \fi\fi}% \dostoptagged} \def\strc_floats_prepare_page_caption_top_bottom @@ -1508,7 +1533,11 @@ \fi} \def\strc_floats_caption_set_align - {\normalexpanded{\setupalign[\v!reset,\p_strc_floats_caption_align]}} + {\edef\m_align{\v!reset\ifx\p_strc_floats_caption_align\empty\else,\fi\p_strc_floats_caption_align}% + \doifinset\v!tolerant \floatcaptionlocation{\edef\m_align{\m_align,\v!tolerant}}% + \doifinset\v!verytolerant\floatcaptionlocation{\edef\m_align{\m_align,\v!verytolerant}}% + \doifinset\v!stretch \floatcaptionlocation{\edef\m_align{\m_align,\v!stretch}}% + \setupalign[\m_align]} \def\strc_floats_prepare_side_auto_caption {\scratchdimen\dimexpr\hsize-\wd\b_strc_floats_content-\floatparameter\c!margin\relax @@ -1640,7 +1669,7 @@ {\ifconditional\c_strc_floats_par_float \hbox \else \expandafter \strc_floats_align_content \fi % skip, no pack {\d_strc_float_temp_height\ht\b_strc_floats_content \box\b_strc_floats_content - \doifnotinset\v!hang{\floatcaptionparameter\c!location} + \doifnotinset\v!hang\floatcaptionlocation {\dotfskip{\floatcaptionparameter\c!distance}}% \vbox to\d_strc_float_temp_height{#1}}} @@ -1648,7 +1677,7 @@ {\ifconditional\c_strc_floats_par_float \hbox \else \expandafter \strc_floats_align_content \fi % skip, no pack {\d_strc_float_temp_height\ht\b_strc_floats_content \vbox to\d_strc_float_temp_height{#1}% - \doifnotinset\v!hang{\floatcaptionparameter\c!location} + \doifnotinset\v!hang\floatcaptionlocation {\dotfskip{\floatcaptionparameter\c!distance}}% \box\b_strc_floats_content}} @@ -1718,7 +1747,7 @@ \def\strc_floats_build_box_next % beware, we first check on left/rightmargin because there can be left/right also {\let\next\strc_floats_build_box_next_left - \processallactionsinset[\floatcaptionparameter\c!location] + \processallactionsinset[\floatcaptionlocation] [ \v!outermargin=>\let\next\strc_floats_build_box_next_outer_margin, \v!innermargin=>\let\next\strc_floats_build_box_next_inner_margin, \v!leftmargin=>\let\next\strc_floats_build_box_next_left_margin, @@ -1736,7 +1765,7 @@ \let\next\strc_floats_build_box_high \else \let\next\strc_floats_build_box_middle - \processallactionsinset[\floatcaptionparameter\c!location] + \processallactionsinset[\floatcaptionlocation] [ \v!low=>\let\next\strc_floats_build_box_low, \v!middle=>\let\next\strc_floats_build_box_middle, \v!high=>\let\next\strc_floats_build_box_high]% @@ -1749,14 +1778,13 @@ \def\strc_floats_flush_left_caption_hang {\hsmash{\llap{\box\b_strc_floats_caption\dotfskip{\floatcaptionparameter\c!distance}}}} -\def\strc_floats_flush_caption_hang % expanded can go - {\edef\p_strc_floats_caption_location{\floatcaptionparameter\c!location}% - \doifelseinset\v!righthanging\p_strc_floats_caption_location +\def\strc_floats_flush_caption_hang + {\doifelseinset\v!righthanging\floatcaptionlocation {\strc_floats_flush_right_caption_hang} - {\doifelseinset\v!lefthanging\p_strc_floats_caption_location + {\doifelseinset\v!lefthanging\floatcaptionlocation {\strc_floats_flush_left_caption_hang} - {\doifelseinset\v!hang\p_strc_floats_caption_location - {\doifelseinset\v!outer\p_strc_floats_caption_location + {\doifelseinset\v!hang\floatcaptionlocation + {\doifelseinset\v!outer\floatcaptionlocation {\doifelserightpagefloat{\strc_floats_flush_right_caption_hang}{\strc_floats_flush_left_caption_hang}} {\doifelseinset\v!right\floatcaptiondirectives {\strc_floats_flush_right_caption_hang} @@ -1834,6 +1862,7 @@ {\dp\b_strc_floats_caption\strutdepth \setbox\scratchbox\vbox {\d_strc_float_temp_width\wd\b_strc_floats_content + \hsize\d_strc_float_temp_width \ifconditional\c_strc_floats_par_float \strc_floats_locate_side_float{\box\b_strc_floats_caption}% \vss\strc_floats_between_stack @@ -1845,12 +1874,13 @@ \strc_floats_align_content{\box\b_strc_floats_content}% \fi}% \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy - \vbox to \noflines\lineheight{\unvbox\scratchbox}} % \vpack ? + \vpack to \noflines\lineheight{\unvbox\scratchbox}} \def\strc_floats_build_box_bottom_stack_grid {\dp\b_strc_floats_caption\strutdepth \setbox\scratchbox\vbox {\d_strc_float_temp_width\wd\b_strc_floats_content + \hsize\d_strc_float_temp_width \ifconditional\c_strc_floats_par_float \hpack{\box\b_strc_floats_content}% \vss\strc_floats_between_stack @@ -1862,7 +1892,7 @@ \strc_floats_locate_text_float{\box\b_strc_floats_caption}% \fi}% \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy - \vbox to \noflines\lineheight{\unvbox\scratchbox}} % \vpack ? + \vpack to \noflines\lineheight{\unvbox\scratchbox}} \def\strc_floats_build_box_top_stack_stretch {\dp\b_strc_floats_caption\strutdepth @@ -1872,6 +1902,7 @@ \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy \vbox to \noflines\lineheight % pack ? {\d_strc_float_temp_width\wd\b_strc_floats_content + \hsize\d_strc_float_temp_width \ifconditional\c_strc_floats_par_float \strc_floats_locate_side_float{\box\b_strc_floats_caption}% \vss\strc_floats_between_stack\vss @@ -1885,16 +1916,17 @@ \def\strc_floats_build_box_bottom_stack_stretch {\dp\b_strc_floats_caption\strutdepth - \setbox\scratchbox\vbox % pack ? - {\strc_floats_align_content{\copy\b_strc_floats_content }% + \setbox\scratchbox\vpack + {\strc_floats_align_content{\copy\b_strc_floats_content}% \strc_floats_align_caption{\copy\b_strc_floats_caption}}% \getnoflines{\dimexpr\htdp\scratchbox-10\scaledpoint\relax}% get rid of inaccuracy \vbox to \noflines\lineheight {\d_strc_float_temp_width\wd\b_strc_floats_content + \hsize\d_strc_float_temp_width \ifconditional\c_strc_floats_par_float \hpack{\box\b_strc_floats_content}% \vss\strc_floats_between_stack\vss - \strc_floats_locate_side_float{\box\b_strc_floats_caption} + \strc_floats_locate_side_float{\box\b_strc_floats_caption}% \else \page_otr_command_set_float_hsize \strc_floats_align_content{\box\b_strc_floats_content}% @@ -1906,14 +1938,14 @@ {\let\next\strc_floats_build_box_top_stack_normal \processfirstactioninset[\floatcaptionparameter\c!location] [ \v!grid=>\let\next\strc_floats_build_box_top_stack_grid, - \v!stretch=>\let\next\strc_floats_build_box_top_stack_stretch]% + \v!lines=>\let\next\strc_floats_build_box_top_stack_stretch]% was \v!grid but interfered \next} \def\strc_floats_build_box_bottom {\let\next\strc_floats_build_box_bottom_stack_normal \processfirstactioninset[\floatcaptionparameter\c!location] [ \v!grid=>\let\next\strc_floats_build_box_bottom_stack_grid, - \v!stretch=>\let\next\strc_floats_build_box_bottom_stack_stretch]% + \v!lines=>\let\next\strc_floats_build_box_bottom_stack_stretch]% was \v!grid but interfered \next} \def\strc_floats_relocate_caption_right#1{\strc_floats_align_caption{\hbox to \d_strc_float_temp_width{\hss#1}}} @@ -1930,7 +1962,8 @@ \ifconditional\c_floats_store_minimal_package \strc_floats_build_box_separate_make \else - \let\floatcaptionarrangement\s!default + % \let\floatcaptionarrangement\s!default + \let\floatcaptionarrangement\v!bottom % for Alan \processcommacommand[\floatcaptionparameter\c!location]\strc_floats_build_box_step \ifcsname\??floatbuilder\floatcaptionarrangement\endcsname \lastnamedcs @@ -2105,8 +2138,9 @@ \def\strc_floats_prepare_side_caption_fit % or center when smaller {\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content\relax - \setbox\b_strc_floats_caption\vbox + \setbox\b_strc_floats_caption\vbox {\forgetall % needed? + \strc_floats_caption_set_align \hsize\wd\b_strc_floats_content \strc_floats_make_complete_caption}% \else diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index c27b832bb..181ec05be 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -1261,4 +1261,6 @@ \ifdefined\breakafterdirmode \else \newcount\breakafterdirmode \fi +\ifdefined\exceptionpenalty \else \newcount\exceptionpenalty \fi + \protect \endinput diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv index 7a0d2c8a8..033b5cff6 100644 --- a/tex/context/base/mkiv/tabl-tbl.mkiv +++ b/tex/context/base/mkiv/tabl-tbl.mkiv @@ -158,6 +158,7 @@ \newtoks \t_tabl_tabulate_dummy \newtoks \t_tabl_tabulate_every_row \newtoks \t_tabl_tabulate_every_after_row +\newtoks \t_tabl_tabulate_every_real_row \newtoks \t_tabl_tabulate_initializers_first \newtoks \t_tabl_tabulate_initializers_second @@ -174,6 +175,7 @@ \newcount \c_tabl_tabulate_totalnoflines \newcount \c_tabl_tabulate_minusnoflines \newcount \c_tabl_tabulate_align +\newcount \c_tabl_tabulate_nofrealrows \newcount \c_tabl_tabulate_nofcolumns % set at the lua end by parser \newcount \c_tabl_tabulate_has_rule_spec_first % set at the lua end by parser (for the moment a count) @@ -250,6 +252,18 @@ \installcorenamespace{tabulatefoot} \installcorenamespace{tabulatenext} +\prependtoks + \global\c_tabl_tabulate_nofrealrows\zerocount +\to \t_tabl_tabulate_initializers_first + +\prependtoks + \global\c_tabl_tabulate_nofrealrows\zerocount +\to \t_tabl_tabulate_initializers_second + +\prependtoks + \global\advance\c_tabl_tabulate_nofrealrows\plusone +\to \t_tabl_tabulate_every_real_row + \def\b_tabl_tabulate_current#1% {\csname\??tabulatebox\number#1\endcsname} % beware, a synonym @@ -2403,7 +2417,7 @@ \dostarttaggedchained\t!tabulate\empty\??tabulation \dostarttagged\t!tabulaterow\empty \setfalse\inhibitmargindata % new per 2012.06.13 ... really needed - \everycr\expandafter{\the\everycr\dostoptagged\dostarttagged\t!tabulaterow\empty}% + \everycr\expandafter{\the\everycr\noalign{\the\t_tabl_tabulate_every_real_row}\dostoptagged\dostarttagged\t!tabulaterow\empty}% % \toksapp\everycr{\dostoptagged\dostarttagged\t!tabulaterow\empty}% \expandafter\halign\expandafter{\the\t_tabl_tabulate_preamble\crcr\tabl_tabulate_insert_content\crcr}% \dostoptagged @@ -2729,4 +2743,243 @@ \unexpanded\def\tabulaterowtype{\tabl_tabulate_compact_row\type} \unexpanded\def\tabulaterowtyp {\tabl_tabulate_compact_row\typ} +%D Here we plug in a row background feature. As we only have support for +%D \type {frame=name} we can use these variables. +%D +%D \starttyping +%D \startuseMPgraphic{foo} +%D fill unitsquare +%D xyscaled (RuleWidth,RuleHeight+RuleDepth) enlarged (ExHeight/4,ExHeight/8) +%D randomized ExHeight +%D shifted (-ExHeight/8,ExHeight/16) +%D withcolor RuleColor ; +%D \stopuseMPgraphic +%D +%D \setuptabulate % wel only have frame=name so we can use these: +%D [background=foo, +%D backgroundcolor=darkred, +%D foregroundcolor=white] +%D +%D \definelinefiller[foo][mp=foo,color=darkgreen] +%D \definelinefiller[bar][mp=foo,color=darkred] +%D +%D \starttabulate[|||] +%D \DB foo \BC bar \BC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \stoptabulate +%D +%D \starttabulate[|||] +%D \PB foo \BC bar \BC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \stoptabulate +%D +%D \starttabulate[|||] +%D \FB[bar] foo \BC bar \BC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \stoptabulate +%D +%D \startnarrower +%D \starttabulate[|||] +%D \DB foo \DB bar \BC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \stoptabulate +%D \stopnarrower +%D +%D \starttabulate[|||] +%D \BC foo \BC bar \BC \NR +%D \NL[magenta] foo \NC bar \NC \NR +%D \NL[yellow] foo \NC bar \NC \NR +%D \NL[cyan] foo \NC bar \NC \NR +%D \NL[gray] foo \NC bar \NC \NR +%D \stoptabulate +%D +%D \starttabulate +%D \NL[red] foo \NC bar \NC \NR +%D \NL[green] foo \NL[red] bar \NC \NR +%D \NC foo \NC bar \NC \NR +%D \NL[blue] foo \NC \input tufte \NC \NR +%D \NL[gray] foo \NC bar \NC \NR +%D \NL[yellow] foo \NC bar \NC \NR +%D \stoptabulate +%D \stoptyping + +% \setuptabulate +% [\c!background=, +% \c!backgroundcolor=, +% \c!foregroundcolor=, +% \c!foregroundstyle=] + +\let\m_table_current_row_background \empty +\let\m_table_current_row_background_default \empty +\let\m_table_current_row_background_filler \empty +\let\m_table_current_row_background_defaultfiller\empty + +\unexpanded\def\tabl_register_row_background#1% + {\xdef\m_table_current_row_background{#1}} + +\unexpanded\def\tabl_register_row_background_filler#1% + {\xdef\m_table_current_row_background_filler{#1}} + +\unexpanded\def\tabl_synchronize_row_background + {\iftrialtypesetting\else + \ifx\m_table_current_row_background_filler\empty + \ifx\m_table_current_row_background\empty + % nothing + \else + \tabl_synchronize_row_background_indeed\m_table_current_row_background + \fi + \else + \tabl_synchronize_row_background_filler_indeed\m_table_current_row_background_filler + \fi + \fi} + +\unexpanded\def\tabl_synchronize_row_background_indeed#1% + {\begingroup + \clf_enablebackgroundalign % can be moved into \clf_setbackgroundrowdata + \directcolor[#1]% + \setbox\scratchbox\hpack{}% + \clf_setbackgroundrowdata\numexpr\c_tabl_tabulate_nofrealrows+\minusone\relax\scratchbox\d_tabl_tabulate_indent + \endgroup} + +\unexpanded\def\tabl_synchronize_row_background_filler_indeed#1% + {\begingroup + \clf_enablebackgroundalign % can be moved into \clf_setbackgroundrowdata + \node_linefiller_set{#1}% + \setbox\scratchbox\hpack{}% + \clf_setbackgroundrowdata\numexpr\c_tabl_tabulate_nofrealrows+\minusone\relax\scratchbox\d_tabl_tabulate_indent + \endgroup} + +\appendtoks + \glet\m_table_current_row_background\empty + \glet\m_table_current_row_background_filler\empty + \global\c_tabl_tabulate_nofrealrows\zerocount + \clf_resetbackgroundrowdata +\to \t_tabl_tabulate_initializers_first + +\appendtoks + \glet\m_table_current_row_background\empty + \glet\m_table_current_row_background_filler\empty + \global\c_tabl_tabulate_nofrealrows\zerocount + \clf_resetbackgroundrowdata +\to \t_tabl_tabulate_initializers_second + +\appendtoks + \tabl_synchronize_row_background +\to \t_tabl_tabulate_every_real_row + +\appendtoks + \glet\m_table_current_row_background\empty + \glet\m_table_current_row_background_filler\empty +\to \t_tabl_tabulate_every_after_row + +\unexpanded\def\tabl_tabulate_NL_first[#1]% + {\tabl_tabulate_column_normal\zerocount\zerocount\relax + \ifcase\c_tabl_tabulate_column\or + \tabl_register_row_background{#1}% + \fi + \ignorespaces} + +\unexpanded\def\tabl_tabulate_ND_first + {\tabl_tabulate_column_normal\zerocount\zerocount\relax + \ifcase\c_tabl_tabulate_column\or + \tabl_register_row_background\m_table_current_row_background_default + \fi + \ignorespaces} + +\unexpanded\def\tabl_tabulate_LB_first[#1]% + {\tabl_tabulate_column_normal\plusone\zerocount\relax + \ifcase\c_tabl_tabulate_column\or + \tabl_register_row_background{#1}% + \fi + \usetabulationstyleandcolor\c!foregroundstyle\c!foregroundcolor + \ignorespaces} + +\unexpanded\def\tabl_tabulate_DB_first + {\tabl_tabulate_column_normal\plusone\zerocount\relax + \ifcase\c_tabl_tabulate_column\or + \tabl_register_row_background\m_table_current_row_background_default + \fi + \let\fontstyle\globalfontstyle + \usetabulationstyleandcolor\c!foregroundstyle\c!foregroundcolor + \ignorespaces} + +\unexpanded\def\tabl_tabulate_NF_first[#1]% + {\tabl_tabulate_column_normal\zerocount\zerocount\relax + \ifcase\c_tabl_tabulate_column\or + \tabl_register_row_background_filler{#1}% + \fi + \ignorespaces} + +\unexpanded\def\tabl_tabulate_NP_first + {\tabl_tabulate_column_normal\zerocount\zerocount\relax + \ifcase\c_tabl_tabulate_column\or + \tabl_register_row_background_filler\m_table_current_row_background_default_filler + \fi + \ignorespaces} + +\unexpanded\def\tabl_tabulate_FB_first[#1]% + {\tabl_tabulate_column_normal\plusone\zerocount\relax + \ifcase\c_tabl_tabulate_column\or + \tabl_register_row_background_filler{#1}% + \fi + \usetabulationstyleandcolor\c!foregroundstyle\c!foregroundcolor + \ignorespaces} + +\unexpanded\def\tabl_tabulate_PB_first + {\tabl_tabulate_column_normal\plusone\zerocount\relax + \ifcase\c_tabl_tabulate_column\or + \tabl_register_row_background_filler\m_table_current_row_background_default_filler + \fi + \let\fontstyle\globalfontstyle + \usetabulationstyleandcolor\c!foregroundstyle\c!foregroundcolor + \ignorespaces} + +\unexpanded\def\tabl_tabulate_BC_first % overloaded + {\tabl_tabulate_column_normal\plusone\zerocount + \let\fontstyle\globalfontstyle + \ifx\m_table_current_row_background\empty + \ifx\m_table_current_row_background_filler\empty + \usetabulationstyleandcolor\c!headstyle\c!headcolor + \else + \usetabulationstyleandcolor\c!foregroundstyle\c!foregroundcolor + \fi + \else + \usetabulationstyleandcolor\c!foregroundstyle\c!foregroundcolor + \fi} + +\appendtoks + \let\NL\tabl_tabulate_NL_first % NC = NC with Line + \let\ND\tabl_tabulate_ND_first % NC = NC with Default Line + \let\LB\tabl_tabulate_LB_first % BC = BC with Line + \let\DB\tabl_tabulate_DB_first % BC = BC with Default Line + \let\NF\tabl_tabulate_NF_first % NF = NC with Filler + \let\NP\tabl_tabulate_NP_first % NP = NC with Predefined Fller + \let\FB\tabl_tabulate_FB_first % FB = BC with Filler + \let\PB\tabl_tabulate_PB_first % PB = BC with Predefined Fller +\to \t_tabl_tabulate_initializers_first + +\appendtoks + \edef\m_table_current_row_background_default {\tabulateparameter\c!backgroundcolor}% + \edef\m_table_current_row_background_default_filler{\tabulateparameter\c!background}% +\to \everytabulate + + +\setuptabulate + [\c!headcolor=, + \c!headstyle=\bf, + \c!foregroundcolor=, + \c!foregroundstyle=\tabulationparameter\c!headstyle] + \protect \endinput diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua index f41fb9b08..02713320e 100644 --- a/tex/context/base/mkiv/task-ini.lua +++ b/tex/context/base/mkiv/task-ini.lua @@ -78,8 +78,7 @@ appendaction("shipouts", "normalizers", "nodes.rules.handler") appendaction("shipouts", "normalizers", "nodes.shifts.handler") -- disabled appendaction("shipouts", "normalizers", "structures.tags.handler") -- disabled appendaction("shipouts", "normalizers", "nodes.handlers.accessibility") -- disabled -appendaction("shipouts", "normalizers", "nodes.handlers.backgrounds") -- disabled -appendaction("shipouts", "normalizers", "nodes.handlers.alignbackgrounds") -- disabled +------------("shipouts", "normalizers", "nodes.handlers.backgrounds") -- disabled ------------("shipouts", "normalizers", "nodes.handlers.export") -- disabled appendaction("shipouts", "normalizers", "typesetters.rubies.attach") -- disabled @@ -133,7 +132,11 @@ appendaction("finalizers", "lists", "nodes.linefillers.handler") appendaction("contributers", "normalizers", "nodes.handlers.flattenline") appendaction("contributers", "normalizers", "nodes.handlers.textbackgrounds") --- still experimental +appendaction("mvlbuilders", "normalizers", "nodes.handlers.alignbackgrounds") +appendaction("vboxbuilders", "normalizers", "nodes.handlers.alignbackgrounds") + +appendaction("mvlbuilders", "normalizers", "nodes.handlers.backgrounds") +appendaction("vboxbuilders", "normalizers", "nodes.handlers.backgrounds") appendaction("mvlbuilders", "normalizers", "typesetters.margins.globalhandler") -- disabled appendaction("mvlbuilders", "normalizers", "nodes.handlers.migrate") @@ -200,8 +203,7 @@ disableaction("shipouts", "attributes.viewerlayers.handler") disableaction("shipouts", "structures.tags.handler") disableaction("shipouts", "nodes.visualizers.handler") disableaction("shipouts", "nodes.handlers.accessibility") -disableaction("shipouts", "nodes.handlers.backgrounds") -disableaction("shipouts", "nodes.handlers.alignbackgrounds") +-------------("shipouts", "nodes.handlers.backgrounds") disableaction("shipouts", "nodes.references.handler") disableaction("shipouts", "nodes.destinations.handler") -------------("shipouts", "nodes.handlers.export") @@ -228,6 +230,12 @@ disableaction("math", "noads.handlers.autofences") disableaction("math", "noads.handlers.makeup") disableaction("math", "typesetters.directions.processmath") +disableaction("mvlbuilders", "nodes.handlers.backgrounds") +disableaction("vboxbuilders", "nodes.handlers.backgrounds") + +disableaction("mvlbuilders", "nodes.handlers.alignbackgrounds") +disableaction("vboxbuilders", "nodes.handlers.alignbackgrounds") + disableaction("mvlbuilders", "typesetters.margins.globalhandler") disableaction("mvlbuilders", "nodes.handlers.migrate") disableaction("mvlbuilders", "typesetters.checkers.handler") diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml index 8d0ae0644..46e1f7f86 100644 --- a/tex/context/interface/mkiv/context-en.xml +++ b/tex/context/interface/mkiv/context-en.xml @@ -10153,6 +10153,7 @@ <cd:constant type="low"/> <cd:constant type="high"/> <cd:constant type="grid"/> + <cd:constant type="lines"/> <cd:constant type="overlay"/> <cd:constant type="inner"/> <cd:constant type="outer"/> @@ -19373,6 +19374,83 @@ </cd:arguments> </cd:command> </cd:interface> + <cd:interface file="i-linefiller.xml"> + <cd:command file="node-rul.mkiv" name="definelinefiller"> + <cd:arguments> + <cd:keywords> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:keywords optional="yes"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments list="yes" optional="yes"> + <cd:inherit name="setuplinefiller"/> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command file="node-rul.mkiv" name="setuplinefiller"> + <cd:arguments> + <cd:keywords list="yes" optional="yes"> + <cd:constant type="cd:name"/> + </cd:keywords> + <cd:assignments list="yes"> + <cd:parameter name="location"> + <cd:constant type="left"/> + <cd:constant type="right"/> + <cd:constant default="yes" type="both"/> + </cd:parameter> + <cd:parameter name="scope"> + <cd:constant type="left"/> + <cd:constant type="right"/> + <cd:constant default="yes" type="local"/> + <cd:constant type="global"/> + </cd:parameter> + <cd:parameter name="color"> + <cd:constant type="cd:color"/> + </cd:parameter> + <cd:parameter name="height"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="depth"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="distance"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="threshold"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="rulethickness"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="textstyle"> + <cd:constant type="cd:style"/> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="textcolor"> + <cd:constant type="cd:color"/> + </cd:parameter> + <cd:parameter name="align"> + <cd:inherit name="setupalign"/> + </cd:parameter> + <cd:parameter name="mp"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="before"> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="after"> + <cd:constant type="cd:command"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + <cd:command file="node-rul.mkiv" name="filler"> + <cd:arguments> + <cd:content/> + </cd:arguments> + </cd:command> + </cd:interface> <cd:interface file="i-linenumber.xml"> <cd:command category="structure" file="page-lin.mkvi" level="style" name="definelinenumbering"> <cd:arguments> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 16cba5392..cb4dc61e3 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-context.xml b/tex/context/interface/mkiv/i-context.xml index ba09abcba..73bd3d4ae 100644 --- a/tex/context/interface/mkiv/i-context.xml +++ b/tex/context/interface/mkiv/i-context.xml @@ -116,6 +116,7 @@ <cd:interfacefile filename="i-language.xml"/> <cd:interfacefile filename="i-layer.xml"/> <cd:interfacefile filename="i-layout.xml"/> + <cd:interfacefile filename="i-linefiller.xml"/> <cd:interfacefile filename="i-linenumber.xml"/> <cd:interfacefile filename="i-lines.xml"/> <cd:interfacefile filename="i-linetable.xml"/> @@ -234,4 +235,4 @@ <cd:interfacefile filename="i-xml.xml"/> <cd:interfacefile filename="i-xtable.xml"/> -</cd:interface>
\ No newline at end of file +</cd:interface> diff --git a/tex/context/interface/mkiv/i-floats.xml b/tex/context/interface/mkiv/i-floats.xml index 0ecb99c16..ef68fe985 100644 --- a/tex/context/interface/mkiv/i-floats.xml +++ b/tex/context/interface/mkiv/i-floats.xml @@ -253,6 +253,7 @@ <cd:constant type="low"/> <cd:constant type="high"/> <cd:constant type="grid"/> + <cd:constant type="lines"/> <cd:constant type="overlay"/> <cd:constant type="inner"/> <cd:constant type="outer"/> diff --git a/tex/context/interface/mkiv/i-linefiller.xml b/tex/context/interface/mkiv/i-linefiller.xml new file mode 100644 index 000000000..d3d98f446 --- /dev/null +++ b/tex/context/interface/mkiv/i-linefiller.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?context-directive job ctxfile x-setups.ctx ?> + +<cd:interface xmlns:cd="http://www.pragma-ade.com/commands"> + + <cd:command name="definelinefiller" file="node-rul.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-name"/> + <cd:resolve name="keyword-name-optional"/> + <cd:assignments list="yes" optional="yes"> + <cd:inherit name="setuplinefiller"/> + </cd:assignments> + </cd:arguments> + </cd:command> + + <cd:command name="setuplinefiller" file="node-rul.mkiv"> + <cd:arguments> + <cd:resolve name="keyword-name-list-optional"/> + <cd:assignments list="yes"> + <cd:parameter name="location"> + <cd:constant type="left"/> + <cd:constant type="right"/> + <cd:constant type="both" default="yes"/> + </cd:parameter> + <cd:parameter name="scope"> + <cd:constant type="left"/> + <cd:constant type="right"/> + <cd:constant type="local" default="yes"/> + <cd:constant type="global"/> + </cd:parameter> + <cd:parameter name="color"> + <cd:constant type="cd:color"/> + </cd:parameter> + <cd:parameter name="height"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="depth"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="distance"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="threshold"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <cd:parameter name="rulethickness"> + <cd:constant type="cd:dimension"/> + </cd:parameter> + <!-- cd:parameter name="method"> + <cd:constant type="cd:number"/> + </cd:parameter --> + <cd:parameter name="textstyle"> + <cd:resolve name="value-style"/> + </cd:parameter> + <cd:parameter name="textcolor"> + <cd:constant type="cd:color"/> + </cd:parameter> + <cd:parameter name="align"> + <cd:inherit name="setupalign"/> + </cd:parameter> + <cd:parameter name="mp"> + <cd:constant type="cd:name"/> + </cd:parameter> + <cd:parameter name="before"> + <cd:constant type="cd:command"/> + </cd:parameter> + <cd:parameter name="after"> + <cd:constant type="cd:command"/> + </cd:parameter> + </cd:assignments> + </cd:arguments> + </cd:command> + + <cd:command name="filler" file="node-rul.mkiv"> + <cd:arguments> + <cd:content/> + </cd:arguments> + </cd:command> + +</cd:interface> diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 539507938..f7bfb2747 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 2362be049..6829fd982 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 : 04/13/18 14:53:48 +-- merge date : 04/15/18 23:11:48 do -- begin closure to overcome local limits and interference @@ -22705,10 +22705,10 @@ function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmne return dx,dy,nofregisteredcursives end function injections.setposition(kind,current,factor,rlmode,spec,injection) - local x=factor*spec[1] - local y=factor*spec[2] - local w=factor*spec[3] - local h=factor*spec[4] + local x=factor*(spec[1] or 0) + local y=factor*(spec[2] or 0) + local w=factor*(spec[3] or 0) + local h=factor*(spec[4] or 0) if x~=0 or w~=0 or y~=0 or h~=0 then local yoffset=y-h local leftkern=x @@ -24743,7 +24743,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou end return head,base end -local function multiple_glyphs(head,start,multiple,skiphash,what) +local function multiple_glyphs(head,start,multiple,skiphash,what,stop) local nofmultiples=#multiple if nofmultiples>0 then resetinjection(start) @@ -25278,6 +25278,13 @@ local function getmapping(dataset,sequence,currentlookup) return mapping end end +function chainprocs.gsub_remove(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) + if trace_chains then + logprocess("%s: removing character %s",cref(dataset,sequence,chainindex),gref(getchar(start))) + end + head,start=remove_node(head,start,true) + return head,getprev(start),true +end function chainprocs.gsub_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) local mapping=currentlookup.mapping if mapping==nil then @@ -25368,7 +25375,7 @@ function chainprocs.gsub_multiple(head,start,stop,dataset,sequence,currentlookup if trace_multiples then logprocess("%s: replacing %s by multiple characters %s",cref(dataset,sequence),gref(startchar),gref(replacement)) end - return multiple_glyphs(head,start,replacement,skiphash,dataset[1]) + return multiple_glyphs(head,start,replacement,skiphash,dataset[1],stop) end end return head,start,false @@ -25880,6 +25887,7 @@ local function chainrun(head,start,last,dataset,sequence,rlmode,skiphash,ck) logprocess("%s: %s is not yet supported (2)",cref(dataset,sequence),chainkind) end end + else end i=i+1 if i>size or not start then @@ -30058,7 +30066,7 @@ local function pdftovirtual(tfmdata,pdfshapes,kind) local hfactor=parameters.hfactor properties.virtualized=true tfmdata.fonts={ - { id=0 } + { id=0 } } local getactualtext=otf.getactualtext local storepdfdata=otf.storepdfdata @@ -30726,6 +30734,8 @@ local function addfeature(data,feature,specifications) if not subtype then subtype=lookup.type end + elseif v==0 then + lookups[k]={ { type="gsub_remove" } } else lookups[k]=false end |