From 50928735daee408de73737b055b2535d96424824 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Mon, 18 Jul 2016 17:05:11 +0200 Subject: 2016-07-18 16:51:00 --- metapost/context/base/mpiv/mp-mlib.mpiv | 14 +++++++++----- metapost/context/base/mpiv/mp-tool.mpiv | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'metapost') diff --git a/metapost/context/base/mpiv/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv index 2b9b8bef6..75a6b51b9 100644 --- a/metapost/context/base/mpiv/mp-mlib.mpiv +++ b/metapost/context/base/mpiv/mp-mlib.mpiv @@ -1538,16 +1538,20 @@ def nofill text t = fill t withpostscript "collect" enddef ; % so we can do: withcolor "red" def resolvedcolor expr s = - % lua.mp.namedcolor(s) % conflicts with macro namedcolor - % lua.mp.NamedColor(s) % okay but, can also be - % lua.mp("NamedColor",s) % which gives expansion mess - runscript("mp.NamedColor('" & s & "')") % faster anyway + % lua.mp.namedcolor(s) % conflicts with macro namedcolor + % lua.mp.NamedColor(s) % okay but, can also be + % lua.mp("NamedColor",s) % which gives expansion mess + if string s : + runscript("mp.NamedColor('" & s & "')") % faster anyway + else : + s + fi enddef ; % A comment will end up on top of the graphic in the output. This can be handy for % locating a graphic: comment("test graphic"). -def comment(expr str) = +def comment expr str = special "metapost.comment[[" & str & "]]" ; enddef ; diff --git a/metapost/context/base/mpiv/mp-tool.mpiv b/metapost/context/base/mpiv/mp-tool.mpiv index 09cf24103..9e086f0df 100644 --- a/metapost/context/base/mpiv/mp-tool.mpiv +++ b/metapost/context/base/mpiv/mp-tool.mpiv @@ -1040,7 +1040,7 @@ primarydef p randomized s = ( ((uniformdeviate s) * p) fi elseif string p : - resolvedcolor(p) randomized s + (resolvedcolor(p)) randomized s else : p + uniformdeviate s fi -- cgit v1.2.3