diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-07-16 22:42:53 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-07-16 22:42:53 +0200 |
commit | a92a8d40ce567ecf5b0baacd9a93a94aac9a4a2d (patch) | |
tree | 17f7038c1c3b353bc2130af87066676d49f87184 /metapost/context | |
parent | 4bc28891615011ed3581836e9259434720e25830 (diff) | |
download | context-a92a8d40ce567ecf5b0baacd9a93a94aac9a4a2d.tar.gz |
2019-07-16 18:30:00
Diffstat (limited to 'metapost/context')
-rw-r--r-- | metapost/context/base/mpiv/mp-chem.mpiv | 13 | ||||
-rw-r--r-- | metapost/context/base/mpiv/mp-tool.mpiv | 29 |
2 files changed, 40 insertions, 2 deletions
diff --git a/metapost/context/base/mpiv/mp-chem.mpiv b/metapost/context/base/mpiv/mp-chem.mpiv index 4ed9eaa8f..c5f79a88c 100644 --- a/metapost/context/base/mpiv/mp-chem.mpiv +++ b/metapost/context/base/mpiv/mp-chem.mpiv @@ -513,10 +513,21 @@ def chem_transformed (suffix $) = % not vardef! fi enddef ; +% vardef chem_draw (expr what, r, c) (text extra) = +% draw what +% withpen pencircle scaled r +% withcolor c +% extra ; +% enddef ; + vardef chem_draw (expr what, r, c) (text extra) = draw what withpen pencircle scaled r - withcolor c + if string c : + if c <> "" : withcolor c fi + else : + withcolor c + fi extra ; enddef ; 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 |