diff options
Diffstat (limited to 'tex/context/base/mkiv/mlib-lmp.lua')
-rw-r--r-- | tex/context/base/mkiv/mlib-lmp.lua | 30 |
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 |