summaryrefslogtreecommitdiff
path: root/tex/context/base/mlib-lua.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-04-09 21:15:05 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-04-09 21:15:05 +0200
commit25fc028ca9e811187704cf2de2ba0d0bb9846b67 (patch)
treebbe5b4c41653a84aa4f90b922b8fb5bce69853e2 /tex/context/base/mlib-lua.lua
parentaf96a3c293d017f5469b14513bdcce9482b3695a (diff)
downloadcontext-25fc028ca9e811187704cf2de2ba0d0bb9846b67.tar.gz
2015-04-09 20:58:00
Diffstat (limited to 'tex/context/base/mlib-lua.lua')
-rw-r--r--tex/context/base/mlib-lua.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/tex/context/base/mlib-lua.lua b/tex/context/base/mlib-lua.lua
index 7d95e1b37..392fc1a3c 100644
--- a/tex/context/base/mlib-lua.lua
+++ b/tex/context/base/mlib-lua.lua
@@ -348,3 +348,35 @@ function metapost.initializescriptrunner(mpx,trialrun)
end
-- trace_enabled = not trialrun blocks too much
end
+
+-- texts:
+
+local factor = 65536*(7227/7200)
+local textexts = nil
+local mptriplet = mp.triplet
+
+function mp.tt_initialize(tt)
+ textexts = tt
+end
+
+-- function mp.tt_wd(n)
+-- local box = textexts and textexts[n]
+-- mpprint(box and box.width/factor or 0)
+-- end
+-- function mp.tt_ht(n)
+-- local box = textexts and textexts[n]
+-- mpprint(box and box.height/factor or 0)
+-- end
+-- function mp.tt_dp(n)
+-- local box = textexts and textexts[n]
+-- mpprint(box and box.depth/factor or 0)
+-- end
+
+function mp.tt_dimensions(n)
+ local box = textexts and textexts[n]
+ if box then
+ mptriplet(box.width/factor,box.height/factor,box.depth/factor)
+ else
+ mptriplet(0,0,0)
+ end
+end