summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/mlib-lmp.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/mlib-lmp.lmt')
-rw-r--r--tex/context/base/mkxl/mlib-lmp.lmt41
1 files changed, 41 insertions, 0 deletions
diff --git a/tex/context/base/mkxl/mlib-lmp.lmt b/tex/context/base/mkxl/mlib-lmp.lmt
index 61346bc73..a6d17dd2c 100644
--- a/tex/context/base/mkxl/mlib-lmp.lmt
+++ b/tex/context/base/mkxl/mlib-lmp.lmt
@@ -408,9 +408,14 @@ end
do
+ local getcount = tex.getcount
+
local mpprint = mp.print
local mpfprint = mp.fprint
+ local mpscaninteger = mp.scan.integer
+ local mpscannumber = mp.scan.number
+
local jobpositions = job.positions
local getwhd = jobpositions.whd
local getxy = jobpositions.xy
@@ -423,6 +428,14 @@ do
local getcolumn = jobpositions.column
local getmacro = tokens.getters.macro
+ local columnofpos = jobpositions.columnofpos
+ local getcolumndata = jobpositions.getcolumndata
+ -- local overlapping = jobpositions.overlapping
+ -- local onsamepage = jobpositions.onsamepage
+ -- local columnofpos = jobpositions.columnofpos
+
+ -- why not inject path directly
+
registerscript("positionpath", function()
local w, h, d = getwhd(scanstring())
if w then
@@ -450,6 +463,28 @@ do
end
end)
+ registerscript("positioncolumnbox", function()
+ local column = mpscaninteger()
+ local data = getcolumndata(getcount("realpageno"),column)
+ if data then
+ local x, y, w, h, d = data.x, data.y, data.w, data.h, data.d
+ mpfprint("((%p,%p)--(%p,%p)--(%p,%p)--(%p,%p)--cycle)",x,y-d,x+w,y-d,x+w,y+h,x,y+h)
+ else
+ mpprint("(0,0)--cycle")
+ end
+ end)
+
+ registerscript("overlaycolumnbox", function()
+ local column = mpscaninteger()
+ local data = getcolumndata(getcount("realpageno"),column)
+ if data then
+ local w, hd = data.w, data.h + data.d
+ mpfprint("((0,0)--(%p,0)--(%p,%p)--(0,%p)--cycle)",w,w,hd,hd)
+ else
+ mpprint("(0,0)--cycle")
+ end
+ end)
+
registerdirect("positionpage", function() return getpage (scanstring()) or 0 end)
registerdirect("positioncolumn", function() return getcolumn (scanstring()) or 0 end)
registerdirect("positionparagraph", function() return getparagraph(scanstring()) or 0 end)
@@ -460,6 +495,12 @@ do
registerdirect("positionx", function() injectpt (getx (scanstring())) end)
registerdirect("positiony", function() injectpt (gety (scanstring())) end)
+ registerdirect("positioncolumnatx", function()
+ local realpage = mpscaninteger()
+ local xposition = mpscannumber()
+ return columnofpos(realpage,xposition)
+ end)
+
end
do