diff options
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mpiv/mp-mlib.mpiv | 14 | ||||
-rw-r--r-- | metapost/context/base/mpiv/mp-tool.mpiv | 2 |
2 files changed, 10 insertions, 6 deletions
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 |