summaryrefslogtreecommitdiff
path: root/metapost/context/base/mpiv/mp-tool.mpiv
diff options
context:
space:
mode:
Diffstat (limited to 'metapost/context/base/mpiv/mp-tool.mpiv')
-rw-r--r--metapost/context/base/mpiv/mp-tool.mpiv29
1 files changed, 28 insertions, 1 deletions
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