summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/mlib-lmp.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2019-10-01 11:01:50 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2019-10-01 11:01:50 +0200
commit7b12427f475e64e06f5dd7b537462b6d990526f6 (patch)
treec8b553e26752f0900f8f50241970bb5cdefd3938 /tex/context/base/mkiv/mlib-lmp.lua
parentfd8697791360a26a2b9cc888dbc125cefedfcd42 (diff)
downloadcontext-7b12427f475e64e06f5dd7b537462b6d990526f6.tar.gz
2019-10-01 10:44:00
Diffstat (limited to 'tex/context/base/mkiv/mlib-lmp.lua')
-rw-r--r--tex/context/base/mkiv/mlib-lmp.lua30
1 files changed, 21 insertions, 9 deletions
diff --git a/tex/context/base/mkiv/mlib-lmp.lua b/tex/context/base/mkiv/mlib-lmp.lua
index 22607be8d..dc130c2fd 100644
--- a/tex/context/base/mkiv/mlib-lmp.lua
+++ b/tex/context/base/mkiv/mlib-lmp.lua
@@ -6,10 +6,11 @@ if not modules then modules = { } end modules ['mlib-lmp'] = {
license = "see context related readme files",
}
-local aux = mp.aux
-local mpnumeric = aux.numeric
-local mppair = aux.pair
-local mpquoted = aux.quoted
+local aux = mp.aux
+local mpnumeric = aux.numeric
+local mppair = aux.pair
+local mpquoted = aux.quoted
+local mpdirect = aux.direct
-- todo: use a stack?
@@ -136,9 +137,20 @@ do
end
function mp.lmt_svg_include()
- local name = metapost.getparameter { "svg", "filename" }
- local mps = metapost.svgtomp {
- data = name and name ~= "" and io.loaddata(name) or "",
- }
- mp.direct(mps)
+ local filename = metapost.getparameter { "filename" }
+ local fontname = metapost.getparameter { "fontname" }
+ local metacode = nil
+ if fontname and fontname ~= "" then
+ local unicode = metapost.getparameter { "unicode" }
+ if unicode then
+ metacode = metapost.svgglyphtomp(fontname,math.round(unicode))
+ end
+ elseif filename and filename ~= "" then
+ metacode = metapost.svgtomp {
+ data = io.loaddata(filename)
+ }
+ end
+ if metacode then
+ mpdirect(metacode)
+ end
end