From 2492300860bc8d58013520b5f27518e886d19216 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 16 Mar 2020 21:11:40 +0000 Subject: context (16mar20) git-svn-id: svn://tug.org/texlive/trunk@54364 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/context/base/mkiv/mlib-lmp.lua | 47 +++++++++++++--------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/tex/context/base/mkiv/mlib-lmp.lua') diff --git a/Master/texmf-dist/tex/context/base/mkiv/mlib-lmp.lua b/Master/texmf-dist/tex/context/base/mkiv/mlib-lmp.lua index 402c194fe34..f000f428245 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/mlib-lmp.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/mlib-lmp.lua @@ -142,7 +142,7 @@ if CONTEXTLMTXMODE > 0 then function mp.lmt_svg_include() local labelfile = metapost.getparameter { "labelfile" } - if labelfile then + if labelfile and labelfile ~= "" then local labels = table.load(labelfile) -- todo: same path as svg file if type(labels) == "table" then for i=1,#labels do @@ -160,28 +160,35 @@ if CONTEXTLMTXMODE > 0 then end return end + local colorfile = metapost.getparameter { "colormap" } + local colormap = false + if colorfile and colorfile ~= "" then + colormap = metapost.svgcolorremapper(colorfile) + end local filename = metapost.getparameter { "filename" } if filename and filename ~= "" then mpdirect ( metapost.svgtomp { - data = io.loaddata(filename), - remap = true, + data = io.loaddata(filename), + remap = true, + colormap = colormap, } ) - return - end - local buffer = metapost.getparameter { "buffer" } - if buffer then - mpdirect ( metapost.svgtomp { - data = buffers.getcontent(buffer), - -- remap = true, - } ) - return - end - local code = metapost.getparameter { "code" } - if code then - mpdirect ( metapost.svgtomp { - data = code, - } ) - return + else + local buffer = metapost.getparameter { "buffer" } + if buffer then + mpdirect ( metapost.svgtomp { + data = buffers.getcontent(buffer), + -- remap = true, + colormap = colormap, + } ) + else + local code = metapost.getparameter { "code" } + if code then + mpdirect ( metapost.svgtomp { + data = code, + colormap = colormap, + } ) + end + end end end @@ -213,3 +220,5 @@ if CONTEXTLMTXMODE > 0 then end end + +todecimal = xdecimal and xdecimal.new or tonumber -- bonus -- cgit v1.2.3