summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2022-11-14 23:18:10 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2022-11-14 23:18:10 +0100
commit08473f11287cb263079c0435068312cbc6d736e8 (patch)
tree2548fb8b58e18a507e54fa8426a79c6956c3ef2e /metapost
parentdd0a80e5ec42f60832e7d5dc47210e6f3545c400 (diff)
downloadcontext-08473f11287cb263079c0435068312cbc6d736e8.tar.gz
2022-11-14 22:56:00
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mpxl/mp-lmtx.mpxl63
1 files changed, 63 insertions, 0 deletions
diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl
index acf3dcbef..f26af8a60 100644
--- a/metapost/context/base/mpxl/mp-lmtx.mpxl
+++ b/metapost/context/base/mpxl/mp-lmtx.mpxl
@@ -2614,3 +2614,66 @@ vardef lmt_do_matrix =
popparameters
)
enddef ;
+
+% This might move to its own module if we add more:
+
+presetparameters "glyphshape" [
+ % id = "",
+ % character = "",
+ shape = true,
+ boundingbox = false,
+ baseline = false,
+ usedline = true,
+ usedbox = true,
+] ;
+
+def lmt_glyphshape = applyparameters "glyphshape" "lmt_do_glyphshape" enddef ;
+
+vardef glyphshape_start(expr id, character) =
+ lua.mp.lmt_glyphshape_start(id, character) ;
+enddef ;
+
+vardef glyphshape_stop = lua.mp.lmt_glyphshape_stop() ; enddef ;
+vardef glyphshape_n = lua.mp.lmt_glyphshape_n() enddef ;
+vardef glyphshape_path(expr i) = lua.mp.lmt_glyphshape_path(i) enddef ;
+vardef glyphshape_boundingbox = lua.mp.lmt_glyphshape_boundingbox() enddef ;
+vardef glyphshape_baseline = lua.mp.lmt_glyphshape_baseline() enddef ;
+vardef glyphshape_usedbox = lua.mp.lmt_glyphshape_usedbox() enddef ;
+vardef glyphshape_usedline = lua.mp.lmt_glyphshape_usedline() enddef ;
+vardef glyphshape_width = lua.mp.lmt_glyphshape_width() enddef ;
+vardef glyphshape_height = lua.mp.lmt_glyphshape_height() enddef ;
+vardef glyphshape_depth = lua.mp.lmt_glyphshape_depth() enddef ;
+vardef glyphshape_italic = lua.mp.lmt_glyphshape_italic() enddef ;
+vardef glyphshape_accent = lua.mp.lmt_glyphshape_accent() enddef ;
+
+vardef lmt_do_glyphshape =
+ image (
+ pushparameters "glyphshape" ;
+ lua.mp.lmt_glyphshape_start(getparameter "id", getparameter "character") ;
+ if getparameter "shape" :
+ draw for i=1 upto lua.mp.lmt_glyphshape_n() :
+ lua.mp.lmt_glyphshape_path(i) &&
+ endfor cycle ;
+ fi ;
+ if getparameter "boundingbox" :
+ draw
+ lua.mp.lmt_glyphshape_boundingbox()
+ withcolor red
+ ;
+ fi ;
+ if getparameter "usedline" :
+ draw
+ lua.mp.lmt_glyphshape_usedline()
+ withcolor green
+ ;
+ fi ;
+ if getparameter "usedbox" :
+ draw
+ lua.mp.lmt_glyphshape_usedbox()
+ withcolor blue
+ ;
+ fi ;
+ lua.mp.lmt_glyphshape_stop() ;
+ popparameters ;
+ )
+enddef ;