summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/trac-vis.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/trac-vis.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/trac-vis.lua68
1 files changed, 40 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/trac-vis.lua b/Master/texmf-dist/tex/context/base/mkiv/trac-vis.lua
index 4dc3bd03b02..e592b7d0c98 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/trac-vis.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/trac-vis.lua
@@ -7,10 +7,10 @@ if not modules then modules = { } end modules ['trac-vis'] = {
}
local node, nodes, attributes, fonts, tex = node, nodes, attributes, fonts, tex
-local type, tonumber, next = type, tonumber, next
+local type, tonumber, next, rawget = type, tonumber, next, rawget
local gmatch = string.gmatch
local formatters = string.formatters
-local compactfloat = number.compactfloat
+local round = math.round
-- This module started out in the early days of mkiv and luatex with visualizing
-- kerns related to fonts. In the process of cleaning up the visual debugger code it
@@ -388,11 +388,12 @@ local c_skip_b = "trace:m"
local c_glyph = "trace:o"
local c_ligature = "trace:s"
local c_white = "trace:w"
-local c_math = "trace:r"
+local c_math = "trace:s"
local c_origin = "trace:o"
local c_discretionary = "trace:d"
local c_expansion = "trace:o"
local c_depth = "trace:o"
+local c_indent = "trace:s"
local c_positive_d = "trace:db"
local c_negative_d = "trace:dr"
@@ -510,11 +511,11 @@ local glyphexpansion do
glyphexpansion = function(head,current)
local extra = getexpansion(current)
- if extra ~= 0 then
+ if extra and extra ~= 0 then
extra = extra / 1000
local info = f_cache[extra]
if not info then
- local text = hpack_string(compactfloat(extra,"%.1f"),usedfont)
+ local text = hpack_string(round(extra),usedfont)
local rule = new_rule(emwidth/fraction,exheight,2*exheight)
local list = getlist(text)
if extra > 0 then
@@ -548,7 +549,7 @@ local kernexpansion do
extra = extra / 1000
local info = f_cache[extra]
if not info then
- local text = hpack_string(compactfloat(extra,"%.1f"),usedfont)
+ local text = hpack_string(round(extra),usedfont)
local rule = new_rule(emwidth/fraction,exheight,4*exheight)
local list = getlist(text)
if extra > 0 then
@@ -779,12 +780,7 @@ local ruledbox do
setlink(info,next)
end
if prev and prev > 0 then
- -- if getid(prev) == gluespec_code then
- -- report_visualize("ignoring invalid prev")
- -- -- weird, how can this happen, an inline glue-spec, probably math
- -- else
- setlink(prev,info)
- -- end
+ setlink(prev,info)
end
if head == current then
return info, info
@@ -863,22 +859,25 @@ end
local ruledglue do
- local gluecodes = nodes.gluecodes
- local leadercodes = nodes.gluecodes
+ local gluecodes = nodes.gluecodes
+ local leadercodes = nodes.gluecodes
- local userskip_code = gluecodes.userskip
- local spaceskip_code = gluecodes.spaceskip
- local xspaceskip_code = gluecodes.xspaceskip
- local leftskip_code = gluecodes.leftskip
- local rightskip_code = gluecodes.rightskip
+ local userskip_code = gluecodes.userskip
+ local spaceskip_code = gluecodes.spaceskip
+ local xspaceskip_code = gluecodes.xspaceskip
+ local leftskip_code = gluecodes.leftskip
+ local rightskip_code = gluecodes.rightskip
+ local parfillskip_code = gluecodes.parfillskip
+ local indentskip_code = gluecodes.indentskip
+ local correctionskip_code = gluecodes.correctionskip
- local cleaders_code = leadercodes.cleaders
+ local cleaders_code = leadercodes.cleaders
local g_cache_v = caches["vglue"]
local g_cache_h = caches["hglue"]
local tags = {
- -- [gluecodes.userskip] = "US",
+ -- [userskip_code] = "US",
[gluecodes.lineskip] = "LS",
[gluecodes.baselineskip] = "BS",
[gluecodes.parskip] = "PS",
@@ -886,23 +885,29 @@ local ruledglue do
[gluecodes.belowdisplayskip] = "DB",
[gluecodes.abovedisplayshortskip] = "SA",
[gluecodes.belowdisplayshortskip] = "SB",
- [gluecodes.leftskip] = "LS",
- [gluecodes.rightskip] = "RS",
[gluecodes.topskip] = "TS",
[gluecodes.splittopskip] = "ST",
[gluecodes.tabskip] = "AS",
- [gluecodes.spaceskip] = "SP",
- [gluecodes.xspaceskip] = "XS",
- [gluecodes.parfillskip] = "PF",
+ [gluecodes.lefthangskip] = "LH",
+ [gluecodes.righthangskip] = "RH",
[gluecodes.thinmuskip] = "MS",
[gluecodes.medmuskip] = "MM",
[gluecodes.thickmuskip] = "ML",
+ [gluecodes.intermathskip] = "IM",
+ [gluecodes.mathskip] = "MT",
[leadercodes.leaders] = "NL",
[leadercodes.cleaders] = "CL",
[leadercodes.xleaders] = "XL",
[leadercodes.gleaders] = "GL",
-- true = "VS",
-- false = "HS",
+ [leftskip_code] = "LS",
+ [rightskip_code] = "RS",
+ [spaceskip_code] = "SP",
+ [xspaceskip_code] = "XS",
+ [parfillskip_code] = "PF",
+ [indentskip_code] = "IN",
+ [correctionskip_code] = "CS",
}
-- we sometimes pass previous as we can have issues in math (not watertight for all)
@@ -919,6 +924,8 @@ local ruledglue do
info = sometext(amount,l_glue,c_space)
elseif subtype == leftskip_code or subtype == rightskip_code then
info = sometext(amount,l_glue,c_skip_a)
+ elseif subtype == parfillskip_code or subtype == indentskip_code or subtype == correctionskip_code then
+ info = sometext(amount,l_glue,c_indent)
elseif subtype == userskip_code then
if width > 0 then
info = sometext(amount,l_glue,c_positive)
@@ -996,12 +1003,12 @@ local ruledkern do
local k_cache_v = caches["vkern"]
local k_cache_h = caches["hkern"]
- ruledkern = function(head,current,vertical)
+ ruledkern = function(head,current,vertical,mk)
local kern = getkern(current)
local cache = vertical and k_cache_v or k_cache_h
local info = cache[kern]
if not info then
- local amount = formatters["%s:%0.3f"](vertical and "VK" or "HK",kern*pt_factor)
+ local amount = formatters["%s:%0.3f"](vertical and "VK" or (mk and "MK") or "HK",kern*pt_factor)
if kern > 0 then
info = sometext(amount,l_kern,c_positive)
elseif kern < 0 then
@@ -1113,6 +1120,7 @@ do
local math_code = nodecodes.math
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
+ local marginkern_code = nodecodes.marginkern
local kerncodes = nodes.kerncodes
local fontkern_code = kerncodes.fontkern
@@ -1330,6 +1338,10 @@ do
if trace_math then
head, current = math(head,current)
end
+ elseif id == marginkern_code then
+ if trace_kern then
+ head, current = ruledkern(head,current,vertical,true)
+ end
end
goto next
::list::