summaryrefslogtreecommitdiff
path: root/tex/context/base/trac-vis.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-08-16 22:20:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-08-16 22:20:00 +0200
commitbc1e8c26c1c0596eb7410b522bff296fa6e7e2fc (patch)
tree82f6f25cd9d26e77a0c076cc1694e1d247f3cd19 /tex/context/base/trac-vis.lua
parent0dc23517ffebac8da38bbf8b4b8753d2a39848a7 (diff)
downloadcontext-bc1e8c26c1c0596eb7410b522bff296fa6e7e2fc.tar.gz
beta 2012.08.16 22:20
Diffstat (limited to 'tex/context/base/trac-vis.lua')
-rw-r--r--tex/context/base/trac-vis.lua31
1 files changed, 28 insertions, 3 deletions
diff --git a/tex/context/base/trac-vis.lua b/tex/context/base/trac-vis.lua
index 81994c38f..9349a2aac 100644
--- a/tex/context/base/trac-vis.lua
+++ b/tex/context/base/trac-vis.lua
@@ -41,6 +41,7 @@ local vlist_code = nodecodes.vlist
local glue_code = nodecodes.glue
local penalty_code = nodecodes.penalty
local whatsit_code = nodecodes.whatsit
+local user_code = nodecodes.user
local kerncodes = nodes.kerncodes
local font_kern_code = kerncodes.fontkern
@@ -121,6 +122,7 @@ local trace_penalty
local trace_fontkern
local trace_strut
local trace_whatsit
+local trace_user
local report_visualize = logs.reporter("visualize")
@@ -139,18 +141,19 @@ local modes = {
simplehbox = 1024 + 1,
simplevbox = 1024 + 2,
simplevtop = 1024 + 4,
+ user = 2048,
}
-- local modes_makeup = { "hbox", "vbox", "vtop", "kern", "glue", "penalty" }
-- local modes_boxes = { "hbox", "vbox", "vtop" }
--- local modes_all = { "hbox", "vbox", "vtop", "kern", "glue", "penalty", "fontkern", "whatsit", "glyph" }
+-- local modes_all = { "hbox", "vbox", "vtop", "kern", "glue", "penalty", "fontkern", "whatsit", "glyph", "user" }
local modes_makeup = { "hbox", "vbox", "kern", "glue", "penalty" }
local modes_boxes = { "hbox", "vbox" }
-local modes_all = { "hbox", "vbox", "kern", "glue", "penalty", "fontkern", "whatsit", "glyph" }
+local modes_all = { "hbox", "vbox", "kern", "glue", "penalty", "fontkern", "whatsit", "glyph", "user" }
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
+local l_penalty, l_glue, l_kern, l_fontkern, l_hbox, l_vbox, l_vtop, l_strut, l_whatsit, l_glyph, l_user
local enabled = false
local layers = { }
@@ -226,6 +229,7 @@ local function setvisual(n,a,what) -- this will become more efficient when we ha
l_strut = layers.strut
l_whatsit = layers.whatsit
l_glyph = layers.glyph
+ l_user = layers.user
nodes.tasks.enableaction("shipouts","nodes.visualizers.handler")
report_visualize("enabled")
enabled = true
@@ -354,6 +358,20 @@ local function whatsit(head,current)
return head, current
end
+local function user(head,current)
+ local what = current.subtype
+ local info = w_cache[what]
+ if info then
+ -- print("hit user")
+ else
+ local info = sometext(format("U:%s",what),usedfont)
+ set_attribute(info,a_layer,l_user)
+ w_cache[what] = info
+ end
+ head, current = insert_after(head,current,copy_list(info))
+ return head, current
+end
+
local b_cache = { }
local function ruledbox(head,current,vertical,layer,what,simple)
@@ -640,6 +658,7 @@ local function visualize(head,vertical)
local trace_whatsit = false
local trace_glyph = false
local trace_simple = false
+ local trace_user = false
local current = head
local prev_trace_fontkern = nil
local attr = unsetvalue
@@ -660,6 +679,7 @@ local function visualize(head,vertical)
trace_whatsit = false
trace_glyph = false
trace_simple = false
+ trace_user = false
else -- dead slow:
trace_hbox = hasbit(a, 1)
trace_vbox = hasbit(a, 2)
@@ -672,6 +692,7 @@ local function visualize(head,vertical)
trace_whatsit = hasbit(a, 256)
trace_glyph = hasbit(a, 512)
trace_simple = hasbit(a,1024)
+ trace_user = hasbit(a,2048)
end
attr = a
end
@@ -745,6 +766,10 @@ local function visualize(head,vertical)
if trace_whatsit then
head, current = whatsit(head,current)
end
+ elseif id == user_code then
+ if trace_whatsit then
+ head, current = user(head,current)
+ end
end
current = current.next
end