From 236690a6367b25187d37013e1e7fc196c5c44eb8 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sat, 24 Sep 2016 13:11:46 +0200 Subject: 2016-09-24 12:45:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-ocl.lua | 60 +++++++++++++-------- tex/context/base/mkiv/math-noa.lua | 23 ++++++-- tex/context/base/mkiv/node-ini.lua | 7 +++ tex/context/base/mkiv/node-ser.lua | 40 +++++++++++++- tex/context/base/mkiv/status-files.pdf | Bin 21301 -> 21281 bytes tex/context/base/mkiv/status-lua.pdf | Bin 368027 -> 368082 bytes tex/context/base/mkiv/task-ini.lua | 4 +- tex/context/base/mkiv/trac-vis.lua | 13 ++++- tex/context/interface/mkiv/i-context.pdf | Bin 780164 -> 780132 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 60790 -> 60791 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 56 +++++++++++-------- 15 files changed, 159 insertions(+), 52 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 844e6862e..c1ec3f967 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{2016.09.23 10:13} +\newcontextversion{2016.09.24 12:40} %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 4dd632844..4f166f39e 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{2016.09.23 10:13} +\edef\contextversion{2016.09.24 12:40} %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 2ea69b2c9..506cf489f 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{2016.09.23 10:13} +\newcontextversion{2016.09.24 12:40} %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 dd73eb503..64587d1b2 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2016.09.23 10:13} +\edef\contextversion{2016.09.24 12:40} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua index 0e415d76a..65a1c6342 100644 --- a/tex/context/base/mkiv/font-ocl.lua +++ b/tex/context/base/mkiv/font-ocl.lua @@ -14,9 +14,6 @@ local round, max = math.round, math.round local formatters = string.formatters local tounicode = fonts.mappings.tounicode -local graytorgb = attributes.colors.graytorgb -local cmyktorgb = attributes.colors.cmyktorgb - local otf = fonts.handlers.otf local f_color = formatters["pdf:direct:%f %f %f rg"] @@ -50,28 +47,49 @@ end local sharedpalettes = { } -function otf.registerpalette(name,values) - sharedpalettes[name] = values - for i=1,#values do - local v = values[i] - local r, g, b - local s = v.s - if s then - r, g, b = graytorgb(s) - else - local c, m, y, k = v.c, v.m, v.y, v.k - if c or m or y or k then - r, g, b = cmyktorgb(c or 0,m or 0,y or 0,k or 0) +if context then + + local graytorgb = attributes.colors.graytorgb + local cmyktorgb = attributes.colors.cmyktorgb + + function otf.registerpalette(name,values) + sharedpalettes[name] = values + for i=1,#values do + local v = values[i] + local r, g, b + local s = v.s + if s then + r, g, b = graytorgb(s) else - r, g, b = v.r, v.g, v.b + local c, m, y, k = v.c, v.m, v.y, v.k + if c or m or y or k then + r, g, b = cmyktorgb(c or 0,m or 0,y or 0,k or 0) + else + r, g, b = v.r, v.g, v.b + end end + values[i] = { + max(r and round(r*255) or 0,255), + max(g and round(g*255) or 0,255), + max(b and round(b*255) or 0,255) + } end - values[i] = { - max(r and round(r*255) or 0,255), - max(g and round(g*255) or 0,255), - max(b and round(b*255) or 0,255) - } end + +else -- for generic + + function otf.registerpalette(name,values) + sharedpalettes[name] = values + for i=1,#values do + local v = values[i] + values[i] = { + max(round((v.r or 0)*255),255), + max(round((v.g or 0)*255),255), + max(round((v.b or 0)*255),255) + } + end + end + end local function initializecolr(tfmdata,kind,value) -- hm, always value diff --git a/tex/context/base/mkiv/math-noa.lua b/tex/context/base/mkiv/math-noa.lua index f27f3e00a..2b0d7b73f 100644 --- a/tex/context/base/mkiv/math-noa.lua +++ b/tex/context/base/mkiv/math-noa.lua @@ -1629,7 +1629,9 @@ function handlers.classes(head,style,penalties) return true end -registertracker("math.classes",function(v) tasks.setaction("math","noads.handlers.classes",v) end) +registertracker("math.classes",function(v) + tasks.setaction("math","noads.handlers.classes",v) +end) -- experimental @@ -1790,14 +1792,29 @@ do end - -- just for me function handlers.showtree(head,style,penalties) inspect(nodes.totree(head)) end -registertracker("math.showtree",function(v) tasks.setaction("math","noads.handlers.showtree",v) end) +registertracker("math.showtree",function(v) + tasks.setaction("math","noads.handlers.showtree",v) +end) + +-- also for me + +local applyvisuals = nuts.applyvisuals +local visual = false + +function handlers.makeup(head) + applyvisuals(tonut(head),visual) +end + +registertracker("math.makeup",function(v) + visual = v + tasks.setaction("math","noads.handlers.makeup",v) +end) -- the normal builder diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua index 1a9d141f4..65f76faea 100644 --- a/tex/context/base/mkiv/node-ini.lua +++ b/tex/context/base/mkiv/node-ini.lua @@ -90,6 +90,13 @@ local listcodes = mark(getsubtypes("list")) local rulecodes = mark(getsubtypes("rule")) +if not rulecodes[5] then + rulecodes[5] = "over" + rulecodes[6] = "under" + rulecodes[7] = "fraction" + rulecodes[8] = "radical" +end + -- local glyphcodes = allocate { -- [0] = "character", -- [1] = "glyph", diff --git a/tex/context/base/mkiv/node-ser.lua b/tex/context/base/mkiv/node-ser.lua index b00268828..847db7a15 100644 --- a/tex/context/base/mkiv/node-ser.lua +++ b/tex/context/base/mkiv/node-ser.lua @@ -26,6 +26,7 @@ local nodecodes = nodes.nodecodes local subtcodes = nodes.codes local noadcodes = nodes.noadcodes local getfields = nodes.fields +local nodekeys = nodes.keys local tonode = nodes.tonode @@ -105,7 +106,7 @@ nodes.ignorablefields = ignore local function astable(n,sparse) -- not yet ok, might get obsolete anyway n = tonode(n) - local f, t = getfields(n), { } + local f = getfields(n) for i=1,#f do local v = f[i] local d = n[v] @@ -258,3 +259,40 @@ function nodes.print(head,n) head = head.next end end + +-- quick hack, nicer is to have a proper expand per node type +-- already prepared + +local function apply(n,action) + while n do + action(n) + local id = n.id + if id == hlist_code or id == vlist_code then + apply(n.list,action) + end + n = n.next + end +end + +nodes.apply = apply + +local nuts = nodes.nuts +local getid = nuts.getid +local getlist = nuts.getlist +local getnext = nuts.getnext + +local function apply(n,action) + while n do + action(n) + local id = getid(n) + if id == hlist_code or id == vlist_code then + local list = getlist(n,action) + if list then + apply(list,action) + end + end + n = getnext(n) + end +end + +nuts.apply = apply diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index e6c10b894..6013ab1b8 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index b10df0d58..c2c701ecc 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua index 696a3b4a9..3f13ce0d7 100644 --- a/tex/context/base/mkiv/task-ini.lua +++ b/tex/context/base/mkiv/task-ini.lua @@ -108,8 +108,9 @@ appendaction("math", "normalizers", "noads.handlers.italics", nil, "no appendaction("math", "normalizers", "noads.handlers.classes", nil, "nohead") -- disabled appendaction("math", "builders", "builders.kernel.mlist_to_hlist") -- always on -------------("math", "builders", "noads.handlers.italics", nil, "nohead") -- disabled +------------("math", "builders", "noads.handlers.italics", nil, "nohead") -- disabled appendaction("math", "builders", "typesetters.directions.processmath") -- disabled (has to happen pretty late) +appendaction("math", "builders", "noads.handlers.makeup", nil, "nohead") -- disabled (has to happen last) appendaction("finalizers", "lists", "typesetters.paragraphs.normalize") -- moved here appendaction("finalizers", "lists", "typesetters.margins.localhandler") -- disabled @@ -200,6 +201,7 @@ disableaction("math", "noads.handlers.italics") disableaction("math", "noads.handlers.domains") disableaction("math", "noads.handlers.classes") disableaction("math", "noads.handlers.autofences") +disableaction("math", "noads.handlers.makeup") disableaction("math", "typesetters.directions.processmath") disableaction("mvlbuilders", "typesetters.margins.globalhandler") diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua index bffb1807c..ef73d2182 100644 --- a/tex/context/base/mkiv/trac-vis.lua +++ b/tex/context/base/mkiv/trac-vis.lua @@ -99,6 +99,7 @@ local insert_node_before = nuts.insert_before local insert_node_after = nuts.insert_after local traverse_nodes = nuts.traverse local linked_nodes = nuts.linked +local apply_to_nodes = nuts.apply local effectiveglue = nuts.effective_glue @@ -240,7 +241,7 @@ end local function setvisual(n,a,what,list) -- this will become more efficient when we have the bit lib linked in if not n or n == "reset" then return unsetvalue - elseif n == "makeup" then + elseif n == true or n == "makeup" then if not a or a == 0 or a == unsetvalue then a = preset_makeup else @@ -288,6 +289,16 @@ function nuts.setvisuals(n,mode) setattr(n,a_visual,setvisual(mode,getattr(n,a_visual),true,true)) end +function nuts.applyvisuals(n,mode) + local a = unsetvalue + if mode == true then + a = texgetattribute (a_visual) + elseif mode then + a = setvisual(mode) + end + apply_to_nodes(n,function(n) setattr(n,a_visual,a) end) +end + function nuts.copyvisual(n,m) setattr(n,a_visual,getattr(m,a_visual)) end diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index 73f85f451..34f77b0b3 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index e653ee5fd..85ee4bfd5 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c0b459689..c93d2b104 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 : 09/23/16 10:13:56 +-- merge date : 09/24/16 12:40:11 do -- begin closure to overcome local limits and interference @@ -23273,8 +23273,6 @@ local tostring,next,format=tostring,next,string.format local round,max=math.round,math.round local formatters=string.formatters local tounicode=fonts.mappings.tounicode -local graytorgb=attributes.colors.graytorgb -local cmyktorgb=attributes.colors.cmyktorgb local otf=fonts.handlers.otf local f_color=formatters["pdf:direct:%f %f %f rg"] local f_gray=formatters["pdf:direct:%f g"] @@ -23298,27 +23296,43 @@ else end end local sharedpalettes={} -function otf.registerpalette(name,values) - sharedpalettes[name]=values - for i=1,#values do - local v=values[i] - local r,g,b - local s=v.s - if s then - r,g,b=graytorgb(s) - else - local c,m,y,k=v.c,v.m,v.y,v.k - if c or m or y or k then - r,g,b=cmyktorgb(c or 0,m or 0,y or 0,k or 0) +if context then + local graytorgb=attributes.colors.graytorgb + local cmyktorgb=attributes.colors.cmyktorgb + function otf.registerpalette(name,values) + sharedpalettes[name]=values + for i=1,#values do + local v=values[i] + local r,g,b + local s=v.s + if s then + r,g,b=graytorgb(s) else - r,g,b=v.r,v.g,v.b + local c,m,y,k=v.c,v.m,v.y,v.k + if c or m or y or k then + r,g,b=cmyktorgb(c or 0,m or 0,y or 0,k or 0) + else + r,g,b=v.r,v.g,v.b + end end + values[i]={ + max(r and round(r*255) or 0,255), + max(g and round(g*255) or 0,255), + max(b and round(b*255) or 0,255) + } + end + end +else + function otf.registerpalette(name,values) + sharedpalettes[name]=values + for i=1,#values do + local v=values[i] + values[i]={ + max(round((v.r or 0)*255),255), + max(round((v.g or 0)*255),255), + max(round((v.b or 0)*255),255) + } end - values[i]={ - max(r and round(r*255) or 0,255), - max(g and round(g*255) or 0,255), - max(b and round(b*255) or 0,255) - } end end local function initializecolr(tfmdata,kind,value) -- cgit v1.2.3