From a92a8d40ce567ecf5b0baacd9a93a94aac9a4a2d Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 16 Jul 2019 22:42:53 +0200 Subject: 2019-07-16 18:30:00 --- metapost/context/base/mpiv/mp-tool.mpiv | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'metapost/context/base/mpiv/mp-tool.mpiv') diff --git a/metapost/context/base/mpiv/mp-tool.mpiv b/metapost/context/base/mpiv/mp-tool.mpiv index cabdf9ab2..f1f31e5f0 100644 --- a/metapost/context/base/mpiv/mp-tool.mpiv +++ b/metapost/context/base/mpiv/mp-tool.mpiv @@ -895,9 +895,36 @@ enddef ; let normalwithcolor = withcolor ; def withcolor expr c = - normalwithcolor if string c : resolvedcolor(c) else : c fi + normalwithcolor if string c : resolvedcolor(c) else : c fi enddef ; +% I don't want a "withcolor black" in case of an empty string ... who knows +% how that can interfere with outer colors. Somehow the next one doesn't +% always work out ok, but why ... must be some parsing issue. Anyway, when +% we cannot do that, we need to fix some chem macros instead as empty strings +% now lead to black while everywhere else in context empty means: leave color +% untouched. + +% def withcolor expr c = +% if not string c : +% normalwithcolor c +% elseif c <> "" : +% normalwithcolor resolvedcolor(c) +% fi +% enddef ; + +% So why does this work better than the above: +% +% def withcolor expr c = +% if string c : +% if c <> "" : +% normalwithcolor resolvedcolor(c) +% fi +% else : +% normalwithcolor c +% fi +% enddef ; + vardef colortype expr c = if cmykcolor c : cmykcolor elseif rgbcolor c : rgbcolor -- cgit v1.2.3