summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/trac-vis.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/trac-vis.lmt')
-rw-r--r--tex/context/base/mkxl/trac-vis.lmt191
1 files changed, 97 insertions, 94 deletions
diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt
index 38078f08d..6f59d0e7f 100644
--- a/tex/context/base/mkxl/trac-vis.lmt
+++ b/tex/context/base/mkxl/trac-vis.lmt
@@ -136,7 +136,7 @@ local modes = {
space = 0x0040000,
depth = 0x0080000,
marginkern = 0x0100000,
- mathlistkern = 0x0200000,
+ mathkern = 0x0200000,
dir = 0x0400000,
par = 0x0800000,
mathglue = 0x1000000,
@@ -147,7 +147,7 @@ local modes = {
visualizers.modes = modes
local usedfont, exheight, emwidth
-local l_penalty, l_glue, l_kern, l_fontkern, l_hbox, l_vbox, l_vtop, l_strut, l_whatsit, l_glyph, l_user, l_math, l_marginkern, l_mathlistkern, l_italic, l_origin, l_discretionary, l_expansion, l_line, l_space, l_depth,
+local l_penalty, l_glue, l_kern, l_fontkern, l_hbox, l_vbox, l_vtop, l_strut, l_whatsit, l_glyph, l_user, l_math, l_marginkern, l_mathkern, l_italic, l_origin, l_discretionary, l_expansion, l_line, l_space, l_depth,
l_dir, l_whatsit, l_mark, l_insert
local enabled = false
@@ -157,7 +157,7 @@ local preset_boxes = modes.hbox + modes.vbox + modes.vtop + modes.origin
local preset_makeup = preset_boxes
+ modes.kern + modes.glue + modes.penalty
local preset_all = preset_makeup
- + modes.fontkern + modes.marginkern + modes.mathlistkern
+ + modes.fontkern + modes.marginkern + modes.mathkern
+ modes.whatsit + modes.glyph + modes.user + modes.math
+ modes.dir + modes.whatsit + modes.mathglue
+ modes.mark + modes.insert
@@ -206,7 +206,7 @@ local function initialize()
l_math = layers.math
l_italic = layers.italic
l_marginkern = layers.marginkern
- l_mathlistkern = layers.mathlistkern
+ l_mathkern = layers.mathkern
l_origin = layers.origin
l_discretionary = layers.discretionary
l_expansion = layers.expansion
@@ -428,12 +428,12 @@ end
local caches = setmetatableindex("table")
-local fontkern, italickern, marginkern, mathlistkern do
+local fontkern, italickern, marginkern, mathkern do
local f_cache = caches["fontkern"]
local i_cache = caches["italickern"]
local m_cache = caches["marginkern"]
- local l_cache = caches["mathlistkern"]
+ local l_cache = caches["mathkern"]
local function somekern(head,current,cache,color,layer)
local width = getkern(current)
@@ -475,8 +475,8 @@ local fontkern, italickern, marginkern, mathlistkern do
return somekern(head,current,m_cache,"trace:do",l_marginkern)
end
- mathlistkern = function(head,current)
- return somekern(head,current,l_cache,"trace:do",l_mathlistkern)
+ mathkern = function(head,current)
+ return somekern(head,current,l_cache,"trace:do",l_mathkern)
end
end
@@ -1128,15 +1128,15 @@ end
local ruledkern do
- local k_cache_v = caches["vkern"]
- local k_cache_h = caches["hkern"]
+ local v_cache = caches["vkern"]
+ local h_cache = caches["hkern"]
- ruledkern = function(head,current,vertical,mk)
+ ruledkern = function(head,current,vertical)
local kern = getkern(current)
- local cache = vertical and k_cache_v or k_cache_h
+ local cache = vertical and v_cache or h_cache
local info = cache[kern]
if not info then
- local amount = formatters["%s:%0.3f"](vertical and "VK" or (mk and "MK") or "HK",kern*pt_factor)
+ local amount = formatters["%s:%0.3f"](vertical and "VK" or "HK",kern*pt_factor)
if kern > 0 then
info = sometext(amount,l_kern,"trace:b")
elseif kern < 0 then
@@ -1183,13 +1183,16 @@ end
local ruledmarginkern do
- local m_cache = caches["marginkern"]
+ local l_cache = caches["leftmarginkern"]
+ local r_cache = caches["rightmarginkern"]
- ruledmarginkern = function(head,current)
- local kern = getkern(current)
- local info = m_cache[kern]
+ ruledmarginkern = function(head,current,subtype)
+ local kern = getkern(current)
+ local left = subtype == leftmarginkern_code
+ local cache = left and l_cache or r_cache
+ local info = cache[kern]
if not info then
- local amount = formatters["%s:%0.3f"]("MK",kern*pt_factor)
+ local amount = formatters["%s:%0.3f"](left and "ML" or "MR",kern*pt_factor)
if kern > 0 then
info = sometext(amount,l_marginkern,"trace:b")
elseif kern < 0 then
@@ -1197,7 +1200,7 @@ local ruledmarginkern do
else
info = sometext(amount,l_marginkern,"trace:g")
end
- m_cache[kern] = info
+ cache[kern] = info
end
info = copylist(info)
head, current = insertnodebefore(head,current,info)
@@ -1206,23 +1209,26 @@ local ruledmarginkern do
end
-local ruledmathlistkern do
+local ruledmathkern do
- local l_cache = caches["mathlistkern"]
+ local h_cache = caches["horizontalmathkern"]
+ local v_cache = caches["verticalmathkern"]
- ruledmathlistkern = function(head,current)
- local kern = getkern(current)
- local info = l_cache[kern]
+ ruledmathkern = function(head,current,subtype)
+ local kern = getkern(current)
+ local vertical = subtype == verticalmathkern_code
+ local cache = vertical and v_cache or h_cache
+ local info = cache[kern]
if not info then
- local amount = formatters["%s:%0.3f"]("LK",kern*pt_factor)
+ local amount = formatters["%s:%0.3f"](vertical and "MV" or "MH",kern*pt_factor)
if kern > 0 then
- info = sometext(amount,l_mathlistkern,"trace:b")
+ info = sometext(amount,l_mathkern,"trace:b")
elseif kern < 0 then
- info = sometext(amount,l_mathlistkern,"trace:r")
+ info = sometext(amount,l_mathkern,"trace:r")
else
- info = sometext(amount,l_mathlistkern,"trace:g")
+ info = sometext(amount,l_mathkern,"trace:g")
end
- l_cache[kern] = info
+ cache[kern] = info
end
info = copylist(info)
head, current = insertnodebefore(head,current,info)
@@ -1294,48 +1300,47 @@ end
do
- local nodecodes = nodes.nodecodes
- local disc_code = nodecodes.disc
- local kern_code = nodecodes.kern
- local glyph_code = nodecodes.glyph
- local glue_code = nodecodes.glue
- local penalty_code = nodecodes.penalty
- local whatsit_code = nodecodes.whatsit
- local user_code = nodecodes.user
- local math_code = nodecodes.math
- local hlist_code = nodecodes.hlist
- local vlist_code = nodecodes.vlist
- local marginkern_code = nodecodes.marginkern
- local mathlistkern_code = nodecodes.mathlistkern
- local dir_code = nodecodes.dir
- local par_code = nodecodes.par
- local mark_code = nodecodes.mark
- local insert_code = nodecodes.insert
-
- local kerncodes = nodes.kerncodes
- local fontkern_code = kerncodes.fontkern
- local italickern_code = kerncodes.italiccorrection
- local leftmarginkern_code = kerncodes.leftmarginkern
- local rightmarginkern_code = kerncodes.rightmarginkern
- local mathlistkern_code = kerncodes.mathlistkern
- ----- userkern_code = kerncodes.userkern
-
- local skipcodes = nodes.skipcodes
- local spaceskip_code = skipcodes.spaceskip
- local xspaceskip_code = skipcodes.xspaceskip
- local zerospaceskip_code = skipcodes.zerospaceskip
- local intermathskip_code = skipcodes.intermathskip
-
- local listcodes = nodes.listcodes
- local linelist_code = listcodes.line
-
- local vtop_package_state = 3 -- todo: symbolic
-
- local getleader = nuts.getleader
- local getdisc = nuts.getdisc
-
- local setleader = nuts.setleader
- local setdisc = nuts.setdisc
+ local nodecodes = nodes.nodecodes
+ local disc_code = nodecodes.disc
+ local kern_code = nodecodes.kern
+ local glyph_code = nodecodes.glyph
+ local glue_code = nodecodes.glue
+ local penalty_code = nodecodes.penalty
+ local whatsit_code = nodecodes.whatsit
+ local user_code = nodecodes.user
+ local math_code = nodecodes.math
+ local hlist_code = nodecodes.hlist
+ local vlist_code = nodecodes.vlist
+ local dir_code = nodecodes.dir
+ local par_code = nodecodes.par
+ local mark_code = nodecodes.mark
+ local insert_code = nodecodes.insert
+
+ local kerncodes = nodes.kerncodes
+ local fontkern_code = kerncodes.fontkern
+ local italickern_code = kerncodes.italiccorrection
+ local leftmarginkern_code = kerncodes.leftmarginkern
+ local rightmarginkern_code = kerncodes.rightmarginkern
+ local horizontalmathkern_code = kerncodes.horizontalmathkern
+ local verticalmathkern_code = kerncodes.verticalmathkern
+ ----- userkern_code = kerncodes.userkern
+
+ local skipcodes = nodes.skipcodes
+ local spaceskip_code = skipcodes.spaceskip
+ local xspaceskip_code = skipcodes.xspaceskip
+ local zerospaceskip_code = skipcodes.zerospaceskip
+ local intermathskip_code = skipcodes.intermathskip
+
+ local listcodes = nodes.listcodes
+ local linelist_code = listcodes.line
+
+ local vtop_package_state = 3 -- todo: symbolic
+
+ local getleader = nuts.getleader
+ local getdisc = nuts.getdisc
+
+ local setleader = nuts.setleader
+ local setdisc = nuts.setdisc
-- local cache
@@ -1353,6 +1358,8 @@ do
local trace_simple = false
local trace_user = false
local trace_math = false
+ local trace_mathkern = false
+ local trace_marginkern = false
local trace_italic = false
local trace_origin = false
local trace_discretionary = false
@@ -1362,7 +1369,7 @@ do
local trace_depth = false
local trace_dir = false
local trace_par = false
- local trace_math_glue = false
+ local trace_mathglue = false
local trace_mark = false
local trace_insert = false
local current = head
@@ -1370,8 +1377,6 @@ do
local attr = unsetvalue
local prev_trace_fontkern = nil
local prev_trace_italic = nil
- local prev_trace_marginkern = nil
- -- local prev_trace_mathlist = nil
local prev_trace_expansion = nil
while current do
@@ -1379,11 +1384,9 @@ do
local a = forced or getattr(current,a_visual) or unsetvalue
local subtype, content
if a ~= attr then
- prev_trace_fontkern = trace_fontkern
- prev_trace_italic = trace_italic
- prev_trace_marginkern = trace_marginkern
- -- prev_trace_mathlistkern = trace_mathlistkern
- prev_trace_expansion = trace_expansion
+ prev_trace_fontkern = trace_fontkern
+ prev_trace_italic = trace_italic
+ prev_trace_expansion = trace_expansion
attr = a
if a == unsetvalue then
trace_hbox = false
@@ -1407,10 +1410,10 @@ do
trace_space = false
trace_depth = false
trace_marginkern = false
- trace_mathlistkern = false
+ trace_mathkern = false
trace_dir = false
trace_par = false
- trace_math_glue = false
+ trace_mathglue = false
trace_mark = false
trace_insert = false
if id == kern_code then
@@ -1441,10 +1444,10 @@ do
trace_space = a & 0x0040000 ~= 0
trace_depth = a & 0x0080000 ~= 0
trace_marginkern = a & 0x0100000 ~= 0
- trace_mathlistkern = a & 0x0200000 ~= 0
+ trace_mathkern = a & 0x0200000 ~= 0
trace_dir = a & 0x0400000 ~= 0
trace_par = a & 0x0800000 ~= 0
- trace_math_glue = a & 0x1000000 ~= 0
+ trace_mathglue = a & 0x1000000 ~= 0
trace_mark = a & 0x2000000 ~= 0
trace_insert = a & 0x4000000 ~= 0
end
@@ -1497,10 +1500,6 @@ do
if trace_math then
head, current = ruledmath(head,current)
end
- elseif id == marginkern_code then
- if trace_kern then
- head, current = ruledkern(head,current,vertical,true)
- end
elseif id == dir_code then
if trace_dir then
head, current = ruleddir(head,current)
@@ -1532,7 +1531,7 @@ do
head, current = ruledspace(head,current,parent)
end
elseif subtype == intermathskip_code then
- if trace_math or trace_math_glue then
+ if trace_math or trace_mathglue then
head = ruledmathglue(head,current,parent)
end
end
@@ -1554,16 +1553,20 @@ do
head, current = ruleditalic(head,current)
end
elseif subtype == leftmarginkern_code or subtype == rightmarginkern_code then
- if trace_marginkern or prev_trace_marginkern then
+ if trace_marginkern then
head, current = marginkern(head,current)
elseif trace_kern then
- head, current = ruledmarginkern(head,current)
+ head, current = ruledmarginkern(head,current,subtype)
+ end
+ elseif subtype == verticalmathkern_code then
+ if trace_mathkern or trace_kern then
+ head, current = ruledmathkern(head,current,subtype)
end
- elseif subtype == mathlistkern_code then
- if trace_mathlist then -- or prev_trace_mathlist then
- head, current = mathlistkern(head,current)
+ elseif subtype == horizontalmathkern_code then
+ if trace_mathkern then
+ head, current = mathkern(head,current)
elseif trace_kern then
- head, current = ruledmathlistkern(head,current)
+ head, current = ruledmarginkern(head,current,subtype)
end
else
if trace_kern then