summaryrefslogtreecommitdiff
path: root/metapost/context/base
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-05-17 19:31:15 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-05-17 19:31:15 +0200
commit2017d30b4ca772c8eeac4fc0eb9b54e547a9a1d8 (patch)
treed96df31f305a095c078ea5fb9f639ca34ac36c12 /metapost/context/base
parent53ff76b73cd1f373ecdfb0f7f17df6f352621d6e (diff)
downloadcontext-2017d30b4ca772c8eeac4fc0eb9b54e547a9a1d8.tar.gz
2016-05-17 19:25:00
Diffstat (limited to 'metapost/context/base')
-rw-r--r--metapost/context/base/common/metafun.mp (renamed from metapost/context/base/metafun.mp)0
-rw-r--r--metapost/context/base/common/mp-back.mp5
-rw-r--r--metapost/context/base/common/mp-fobg.mp5
-rw-r--r--metapost/context/base/common/mp-symb.mp6
-rw-r--r--metapost/context/base/mpii/metafun.mpii (renamed from metapost/context/base/metafun.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-back.mpii (renamed from metapost/context/base/mp-back.mp)0
-rw-r--r--metapost/context/base/mpii/mp-base.mpii (renamed from metapost/context/base/mp-base.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-butt.mpii (renamed from metapost/context/base/mp-butt.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-char.mpii (renamed from metapost/context/base/mp-char.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-core.mpii (renamed from metapost/context/base/mp-core.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-figs.mpii (renamed from metapost/context/base/mp-figs.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-fobg.mpii (renamed from metapost/context/base/mp-fobg.mp)0
-rw-r--r--metapost/context/base/mpii/mp-form.mpii (renamed from metapost/context/base/mp-form.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-func.mpii (renamed from metapost/context/base/mp-func.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-grid.mpii (renamed from metapost/context/base/mp-grid.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-grph.mpii (renamed from metapost/context/base/mp-grph.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-page.mpii (renamed from metapost/context/base/mp-page.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-shap.mpii (renamed from metapost/context/base/mp-shap.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-spec.mpii (renamed from metapost/context/base/mp-spec.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-step.mpii (renamed from metapost/context/base/mp-step.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-text.mpii (renamed from metapost/context/base/mp-text.mpii)0
-rw-r--r--metapost/context/base/mpii/mp-tool.mpii (renamed from metapost/context/base/mp-tool.mpii)2
-rw-r--r--metapost/context/base/mpii/mp-txts.mpii (renamed from metapost/context/base/mp-txts.mpii)0
-rw-r--r--metapost/context/base/mpiv/metafun.mpiv (renamed from metapost/context/base/metafun.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-abck.mpiv (renamed from metapost/context/base/mp-abck.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-apos.mpiv (renamed from metapost/context/base/mp-apos.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-asnc.mpiv (renamed from metapost/context/base/mp-asnc.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-back.mpiv205
-rw-r--r--metapost/context/base/mpiv/mp-bare.mpiv (renamed from metapost/context/base/mp-bare.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-base.mpiv (renamed from metapost/context/base/mp-base.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-butt.mpiv (renamed from metapost/context/base/mp-butt.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-char.mpiv (renamed from metapost/context/base/mp-char.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-chem.mpiv (renamed from metapost/context/base/mp-chem.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-core.mpiv (renamed from metapost/context/base/mp-core.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-cows.mpiv156
-rw-r--r--metapost/context/base/mpiv/mp-crop.mpiv (renamed from metapost/context/base/mp-crop.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-figs.mpiv (renamed from metapost/context/base/mp-figs.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-fobg.mpiv87
-rw-r--r--metapost/context/base/mpiv/mp-form.mpiv (renamed from metapost/context/base/mp-form.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-func.mpiv (renamed from metapost/context/base/mp-func.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-grap.mpiv (renamed from metapost/context/base/mp-grap.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-grid.mpiv (renamed from metapost/context/base/mp-grid.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-grph.mpiv (renamed from metapost/context/base/mp-grph.mpiv)177
-rw-r--r--metapost/context/base/mpiv/mp-idea.mpiv (renamed from metapost/context/base/mp-idea.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-luas.mpiv (renamed from metapost/context/base/mp-luas.mpiv)4
-rw-r--r--metapost/context/base/mpiv/mp-mlib.mpiv (renamed from metapost/context/base/mp-mlib.mpiv)269
-rw-r--r--metapost/context/base/mpiv/mp-page.mpiv (renamed from metapost/context/base/mp-page.mpiv)31
-rw-r--r--metapost/context/base/mpiv/mp-shap.mpiv (renamed from metapost/context/base/mp-shap.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-step.mpiv (renamed from metapost/context/base/mp-step.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-symb.mpiv (renamed from metapost/context/base/mp-symb.mp)0
-rw-r--r--metapost/context/base/mpiv/mp-text.mpiv (renamed from metapost/context/base/mp-text.mpiv)0
-rw-r--r--metapost/context/base/mpiv/mp-tool.mpiv (renamed from metapost/context/base/mp-tool.mpiv)156
52 files changed, 1025 insertions, 78 deletions
diff --git a/metapost/context/base/metafun.mp b/metapost/context/base/common/metafun.mp
index ae0a6d6fd..ae0a6d6fd 100644
--- a/metapost/context/base/metafun.mp
+++ b/metapost/context/base/common/metafun.mp
diff --git a/metapost/context/base/common/mp-back.mp b/metapost/context/base/common/mp-back.mp
new file mode 100644
index 000000000..ecfb0c816
--- /dev/null
+++ b/metapost/context/base/common/mp-back.mp
@@ -0,0 +1,5 @@
+if known mplib :
+ input mp-back.mpiv
+else :
+ input mp-back.mpii
+fi ;
diff --git a/metapost/context/base/common/mp-fobg.mp b/metapost/context/base/common/mp-fobg.mp
new file mode 100644
index 000000000..b61ea4724
--- /dev/null
+++ b/metapost/context/base/common/mp-fobg.mp
@@ -0,0 +1,5 @@
+if known mplib :
+ input mp-fobg.mpiv
+else :
+ input mp-fobg.mpii
+fi ;
diff --git a/metapost/context/base/common/mp-symb.mp b/metapost/context/base/common/mp-symb.mp
new file mode 100644
index 000000000..b39ceaab7
--- /dev/null
+++ b/metapost/context/base/common/mp-symb.mp
@@ -0,0 +1,6 @@
+if known mplib :
+ input mp-symb.mpiv
+else :
+ input mp-symb.mpii
+fi ;
+
diff --git a/metapost/context/base/metafun.mpii b/metapost/context/base/mpii/metafun.mpii
index 9c55191f7..9c55191f7 100644
--- a/metapost/context/base/metafun.mpii
+++ b/metapost/context/base/mpii/metafun.mpii
diff --git a/metapost/context/base/mp-back.mp b/metapost/context/base/mpii/mp-back.mpii
index f588adea9..f588adea9 100644
--- a/metapost/context/base/mp-back.mp
+++ b/metapost/context/base/mpii/mp-back.mpii
diff --git a/metapost/context/base/mp-base.mpii b/metapost/context/base/mpii/mp-base.mpii
index 7af4bc436..7af4bc436 100644
--- a/metapost/context/base/mp-base.mpii
+++ b/metapost/context/base/mpii/mp-base.mpii
diff --git a/metapost/context/base/mp-butt.mpii b/metapost/context/base/mpii/mp-butt.mpii
index 107886bb5..107886bb5 100644
--- a/metapost/context/base/mp-butt.mpii
+++ b/metapost/context/base/mpii/mp-butt.mpii
diff --git a/metapost/context/base/mp-char.mpii b/metapost/context/base/mpii/mp-char.mpii
index 63a71eff8..63a71eff8 100644
--- a/metapost/context/base/mp-char.mpii
+++ b/metapost/context/base/mpii/mp-char.mpii
diff --git a/metapost/context/base/mp-core.mpii b/metapost/context/base/mpii/mp-core.mpii
index 33e9b386e..33e9b386e 100644
--- a/metapost/context/base/mp-core.mpii
+++ b/metapost/context/base/mpii/mp-core.mpii
diff --git a/metapost/context/base/mp-figs.mpii b/metapost/context/base/mpii/mp-figs.mpii
index d4fcc2b35..d4fcc2b35 100644
--- a/metapost/context/base/mp-figs.mpii
+++ b/metapost/context/base/mpii/mp-figs.mpii
diff --git a/metapost/context/base/mp-fobg.mp b/metapost/context/base/mpii/mp-fobg.mpii
index f8b709572..f8b709572 100644
--- a/metapost/context/base/mp-fobg.mp
+++ b/metapost/context/base/mpii/mp-fobg.mpii
diff --git a/metapost/context/base/mp-form.mpii b/metapost/context/base/mpii/mp-form.mpii
index d1dac32db..d1dac32db 100644
--- a/metapost/context/base/mp-form.mpii
+++ b/metapost/context/base/mpii/mp-form.mpii
diff --git a/metapost/context/base/mp-func.mpii b/metapost/context/base/mpii/mp-func.mpii
index 94e400b91..94e400b91 100644
--- a/metapost/context/base/mp-func.mpii
+++ b/metapost/context/base/mpii/mp-func.mpii
diff --git a/metapost/context/base/mp-grid.mpii b/metapost/context/base/mpii/mp-grid.mpii
index ea28d60af..ea28d60af 100644
--- a/metapost/context/base/mp-grid.mpii
+++ b/metapost/context/base/mpii/mp-grid.mpii
diff --git a/metapost/context/base/mp-grph.mpii b/metapost/context/base/mpii/mp-grph.mpii
index 782942946..782942946 100644
--- a/metapost/context/base/mp-grph.mpii
+++ b/metapost/context/base/mpii/mp-grph.mpii
diff --git a/metapost/context/base/mp-page.mpii b/metapost/context/base/mpii/mp-page.mpii
index 456ee61cc..456ee61cc 100644
--- a/metapost/context/base/mp-page.mpii
+++ b/metapost/context/base/mpii/mp-page.mpii
diff --git a/metapost/context/base/mp-shap.mpii b/metapost/context/base/mpii/mp-shap.mpii
index 17d21314c..17d21314c 100644
--- a/metapost/context/base/mp-shap.mpii
+++ b/metapost/context/base/mpii/mp-shap.mpii
diff --git a/metapost/context/base/mp-spec.mpii b/metapost/context/base/mpii/mp-spec.mpii
index 19d81f312..19d81f312 100644
--- a/metapost/context/base/mp-spec.mpii
+++ b/metapost/context/base/mpii/mp-spec.mpii
diff --git a/metapost/context/base/mp-step.mpii b/metapost/context/base/mpii/mp-step.mpii
index e05f00b6e..e05f00b6e 100644
--- a/metapost/context/base/mp-step.mpii
+++ b/metapost/context/base/mpii/mp-step.mpii
diff --git a/metapost/context/base/mp-text.mpii b/metapost/context/base/mpii/mp-text.mpii
index 5f96f6788..5f96f6788 100644
--- a/metapost/context/base/mp-text.mpii
+++ b/metapost/context/base/mpii/mp-text.mpii
diff --git a/metapost/context/base/mp-tool.mpii b/metapost/context/base/mpii/mp-tool.mpii
index a5bb345a1..f476361c7 100644
--- a/metapost/context/base/mp-tool.mpii
+++ b/metapost/context/base/mpii/mp-tool.mpii
@@ -2373,7 +2373,7 @@ if unknown darkcyan : color darkcyan ; darkcyan := .625(0,1,1) fi ;
if unknown darkmagenta : color darkmagenta ; darkmagenta := .625(1,0,1) fi ;
if unknown darkyellow : color darkyellow ; darkyellow := .625(1,1,0) fi ;
if unknown darkgray : color darkgray ; darkgray := .625(1,1,1) fi ;
-if unknown lightgray : color lightgray ; lightgray := .875(1,1,1) fi ;
+if unknown lightgray : color lightgray ; lightgray := .850(1,1,1) fi ;
% an improved plain mp macro
diff --git a/metapost/context/base/mp-txts.mpii b/metapost/context/base/mpii/mp-txts.mpii
index d3597488f..d3597488f 100644
--- a/metapost/context/base/mp-txts.mpii
+++ b/metapost/context/base/mpii/mp-txts.mpii
diff --git a/metapost/context/base/metafun.mpiv b/metapost/context/base/mpiv/metafun.mpiv
index b1d4f32e7..b1d4f32e7 100644
--- a/metapost/context/base/metafun.mpiv
+++ b/metapost/context/base/mpiv/metafun.mpiv
diff --git a/metapost/context/base/mp-abck.mpiv b/metapost/context/base/mpiv/mp-abck.mpiv
index abd7d8848..abd7d8848 100644
--- a/metapost/context/base/mp-abck.mpiv
+++ b/metapost/context/base/mpiv/mp-abck.mpiv
diff --git a/metapost/context/base/mp-apos.mpiv b/metapost/context/base/mpiv/mp-apos.mpiv
index 7b7737754..7b7737754 100644
--- a/metapost/context/base/mp-apos.mpiv
+++ b/metapost/context/base/mpiv/mp-apos.mpiv
diff --git a/metapost/context/base/mp-asnc.mpiv b/metapost/context/base/mpiv/mp-asnc.mpiv
index 2626e4d58..2626e4d58 100644
--- a/metapost/context/base/mp-asnc.mpiv
+++ b/metapost/context/base/mpiv/mp-asnc.mpiv
diff --git a/metapost/context/base/mpiv/mp-back.mpiv b/metapost/context/base/mpiv/mp-back.mpiv
new file mode 100644
index 000000000..f588adea9
--- /dev/null
+++ b/metapost/context/base/mpiv/mp-back.mpiv
@@ -0,0 +1,205 @@
+%D \module
+%D [ file=mp-back.mp,
+%D version=2000.05.31,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=backgrounds,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C details.
+
+if known context_back : endinput ; fi ;
+
+boolean context_back ; context_back := true ;
+
+def some_hash ( expr hash_width ,
+ hash_height ,
+ hash_linewidth ,
+ hash_linecolor ,
+ hash_angle ,
+ hash_gap ) =
+
+ stripe_gap := hash_gap ;
+ stripe_angle := hash_angle ;
+ drawoptions (withpen pencircle scaled hash_linewidth
+ withcolor hash_linecolor) ;
+ path p ; p := unitsquare xscaled hash_width yscaled hash_height ;
+ stripe_path_a () (draw) p ; % next we move it all to quadrant 1
+ currentpicture := currentpicture shifted urcorner currentpicture ;
+
+enddef ;
+
+def some_double_back (expr back_type ,
+ back_width ,
+ back_height ,
+ back_delta ,
+ back_linewidth ,
+ back_linecolor ,
+ back_fillcolor ,
+ back_topcolor ,
+ back_bottomcolor ,
+ back_leftcolor ,
+ back_rightcolor ) =
+
+ numeric ww ; ww := back_width ;
+ numeric hh ; hh := back_height ;
+ numeric dd ; dd := back_delta ;
+
+ color back_nillcolor ; back_nillcolor := back_topcolor ;
+
+ path p ; p := fullsquare xscaled ww yscaled hh ;
+ path q ; q := fullsquare xscaled (ww-2dd) yscaled (hh-2dd) ;
+ path r ; r := llcorner p --
+ lrcorner p shifted (-3dd,0) .. controls lrcorner p ..
+ lrcorner p shifted (0, 3dd) --
+ urcorner p shifted (0,-3dd) .. controls urcorner p ..
+ urcorner p shifted (-3dd,0) --
+ ulcorner p -- cycle ;
+ path s ; s := r xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ;
+ path t ; t := llcorner p --
+ lrcorner p --
+ urcorner p shifted (0,-3dd) .. controls urcorner p ..
+ urcorner p shifted (-3dd,0) --
+ ulcorner p shifted ( 3dd,0) .. controls ulcorner p ..
+ ulcorner p shifted (0,-3dd) --
+ llcorner p -- cycle ;
+ path u ; u := t xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ;
+ path v ; v := llcorner p shifted ( 3dd,0) --
+ lrcorner p shifted (-3dd,0) .. controls lrcorner p ..
+ lrcorner p shifted (0, 3dd) --
+ urcorner p shifted (0,-3dd) .. controls urcorner p ..
+ urcorner p shifted (-3dd,0) --
+ ulcorner p shifted ( 3dd,0) .. controls ulcorner p ..
+ ulcorner p shifted (0,-3dd) ..
+ llcorner p shifted (0, 3dd) .. controls llcorner p .. cycle ; % {down} .. cycle ;
+ path w ; w := t xscaled ((ww-2dd)/ww) yscaled ((hh-2dd)/hh) ;
+ path a ; a := llcorner p -- ulcorner p --
+ ulcorner q -- llcorner q -- cycle ;
+ path b ; b := llcorner p -- lrcorner p --
+ lrcorner q -- llcorner q -- cycle ;
+ path c ; c := lrcorner p -- urcorner p --
+ urcorner q -- lrcorner q -- cycle ;
+ path d ; d := ulcorner p -- urcorner p --
+ urcorner q -- ulcorner q -- cycle ;
+ path e ; e := llcorner p -- lrcorner p --
+ urcorner p -- urcorner q --
+ lrcorner q -- llcorner q -- cycle ;
+ path f ; f := llcorner p -- ulcorner p --
+ urcorner p -- urcorner q --
+ ulcorner q -- llcorner q -- cycle ;
+
+ linecap := butt ; pickup pencircle scaled back_linewidth ;
+
+ if back_type=1 :
+
+ fill p withcolor back_fillcolor ;
+ fill a withcolor back_leftcolor ;
+ fill b withcolor back_bottomcolor ;
+ fill c withcolor back_rightcolor ;
+ fill d withcolor back_topcolor ;
+ draw a withcolor back_linecolor ;
+ draw d withcolor back_linecolor ;
+ draw b withcolor back_linecolor ;
+ draw c withcolor back_linecolor ;
+
+ elseif back_type=2 :
+
+ fill p withcolor back_fillcolor ;
+ fill e withcolor back_bottomcolor ;
+ fill f withcolor back_topcolor ;
+ draw e withcolor back_linecolor ;
+ draw f withcolor back_linecolor ;
+
+ elseif back_type=3 :
+
+ fill v withcolor back_nillcolor ;
+ fill w withcolor back_fillcolor ;
+ draw v withcolor back_linecolor ;
+ draw w withcolor back_linecolor ;
+
+ elseif back_type=4 :
+
+ fill t withcolor back_nillcolor ;
+ fill u withcolor back_fillcolor ;
+ draw t withcolor back_linecolor ;
+ draw u withcolor back_linecolor ;
+
+ elseif back_type=5 :
+
+ t := t rotatedaround(center t,180) ;
+ u := u rotatedaround(center u,180) ;
+
+ fill t withcolor back_nillcolor ;
+ fill u withcolor back_fillcolor ;
+ draw t withcolor back_linecolor ;
+ draw u withcolor back_linecolor ;
+
+ elseif back_type=6 :
+
+ r := r rotatedaround(center r,180) ;
+ s := s rotatedaround(center s,180) ;
+
+ fill r withcolor back_nillcolor ;
+ fill s withcolor back_fillcolor ;
+ draw r withcolor back_linecolor ;
+ draw s withcolor back_linecolor ;
+
+ elseif back_type=7 :
+
+ fill r withcolor back_nillcolor ;
+ fill s withcolor back_fillcolor ;
+ draw r withcolor back_linecolor ;
+ draw s withcolor back_linecolor ;
+
+fi ;
+
+enddef ;
+
+endinput ;
+
+beginfig (1) ;
+
+some_double_back (1, 4.5cm, 1.5cm, .25cm, 1mm,
+ .5white, .8white, .7white, .6white, .7white, .6white)
+
+currentpicture := currentpicture shifted (0,-3cm) ;
+
+some_double_back (2, 4.5cm, 1.5cm, .25cm, 1mm,
+ .5white, .8white, .7white, .6white, white, white)
+
+currentpicture := currentpicture shifted (0,-3cm) ;
+
+some_double_back (3, 4.5cm, 1.5cm, .25cm, 1mm,
+ .5white, .8white, .7white, white, white, white)
+
+currentpicture := currentpicture shifted (0,-3cm) ;
+
+some_double_back (4, 4.5cm, 1.5cm, .25cm, 1mm,
+ .5white, .8white, .7white, white, white, white)
+
+currentpicture := currentpicture shifted (0,-3cm) ;
+
+some_double_back (5, 4.5cm, 1.5cm, .25cm, 1mm,
+ .5white, .8white, .7white, white, white, white)
+
+currentpicture := currentpicture shifted (0,-3cm) ;
+
+some_double_back (6, 4.5cm, 1.5cm, .25cm, 1mm,
+ .5white, .8white, .7white, white, white, white)
+
+currentpicture := currentpicture shifted (0,-3cm) ;
+
+some_double_back (7, 4.5cm, 1.5cm, .25cm, 1mm,
+ .5white, .8white, .7white, white, white, white)
+
+currentpicture := currentpicture shifted (0,-3cm) ;
+
+some_double_back (8, 4.5cm, 1.5cm, .25cm, 1mm,
+ .5white, .8white, .7white, white, white, white)
+
+endfig ;
+
+end .
diff --git a/metapost/context/base/mp-bare.mpiv b/metapost/context/base/mpiv/mp-bare.mpiv
index c6194b1ee..c6194b1ee 100644
--- a/metapost/context/base/mp-bare.mpiv
+++ b/metapost/context/base/mpiv/mp-bare.mpiv
diff --git a/metapost/context/base/mp-base.mpiv b/metapost/context/base/mpiv/mp-base.mpiv
index 28eb57fb8..28eb57fb8 100644
--- a/metapost/context/base/mp-base.mpiv
+++ b/metapost/context/base/mpiv/mp-base.mpiv
diff --git a/metapost/context/base/mp-butt.mpiv b/metapost/context/base/mpiv/mp-butt.mpiv
index 6f5b90a7e..6f5b90a7e 100644
--- a/metapost/context/base/mp-butt.mpiv
+++ b/metapost/context/base/mpiv/mp-butt.mpiv
diff --git a/metapost/context/base/mp-char.mpiv b/metapost/context/base/mpiv/mp-char.mpiv
index f604accd8..f604accd8 100644
--- a/metapost/context/base/mp-char.mpiv
+++ b/metapost/context/base/mpiv/mp-char.mpiv
diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mpiv/mp-chem.mpiv
index b861d3f12..b861d3f12 100644
--- a/metapost/context/base/mp-chem.mpiv
+++ b/metapost/context/base/mpiv/mp-chem.mpiv
diff --git a/metapost/context/base/mp-core.mpiv b/metapost/context/base/mpiv/mp-core.mpiv
index 9b7182908..9b7182908 100644
--- a/metapost/context/base/mp-core.mpiv
+++ b/metapost/context/base/mpiv/mp-core.mpiv
diff --git a/metapost/context/base/mpiv/mp-cows.mpiv b/metapost/context/base/mpiv/mp-cows.mpiv
new file mode 100644
index 000000000..3ad1a98f5
--- /dev/null
+++ b/metapost/context/base/mpiv/mp-cows.mpiv
@@ -0,0 +1,156 @@
+%D \module
+%D [ file=mp-cows.mpiv,
+%D version=2015.05.27,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=the cow,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C details.
+
+if known context_cows : endinput ; fi ;
+
+boolean context_cows ; context_cows := true ;
+
+picture cow ; cow := image (
+ fill (245.449005,600.340027)..controls (242.781006,599.398010) and (239.621002,596.020020)..(237.671997,594.070007)
+ ..controls (236.738007,584.421997) and (244.578003,583.629028)..(250.199005,577.440979)
+ ..controls (258.769989,573.698975) and (251.210999,567.718994)..(256.179993,557.421997)
+ ..controls (257.039001,550.940979) and (257.898010,543.890991)..(255.309006,539.781006)
+ ..controls (249.479996,538.921997) and (247.968994,540.218994)..(246.891006,531.429993)
+ ..controls (246.309006,526.968994) and (231.770004,529.059021)..(229.031006,538.270020)
+ ..controls (227.089996,544.968994) and (221.328003,546.698975)..(217.800995,543.171997)
+ ..controls (213.770004,538.059021) and (215.781006,531.218994)..(217.800995,527.468994)
+ ..controls (224.929993,517.320007) and (212.039001,511.421997)..(205.128998,516.737976)
+ ..controls (199.729996,508.679993) and (211.391006,500.039001)..(207.429993,494.500000)
+ ..controls (205.781006,493.988007) and (204.770004,489.171997)..(185.468994,500.539001)
+ ..controls (180.358994,504.140991) and (167.828003,500.761993)..(168.770004,520.629028)
+ ..controls (168.770004,525.820007) and (165.602005,543.531006)..(162.141006,555.909973)
+ ..controls (159.410004,561.237976) and (156.738007,559.078003)..(156.891006,553.898010)
+ ..controls (157.179993,547.851990) and (162.940994,531.218994)..(155.520004,540.218994)
+ ..controls (153.578003,539.210999) and (156.891006,523.578003)..(156.891006,521.640991)
+ ..controls (162.000000,517.031006) and (157.391006,513.578003)..(154.729996,512.281006)
+ ..controls (151.270004,518.328003) and (149.621002,518.039001)..(147.171997,514.440979)
+ ..controls (141.699005,514.078003) and (144.578003,528.190979)..(140.261993,528.620972)
+ ..controls (137.020004,527.762024) and (139.179993,520.059021)..(138.238007,518.762024)
+ ..controls (132.979996,524.737976) and (130.897995,529.270020)..(127.012001,521.640991)
+ ..controls (126.140999,521.640991) and (122.109001,519.190979)..(120.960999,526.539001)
+ ..controls (117.648003,552.737976) and (107.058998,558.359009)..(93.820297,565.129028)
+ ..controls (92.019501,565.629028) and (84.238297,566.710999)..(79.339798,568.148010)
+ ..controls (73.511703,560.879028) and (58.320301,565.629028)..(56.230499,570.309021)
+ ..controls (54.789101,572.690979) and (54.648399,575.210999)..(54.789101,576.500000)
+ ..controls (52.339802,580.101990) and (55.871101,582.698975)..(59.621101,583.059021)
+ ..controls (62.859402,587.159973) and (68.539101,594.940979)..(71.281303,601.559021)
+ ..controls (72.289101,603.070007) and (74.949203,609.340027)..(78.191399,609.551025)
+ ..controls (74.949203,612.940979) and (74.300797,622.512024)..(82.660202,617.328003)
+ ..controls (87.121101,624.020020) and (92.089798,624.309021)..(95.761703,615.820007)
+ ..controls (102.890999,615.379028) and (102.308998,608.690979)..(115.780998,605.520020)
+ ..controls (122.762001,602.859009) and (132.770004,604.578003)..(140.261993,603.718994)
+ ..controls (136.218994,596.879028) and (127.441002,566.859009)..(132.979996,559.801025)
+ ..controls (140.761993,564.698975) and (141.839996,605.379028)..(157.031006,595.659973)
+ ..controls (160.559006,593.929993) and (159.910004,590.039001)..(164.089996,590.179993)
+ ..controls (170.421997,587.448975) and (169.128998,600.770020)..(172.511993,600.770020)
+ ..controls (176.468994,599.762024) and (183.020004,599.039001)..(186.979996,599.539001)
+ ..controls (197.710999,600.770020) and (206.929993,604.078003)..(223.921997,602.500000)
+ ..controls (231.121002,601.781006) and (238.250000,601.059021)..(245.449005,600.340027)
+ --cycle;
+ fill (305.281006,560.948975)..controls (304.628998,560.948975) and (299.949005,561.237976)..(299.378998,561.237976)
+ ..controls (302.398010,550.440979) and (303.980011,536.468994)..(304.199005,525.309021)
+ ..controls (303.699005,521.351990) and (299.808990,517.460999)..(299.378998,525.671997)
+ ..controls (295.851990,530.859009) and (296.421997,540.070007)..(293.398010,540.289001)
+ ..controls (287.351990,539.640991) and (285.339996,513.218994)..(280.011993,509.328003)
+ ..controls (276.261993,512.281006) and (280.730011,524.020020)..(275.539001,524.737976)
+ ..controls (270.500000,524.020020) and (264.308990,526.679993)..(266.691010,534.460999)
+ ..controls (270.289001,543.020020) and (268.339996,554.762024)..(266.539001,561.601990)
+ ..controls (262.371002,578.590027) and (264.019989,587.090027)..(271.578003,596.090027)
+ --(267.480011,604.512024)..controls (275.398010,608.262024) and (285.621002,604.578003)..(290.019989,602.210999)
+ ..controls (294.621002,600.262024) and (300.238007,595.940979)..(301.101990,587.379028)
+ ..controls (303.339996,578.879028) and (304.421997,569.737976)..(305.281006,560.948975)
+ --cycle;
+ pickup pencircle scaled 2.000000bp;
+ draw (84.378899,618.551025)..controls (88.339798,624.379028) and (92.589798,622.940979)..(96.339798,615.671997)
+ ..controls (101.230003,615.601990) and (102.460999,612.429993)..(104.980003,610.781006)
+ ..controls (122.621002,598.390991) and (147.460999,607.179993)..(167.897995,601.921997)
+ ..controls (180.940994,598.539001) and (190.871002,599.762024)..(200.089996,602.059021)
+ ..controls (220.320007,607.250000) and (246.102005,596.159973)..(263.738007,603.859009)
+ ..controls (274.750000,608.620972) and (284.761993,605.659973)..(292.968994,600.909973)
+ ..controls (297.578003,597.960999) and (299.589996,596.090027)..(300.960999,591.262024)
+ ..controls (306.289001,572.539001) and (306.289001,551.020020)..(309.531006,530.570007)
+ ..controls (309.531006,528.840027) and (312.191010,526.101990)..(312.480011,522.070007)
+ ..controls (315.789001,511.339996) and (316.078003,510.121002)..(317.160004,502.199005)
+ ..controls (317.160004,501.339996) and (326.519989,488.449005)..(325.011993,479.019989)
+ ..controls (323.929993,481.250000) and (323.859009,482.828003)..(321.621002,481.679993)
+ ..controls (320.328003,479.300995) and (320.898010,473.898010)..(322.558990,471.738007)
+ ..controls (320.828003,470.808990) and (318.460999,473.468994)..(317.519989,475.199005)
+ ..controls (318.171997,473.039001) and (317.808990,470.808990)..(316.730011,469.300995)
+ ..controls (315.859009,472.250000) and (316.578003,473.179993)..(315.359009,473.898010)
+ ..controls (313.988007,472.898010) and (314.210999,469.300995)..(314.281006,466.199005)
+ ..controls (313.488007,468.070007) and (311.468994,472.460999)..(312.550995,476.421997)
+ ..controls (312.480011,484.199005) and (308.808990,489.101990)..(310.320007,499.101990)
+ ..controls (310.101990,504.429993) and (307.300995,521.059021)..(304.558990,524.301025)
+ ..controls (303.121002,526.250000) and (306.359009,510.769989)..(306.359009,506.160004)
+ ..controls (306.648010,500.898010) and (307.078003,468.718994)..(306.429993,463.101990)
+ ..controls (306.429993,459.218994) and (306.218994,453.960999)..(307.078003,452.160004)
+ ..controls (308.738007,450.789001) and (309.378998,450.500000)..(309.601990,447.980011)
+ ..controls (309.238007,446.621002) and (308.738007,446.039001)..(307.730011,445.539001)
+ ..controls (306.070007,444.601990) and (307.371002,441.789001)..(306.070007,439.851990)
+ ..controls (304.488007,438.769989) and (304.128998,441.859009)..(303.339996,441.859009)
+ ..controls (302.691010,441.000000) and (303.050995,437.980011)..(302.468994,436.179993)
+ ..controls (299.660004,433.800995) and (292.179993,432.500000)..(289.148010,434.660004)
+ ..controls (289.730011,440.640991) and (291.738007,441.578003)..(295.628998,446.621002)
+ ..controls (298.660004,452.589996) and (297.000000,460.941010)..(296.929993,468.140991)
+ ..controls (295.488007,480.378998) and (289.218994,487.300995)..(289.441010,496.441010)
+ ..controls (287.859009,495.718994) and (286.421997,494.570007)..(284.261993,494.859009)
+ ..controls (283.390991,489.460999) and (286.421997,484.558990)..(284.828003,480.820007)
+ ..controls (281.949005,471.960999) and (277.058990,446.621002)..(279.000000,437.761993)
+ ..controls (280.011993,434.738007) and (278.210999,433.148010)..(277.058990,433.941010)
+ ..controls (276.769989,433.941010) and (276.550995,433.941010)..(276.410004,433.941010)
+ ..controls (276.410004,433.941010) and (276.550995,431.421997)..(275.691010,430.921997)
+ ..controls (274.101990,430.339996) and (273.671997,431.710999)..(272.660004,432.140991)
+ ..controls (271.218994,430.851990) and (272.519989,429.480011)..(271.148010,428.039001)
+ ..controls (267.191010,428.039001) and (261.359009,425.378998)..(257.980011,428.261993)
+ ..controls (257.328003,434.160004) and (263.300995,436.679993)..(266.468994,440.710999)
+ ..controls (268.628998,446.621002) and (271.078003,462.890991)..(267.769989,474.621002)
+ ..controls (267.769989,475.558990) and (264.378998,485.281006)..(261.429993,488.660004)
+ ..controls (258.699005,487.660004) and (257.328003,485.500000)..(253.218994,486.289001)
+ ..controls (252.578003,484.339996) and (253.300995,482.328003)..(252.218994,480.101990)
+ ..controls (251.858994,479.519989) and (249.339996,478.578003)..(249.190994,481.390991)
+ ..controls (248.979996,483.050995) and (248.897995,486.359009)..(248.261993,486.718994)
+ ..controls (243.647995,486.718994) and (233.710999,487.078003)..(231.770004,493.921997)
+ ..controls (219.891006,492.339996) and (215.929993,491.261993)..(206.570007,493.421997)
+ ..controls (196.628998,489.671997) and (183.238007,506.160004)..(174.531006,502.199005)
+ ..controls (172.511993,496.148010) and (173.089996,485.640991)..(171.647995,481.390991)
+ ..controls (169.339996,474.769989) and (171.141006,467.140991)..(171.141006,456.410004)
+ ..controls (170.570007,455.398010) and (169.852005,454.460999)..(168.479996,454.460999)
+ ..controls (168.479996,453.101990) and (169.339996,450.859009)..(168.621002,449.421997)
+ ..controls (167.179993,447.621002) and (165.891006,451.800995)..(165.020004,444.601990)
+ ..controls (163.147995,443.738007) and (157.750000,442.218994)..(155.589996,445.179993)
+ ..controls (155.878998,448.988007) and (158.328003,451.300995)..(160.128998,453.378998)
+ ..controls (161.421997,456.910004) and (160.988007,458.281006)..(160.699005,461.808990)
+ ..controls (160.988007,464.980011) and (161.710999,468.578003)..(161.858994,470.089996)
+ ..controls (161.858994,473.039001) and (162.500000,479.300995)..(161.141006,481.179993)
+ --(159.410004,482.691010)..controls (157.179993,487.218994) and (158.328003,494.640991)..(157.608994,500.261993)
+ ..controls (155.809006,500.691010) and (155.809006,500.980011)..(154.011993,498.308990)
+ ..controls (154.011993,494.421997) and (153.500000,486.359009)..(152.352005,483.839996)
+ ..controls (149.690994,479.808990) and (150.839996,459.648010)..(151.421997,448.558990)
+ ..controls (151.781006,446.468994) and (149.690994,447.699005)..(149.761993,444.738007)
+ ..controls (150.050995,442.800995) and (147.891006,443.589996)..(146.089996,444.601990)
+ ..controls (145.147995,445.179993) and (146.589996,439.781006)..(145.371002,439.558990)
+ ..controls (142.339996,438.839996) and (136.871002,438.191010)..(135.218994,440.710999)
+ ..controls (134.570007,444.601990) and (137.878998,448.058990)..(140.621002,451.011993)
+ ..controls (143.141006,455.828003) and (140.897995,465.699005)..(140.468994,476.281006)
+ --(138.891006,478.218994)..controls (134.858994,483.191010) and (139.608994,496.941010)..(136.511993,506.230011)
+ ..controls (120.019997,514.870972) and (122.109001,519.190979)..(118.730003,537.620972)
+ ..controls (115.128998,557.640991) and (93.378899,567.648010)..(79.058601,567.648010)
+ ..controls (73.441399,563.039001) and (66.238297,563.620972)..(58.539101,567.648010)
+ ..controls (55.660198,569.229980) and (54.429699,573.190979)..(54.500000,576.500000)
+ ..controls (52.628899,580.750000) and (55.218800,582.190979)..(59.621101,583.487976)
+ ..controls (62.710899,587.809021) and (68.621101,594.648010)..(69.191399,597.737976)
+ ..controls (70.339798,601.921997) and (75.531303,608.109009)..(77.761703,609.770020)
+ ..controls (75.820297,613.012024) and (74.808601,615.171997)..(77.109398,618.551025)
+ ..controls (79.558601,620.140991) and (81.789101,616.609009)..(84.378899,618.551025)
+ --cycle;
+) ;
diff --git a/metapost/context/base/mp-crop.mpiv b/metapost/context/base/mpiv/mp-crop.mpiv
index 00bcdcb44..00bcdcb44 100644
--- a/metapost/context/base/mp-crop.mpiv
+++ b/metapost/context/base/mpiv/mp-crop.mpiv
diff --git a/metapost/context/base/mp-figs.mpiv b/metapost/context/base/mpiv/mp-figs.mpiv
index aac7c5ad2..aac7c5ad2 100644
--- a/metapost/context/base/mp-figs.mpiv
+++ b/metapost/context/base/mpiv/mp-figs.mpiv
diff --git a/metapost/context/base/mpiv/mp-fobg.mpiv b/metapost/context/base/mpiv/mp-fobg.mpiv
new file mode 100644
index 000000000..f8b709572
--- /dev/null
+++ b/metapost/context/base/mpiv/mp-fobg.mpiv
@@ -0,0 +1,87 @@
+%D \module
+%D [ file=mp-fobg.mp,
+%D version=2004.03.12,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=Formatting Objects,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C details.
+
+if known context_fobg : endinput ; fi ;
+
+boolean context_fobg ; context_fobg := true ;
+
+FoNone := 0 ; FoHidden := 1 ; FoDotted := 2 ; FoDashed := 3 ; FoSolid := 4 ;
+FoDouble := 5 ; FoGroove := 6 ; FoRidge := 7 ; FoInset := 8 ; FoOutset := 9 ;
+FoAll := 0 ; FoTop := 1 ; FoBottom := 2 ; FoLeft := 3 ; FoRight := 4 ;
+FoMedium := .5pt ; FoThin := FoMedium/2 ; FoThick := FoMedium*2 ;
+
+color FoBackgroundColor, FoNoColor, FoLineColor[] ; FoNoColor := (-1,-1,-1) ;
+numeric FoLineWidth[], FoLineStyle[] ;
+boolean FoFrame, FoBackground, FoSplit ;
+
+FoFrame := FoBackground := FoSplit := false ;
+FoBackgroundColor := white ;
+FoDashFactor := .5 ;
+FoDotFactor := .375 ;
+
+for i = FoAll upto FoRight :
+ FoLineColor[i] := black ;
+ FoLineWidth[i] := .5pt ;
+ FoLineStyle[i] := FoNone ;
+endfor ;
+
+def DrawFoFrame(expr n, p) =
+ drawoptions(withcolor FoLineColor[n] withpen pencircle scaled FoLineWidth[n]) ;
+ if FoLineStyle[n] = FoNone :
+ % nothing
+ elseif FoLineStyle[n] = FoHidden :
+ % nothing
+ elseif FoLineStyle[n] = FoDotted :
+ draw p dashed (withdots scaled (FoDotFactor*FoLineWidth[n])) ;
+ elseif FoLineStyle[n] = FoDashed :
+ draw p dashed (evenly scaled (FoDashFactor*FoLineWidth[n])) ;
+ elseif FoLineStyle[n] = FoSolid :
+ draw p ;
+ elseif FoLineStyle[n] = FoDouble :
+ draw p enlarged FoLineWidth[n] ; draw p enlarged -FoLineWidth[n] ;
+ elseif FoLineStyle[n] = FoGroove :
+ draw p ;
+ draw p withpen pencircle scaled .5FoLineWidth[n] withcolor (inverted FoLineColor[n] softened .5) ;
+ elseif FoLineStyle[n] = FoRidge :
+ draw p withcolor (inverted FoLineColor[n] softened .5) ;
+ draw p withpen pencircle scaled .5FoLineWidth[n] ;
+ elseif FoLineStyle[n] = FoInset :
+ draw p ; draw p inset 2.5FoLineWidth[n] ;
+ elseif FoLineStyle[n] = FoOutset :
+ draw p ; draw p outset 2.5FoLineWidth[n] ;
+ fi ;
+enddef ;
+
+primarydef p outset d =
+ ((lrcorner p -- urcorner p -- ulcorner p -- llcorner p -- cycle)
+ shifted (d*(-1,1)) cutbefore topboundary p) cutafter leftboundary p
+enddef ;
+
+primarydef p inset d =
+ ((ulcorner p -- llcorner p -- lrcorner p -- urcorner p -- cycle)
+ shifted (d*(1,-1)) cutbefore bottomboundary p) cutafter rightboundary p
+enddef ;
+
+vardef equalpaths(expr p, q) =
+ if length(p) = length(q) :
+ save ok ; boolean ok ; ok := true ;
+ for i = 0 upto length(p)-1 :
+ ok := ok and (round(point i of p) = round(point i of q)) ;
+ endfor ;
+ ok
+ else :
+ false
+ fi
+enddef ;
+
+endinput ;
diff --git a/metapost/context/base/mp-form.mpiv b/metapost/context/base/mpiv/mp-form.mpiv
index 88b15e097..88b15e097 100644
--- a/metapost/context/base/mp-form.mpiv
+++ b/metapost/context/base/mpiv/mp-form.mpiv
diff --git a/metapost/context/base/mp-func.mpiv b/metapost/context/base/mpiv/mp-func.mpiv
index b1b9d6d5d..b1b9d6d5d 100644
--- a/metapost/context/base/mp-func.mpiv
+++ b/metapost/context/base/mpiv/mp-func.mpiv
diff --git a/metapost/context/base/mp-grap.mpiv b/metapost/context/base/mpiv/mp-grap.mpiv
index 4fd8ee5bd..4fd8ee5bd 100644
--- a/metapost/context/base/mp-grap.mpiv
+++ b/metapost/context/base/mpiv/mp-grap.mpiv
diff --git a/metapost/context/base/mp-grid.mpiv b/metapost/context/base/mpiv/mp-grid.mpiv
index b9243b1b9..b9243b1b9 100644
--- a/metapost/context/base/mp-grid.mpiv
+++ b/metapost/context/base/mpiv/mp-grid.mpiv
diff --git a/metapost/context/base/mp-grph.mpiv b/metapost/context/base/mpiv/mp-grph.mpiv
index a3c057a98..5938b9f02 100644
--- a/metapost/context/base/mp-grph.mpiv
+++ b/metapost/context/base/mpiv/mp-grph.mpiv
@@ -118,7 +118,18 @@ def doloadfigure (expr filename) text figureattributes =
endgroup ;
enddef ;
-def graphictext primary t =
+% shared between old and new
+
+boolean mfun_gt_color_fill ;
+boolean mfun_gt_color_draw ;
+boolean mfun_gt_shade_fill ;
+boolean mfun_gt_reverse_fill ;
+boolean mfun_gt_outline_fill ;
+picture mfun_gt_picture ;
+
+% this is the old version:
+
+def old_graphictext primary t =
hide (
if mfun_trial_run :
let mfun_graphic_text = mfun_no_graphic_text ;
@@ -146,7 +157,7 @@ def mfun_no_graphic_text (expr t) text rest =
withpostscript t
enddef ;
-def mfun_finish_graphic_text text x_op_x =
+def mfun_finish_graphic_text text rest =
protectgraphicmacros ; % resets currentpicture
interim linecap := butt ; % normally rounded
interim linejoin := mitered ; % normally rounded
@@ -166,84 +177,158 @@ def mfun_finish_graphic_text text x_op_x =
def fill expr p =
addto scratchpicture contour p withpen currentpen ;
enddef ;
- def f_op_f = enddef ; boolean f_color ; f_color := false ;
- def d_op_d = enddef ; boolean d_color ; d_color := false ;
- def s_op_s = enddef ; boolean s_color ; s_color := false ;
- boolean reverse_fill ; reverse_fill := false ;
- boolean outline_fill ; outline_fill := false ;
+ def mfun_gt_fill = enddef ; boolean mfun_gt_color_fill ; mfun_gt_color_fill := false ;
+ def mfun_gt_draw = enddef ; boolean mfun_gt_color_draw ; mfun_gt_color_draw := false ;
+ def mfun_gt_shade = enddef ; boolean mfun_gt_shade_fill ; mfun_gt_shade_fill := false ;
+ boolean mfun_gt_reverse_fill ; mfun_gt_reverse_fill := false ;
+ boolean mfun_gt_outline_fill ; mfun_gt_outline_fill := false ;
def reversefill =
- hide(reverse_fill := true )
+ hide(mfun_gt_reverse_fill := true )
enddef ;
def outlinefill =
- hide(outline_fill := true )
+ hide(mfun_gt_outline_fill := true )
enddef ;
def withshade primary c =
- hide(def s_op_s = normalwithshade c enddef ; s_color := true )
+ hide(def mfun_gt_shade = normalwithshade c enddef ; mfun_gt_shade_fill := true )
enddef ;
def withfillcolor primary c =
- hide(def f_op_f = withcolor c enddef ; f_color := true )
+ hide(def mfun_gt_fill = withcolor c enddef ; mfun_gt_color_fill := true )
enddef ;
def withdrawcolor primary c =
- hide(def d_op_d = withcolor c enddef ; d_color := true )
+ hide(def mfun_gt_draw = withcolor c enddef ; mfun_gt_color_draw := true )
enddef ;
scratchpicture := nullpicture ;
- addto scratchpicture doublepath origin x_op_x ; % pre-roll
+ addto scratchpicture doublepath origin rest ; % pre-roll
for i within scratchpicture : % Below here is a dirty tricky test!
if (urcorner dashpart i) = origin :
- outline_fill := false ;
+ mfun_gt_outline_fill := false ;
fi ;
endfor ;
scratchpicture := nullpicture ;
readfile(data_mpy_file) ;
scratchpicture := (scratchpicture shifted -llcorner scratchpicture) scaled (1/10) ;
- if not d_color and not f_color :
- d_color := true ;
+ if not mfun_gt_color_draw and not mfun_gt_color_fill :
+ mfun_gt_color_draw := true ;
fi
- if s_color :
- d_color := false ;
- f_color := false ;
+ if mfun_gt_shade_fill :
+ mfun_gt_color_draw := false ;
+ mfun_gt_color_fill := false ;
fi ;
currentpicture := figurepicture ;
- if d_color and not reverse_fill :
+ if mfun_gt_shade_fill :
for i within scratchpicture :
- if f_color and outline_fill :
- addto currentpicture doublepath pathpart i _op_ x_op_x f_op_f dashed nullpicture ;
- fi ;
if filled i :
- addto currentpicture doublepath pathpart i _op_ x_op_x d_op_d ;
- fi ;
- endfor ;
- fi ;
- if f_color :
- for i within scratchpicture :
- if filled i :
- addto currentpicture contour pathpart i _op_ x_op_x f_op_f withpen pencircle scaled 0 ;
- fi ;
- endfor ;
- fi ;
- if d_color and reverse_fill :
- for i within scratchpicture :
- if filled i :
- addto currentpicture doublepath pathpart i _op_ x_op_x d_op_d ;
- fi ;
- endfor ;
- fi ;
- if s_color :
- for i within scratchpicture :
- if filled i :
- addto currentpicture contour pathpart i _op_ x_op_x s_op_s ;
+ addto currentpicture contour pathpart i _op_ rest mfun_gt_shade ;
fi ;
endfor ;
else :
+ if mfun_gt_color_draw and not mfun_gt_reverse_fill :
+ for i within scratchpicture :
+ if mfun_gt_color_fill and mfun_gt_outline_fill :
+ addto currentpicture doublepath pathpart i _op_ rest mfun_gt_fill dashed nullpicture ;
+ fi ;
+ if filled i :
+ addto currentpicture doublepath pathpart i _op_ rest mfun_gt_draw ;
+ fi ;
+ endfor ;
+ fi ;
+ if mfun_gt_color_fill :
+ for i within scratchpicture :
+ if filled i :
+ addto currentpicture contour pathpart i _op_ rest mfun_gt_fill withpen pencircle scaled 0 ;
+ fi ;
+ endfor ;
+ fi ;
+ if mfun_gt_color_draw and mfun_gt_reverse_fill :
+ for i within scratchpicture :
+ if filled i :
+ addto currentpicture doublepath pathpart i _op_ rest mfun_gt_draw ;
+ fi ;
+ endfor ;
+ fi ;
for i within scratchpicture :
if stroked i :
- addto currentpicture doublepath pathpart i _op_ x_op_x d_op_d ;
+ addto currentpicture doublepath pathpart i _op_ rest mfun_gt_draw ;
fi ;
endfor ;
fi ;
endgroup ;
enddef ;
+% and this is the new one:
+
+% boolean mfun_gt_color_fill ;
+% boolean mfun_gt_color_draw ;
+% boolean mfun_gt_shade_fill ;
+% boolean mfun_gt_reverse_fill ;
+% picture mfun_gt_picture ;
+
+def mfun_gt_default = % somewhat compatible
+ scaled 11.5
+ withpen pencircle scaled .1
+enddef ;
+
+def new_graphictext primary t = % use outlinetext instead
+ begingroup ;
+ mfun_graphic_text_indeed(t)
+enddef ;
+
+def mfun_graphic_text_indeed(expr t) text rest =
+ interim linecap := butt ; % normally rounded
+ interim linejoin := mitered ; % normally rounded
+ % interim miterlimit := 10 ; % todo
+ %
+ let normalwithshade = withshade ;
+ %
+ save reversefill, outlinefill, withshade, withfillcolor, withdrawcolor ;
+ %
+ def mfun_gt_fill = enddef ;
+ def mfun_gt_draw = enddef ;
+ def mfun_gt_shade = enddef ;
+ %
+ mfun_gt_color_fill := false ;
+ mfun_gt_color_draw := false ;
+ mfun_gt_shade_fill := false ;
+ mfun_gt_reverse_fill := false ;
+ %
+ def reversefill = hide(mfun_gt_reverse_fill := true) enddef ;
+ def outlinefill = enddef ;
+ def withshade primary c = hide(mfun_gt_shade_fill := true; def mfun_gt_shade = normalwithshade c enddef ;) enddef ;
+ def withfillcolor primary c = hide(mfun_gt_color_fill := true; def mfun_gt_fill = withcolor c enddef ;) enddef ;
+ def withdrawcolor primary c = hide(mfun_gt_color_draw := true; def mfun_gt_draw = withcolor c enddef ;) enddef ;
+ %
+ mfun_gt_picture := nullpicture ;
+ addto mfun_gt_picture doublepath origin rest ; % preroll
+ mfun_gt_picture := nullpicture ;
+ %
+ def reversefill = enddef ;
+ def outlinefill = enddef ;
+ def withshade primary c = enddef ;
+ def withfillcolor primary c = enddef ;
+ def withdrawcolor primary c = enddef ;
+ %
+ if mfun_gt_shade_fill :
+ draw outlinetext.f(t)(mfun_gt_shade) rest;
+ elseif mfun_gt_color_fill and mfun_gt_color_draw :
+ if mfun_gt_reverse_fill :
+ draw outlinetext.r(t)(mfun_gt_default mfun_gt_fill rest)(mfun_gt_default mfun_gt_draw rest) ;
+ else :
+ draw outlinetext.b(t)(mfun_gt_default mfun_gt_draw rest)(mfun_gt_default mfun_gt_fill rest);
+ fi ;
+ elseif mfun_gt_color_fill :
+ draw outlinetext.f(t)(mfun_gt_default mfun_gt_fill rest) ;
+ elseif mfun_gt_color_draw :
+ draw outlinetext.d(t)(mfun_gt_default mfun_gt_draw rest) ;
+ else :
+ draw outlinetext.d(t)(mfun_gt_default rest) ;
+ fi ;
+ %
+ endgroup ;
+enddef ;
+
+let graphictext = old_graphictext ;
+%%% graphictext = new_graphictext ; % more than 10 times faster
+
% example
%
% beginfig (1) ;
diff --git a/metapost/context/base/mp-idea.mpiv b/metapost/context/base/mpiv/mp-idea.mpiv
index 462d97553..462d97553 100644
--- a/metapost/context/base/mp-idea.mpiv
+++ b/metapost/context/base/mpiv/mp-idea.mpiv
diff --git a/metapost/context/base/mp-luas.mpiv b/metapost/context/base/mpiv/mp-luas.mpiv
index c919ba215..c30798247 100644
--- a/metapost/context/base/mp-luas.mpiv
+++ b/metapost/context/base/mpiv/mp-luas.mpiv
@@ -56,7 +56,7 @@ vardef mlib_luas_luacall(text t) =
elseif numeric s :
& decimal s
elseif boolean s :
- & if s : "true" else "false" fi
+ & if s : "true" else : "false" fi
fi endfor
)
enddef ;
@@ -74,7 +74,7 @@ vardef mlib_luas_lualist(expr c)(text t) =
elseif numeric s :
& decimal s
elseif boolean s :
- & if s : "true" else "false" fi
+ & if s : "true" else : "false" fi
fi endfor & ")"
)
enddef ;
diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv
index b19f47f1e..326342b70 100644
--- a/metapost/context/base/mp-mlib.mpiv
+++ b/metapost/context/base/mpiv/mp-mlib.mpiv
@@ -205,8 +205,11 @@ extra_beginfig := extra_beginfig & "mfun_reset_tex_texts ;" ;
% fi
% enddef ;
+boolean mfun_onetime_textext ; mfun_onetime_textext := false ;
+
vardef rawtextext(expr s) = % todo: avoid currentpicture
if s = "" :
+ mfun_onetime_textext := false ;
nullpicture
else :
mfun_tt_n := mfun_tt_n + 1 ;
@@ -219,7 +222,10 @@ vardef rawtextext(expr s) = % todo: avoid currentpicture
withprescript "tx_stage=trial"
withprescript "tx_color=" & colordecimals colorpart mfun_tt_o
withpostscript s ;
- addto mfun_tt_p also mfun_tt_c ;
+ if not mfun_onetime_textext :
+ addto mfun_tt_p also mfun_tt_c
+ withprescript "tx_global=yes" ;
+ fi ;
else :
mfun_tt_b := lua.mp.tt_dimensions(mfun_tt_n) ;
addto mfun_tt_c doublepath unitsquare
@@ -229,6 +235,7 @@ vardef rawtextext(expr s) = % todo: avoid currentpicture
withprescript "tx_number=" & decimal mfun_tt_n
withprescript "tx_stage=final" ;
fi ;
+ mfun_onetime_textext := false ;
mfun_tt_c
fi
enddef ;
@@ -346,7 +353,7 @@ vardef plain_thelabel@#(expr p,z) =
enddef;
def plain_label = % takes two arguments, contrary to textext that takes one
- draw plain_thelabel
+ normaldraw plain_thelabel
enddef ;
let mfun_label = label ;
@@ -362,6 +369,12 @@ def usemetafunlabels =
let thelabel = mfun_thelabel ;
enddef ;
+vardef dotlabel@#(expr s,z) text t_ =
+ label@#(s,z) t_ ;
+ interim linecap := rounded ;
+ normaldraw z withpen pencircle scaled dotlabeldiam t_ ;
+enddef ;
+
plain_compatibility_data := plain_compatibility_data & "save label, thelabel ;" & "useplainlabels ;" ;
% next comes own own:
@@ -385,6 +398,11 @@ vardef textext@#(expr p) = % no draw here
thetextext@#(p,origin)
enddef ;
+vardef onetimetextext@#(expr p) = % no draw here
+ mfun_onetime_textext := true ;
+ thetextext@#(p,origin)
+enddef ;
+
vardef thelabel@#(expr p,z) =
if string p :
thelabel@#(rawtextext("\definedfont[" & defaultfont & "]" & p) scaled defaultscale,z)
@@ -394,7 +412,7 @@ vardef thelabel@#(expr p,z) =
enddef;
def label = % takes two arguments, contrary to textext that takes one
- draw thelabel
+ normaldraw thelabel
enddef ;
vardef anchored@#(expr p, z) = % beware: no "+ mfun_laboff@#" here (never!)
@@ -467,10 +485,33 @@ boolean trace_shades ; trace_shades := false ; % still there
% but this is nicer
-path mfun_shade_path ;
+% fill fullcircle scaled 10cm
+% withshademethod "circular"
+% withshadevector (5cm,1cm)
+% withshadecenter (.1,.5)
+% withshadedomain (.2,.6)
+% withshadefactor 1.2
+% withshadecolors (red,green)
+% ;
+
+path mfun_shade_path ;
+numeric mfun_shade_step ; mfun_shade_step := 0 ;
+
+def withshadestep =
+ hide(mfun_shade_step := mfun_shade_step + 1 ;)
+ mfun_withshadestep
+enddef ;
+
+def mfun_withshadestep (text t) =
+ withprescript "sh_step=" & decimal mfun_shade_step
+ t
+enddef ;
primarydef p withshademethod m =
- hide(mfun_shade_path := p ;)
+ hide(
+ mfun_shade_path := p ;
+ mfun_shade_step := 1 ;
+ )
p
withprescript "sh_domain=0 1"
withprescript "sh_color=into"
@@ -501,6 +542,16 @@ def withshadevector expr a =
withprescript "sh_center_b=" & ddecimal (point ypart a of mfun_shade_path)
enddef ;
+def withshadedirection expr a =
+ withprescript "sh_center_a=" & ddecimal (point xpart a of boundingbox(mfun_shade_path))
+ withprescript "sh_center_b=" & ddecimal (point ypart a of boundingbox(mfun_shade_path))
+enddef ;
+
+pair shadedup ; shadedup := (0.5,2.5) ;
+pair shadeddown ; shadeddown := (2.5,0.5) ;
+pair shadedleft ; shadedleft := (1.5,3.5) ;
+pair shadedright ; shadedright := (3.5,1.5) ;
+
def withshadecenter expr a =
withprescript "sh_center_a=" & ddecimal (
center mfun_shade_path shifted (
@@ -518,10 +569,28 @@ def withshadefactor expr f =
withprescript "sh_factor=" & decimal f
enddef ;
+% def withshadebound (expr a) =
+% if mfun_shade_step > 0 :
+% withprescript "sh_bound_" & decimal mfun_shade_step & "=" & decimal a
+% fi
+% enddef ;
+
+def withshadefraction expr a =
+ if mfun_shade_step > 0 :
+ withprescript "sh_fraction_" & decimal mfun_shade_step & "=" & decimal a
+ fi
+enddef ;
+
def withshadecolors (expr a, b) =
- withprescript "sh_color=into"
- withprescript "sh_color_a=" & colordecimals a
- withprescript "sh_color_b=" & colordecimals b
+ if mfun_shade_step > 0 :
+ withprescript "sh_color=into"
+ withprescript "sh_color_a_" & decimal mfun_shade_step & "=" & colordecimals a
+ withprescript "sh_color_b_" & decimal mfun_shade_step & "=" & colordecimals b
+ else :
+ withprescript "sh_color=into"
+ withprescript "sh_color_a=" & colordecimals a
+ withprescript "sh_color_b=" & colordecimals b
+ fi
enddef ;
primarydef a shadedinto b = % withcolor red shadedinto green
@@ -746,9 +815,186 @@ def register (expr tag, width, height, offset) =
% ) ; % no transformations
enddef ;
+% outlines (todo: pass around less arguments)
+
+numeric currentoutlinetext ; currentoutlinetext := 0 ;
+
+vardef mfun_do_outline_text_flush (expr kind, n, x, y) (text t) =
+ if kind = "f" :
+ mfun_do_outline_text_f (n, x, y) (t)
+ elseif kind = "d" :
+ mfun_do_outline_text_d (n, x, y) (t)
+ elseif kind = "b" :
+ mfun_do_outline_text_b (n, x, y) (t)
+ elseif kind = "r" :
+ mfun_do_outline_text_r (n, x, y) (t)
+ elseif kind = "p" :
+ mfun_do_outline_text_p (n, x, y) (t)
+ else :
+ mfun_do_outline_text_n (n, x, y) (t)
+ fi ;
+enddef ;
+
+numeric mfun_do_outline_n ; mfun_do_outline_n := 0 ;
+
+vardef mfun_do_outline_text_f (expr n, x, y) (text t) =
+ mfun_do_outline_n := 0 ;
+ for i=t :
+ mfun_do_outline_n := mfun_do_outline_n + 1 ;
+ if mfun_do_outline_n = n :
+ fill i shifted(x,y) mfun_do_outline_options_f
+ else :
+ nofill i shifted(x,y)
+ fi ;
+ endfor ;
+enddef ;
+
+vardef mfun_do_outline_text_d (expr n, x, y) (text t) =
+ for i=t :
+ draw i shifted(x,y) mfun_do_outline_options_d ;
+ endfor ;
+enddef ;
+
+vardef mfun_do_outline_text_p (expr n, x, y) (text t) =
+ for i=t :
+ draw i shifted(x,y) ;
+ endfor ;
+enddef ;
+
+vardef mfun_do_outline_text_b (expr n, x, y) (text t) =
+ mfun_do_outline_n := 0 ;
+ for i=t :
+ mfun_do_outline_n := mfun_do_outline_n + 1 ;
+ if mfun_do_outline_n = n :
+ fill i shifted(x,y) mfun_do_outline_options_f
+ else :
+ nofill i shifted(x,y)
+ fi ;
+ endfor ;
+ for i=t :
+ draw i shifted(x,y) mfun_do_outline_options_d ;
+ endfor ;
+enddef ;
+
+vardef mfun_do_outline_text_r (expr n, x, y) (text t) =
+ mfun_do_outline_n := 0 ;
+ for i=t :
+ draw i shifted(x,y) mfun_do_outline_options_d ;
+ endfor ;
+ for i=t :
+ mfun_do_outline_n := mfun_do_outline_n + 1 ;
+ if mfun_do_outline_n = n :
+ fill i shifted(x,y) mfun_do_outline_options_f
+ else :
+ nofill i shifted(x,y)
+ fi ;
+ endfor ;
+enddef ;
+
+vardef mfun_do_outline_text_n (expr n, x, y) (text t) =
+ mfun_do_outline_n := 0 ;
+ for i=t :
+ mfun_do_outline_n := mfun_do_outline_n + 1 ;
+ if mfun_do_outline_n = n : fill else : nofill fi i shifted(x,y) ;
+ endfor ;
+enddef ;
+
+vardef mfun_do_outline_text_set_f (text f) text r =
+ def mfun_do_outline_options_f = f enddef ;
+ def mfun_do_outline_options_r = r enddef ;
+enddef ;
+
+vardef mfun_do_outline_text_set_d (text d) text r =
+ def mfun_do_outline_options_d = d enddef ;
+ def mfun_do_outline_options_r = r enddef ;
+enddef ;
+
+vardef mfun_do_outline_text_set_b (text f) (text d) text r =
+ def mfun_do_outline_options_f = f enddef ;
+ def mfun_do_outline_options_d = d enddef ;
+ def mfun_do_outline_options_r = r enddef ;
+enddef ;
+
+vardef mfun_do_outline_text_set_r (text d) (text f) text r =
+ def mfun_do_outline_options_d = d enddef ;
+ def mfun_do_outline_options_f = f enddef ;
+ def mfun_do_outline_options_r = r enddef ;
+enddef ;
+
+vardef mfun_do_outline_text_set_n text r =
+ def mfun_do_outline_options_r = r enddef ;
+enddef ;
+
+vardef mfun_do_outline_text_set_p =
+enddef ;
+
+def mfun_do_outline_options_d = enddef ;
+def mfun_do_outline_options_f = enddef ;
+def mfun_do_outline_options_r = enddef ;
+
+vardef outlinetext@# (expr t) text rest =
+ save kind ; string kind ; kind := str @# ;
+ currentoutlinetext := currentoutlinetext + 1 ;
+ image ( normaldraw image (
+ if mfun_trial_run :
+ % lua.mp.report("set outline text",currentoutlinetext);
+ normaldraw unitsquare
+ withprescript "ot_stage=trial"
+ withprescript "ot_index=" & decimal currentoutlinetext
+ withprescript "ot_kind=" & kind
+ withpostscript t ;
+ else :
+ % lua.mp.report("get outline text",currentoutlinetext);
+ if kind = "f" :
+ mfun_do_outline_text_set_f rest ;
+ elseif kind = "d" :
+ mfun_do_outline_text_set_d rest ;
+ elseif kind = "b" :
+ mfun_do_outline_text_set_b rest ;
+ elseif kind = "r" :
+ mfun_do_outline_text_set_r rest ;
+ elseif kind = "p" :
+ mfun_do_outline_text_set_p ;
+ else :
+ mfun_do_outline_text_set_n rest ;
+ fi ;
+ lua.mp.get_outline_text(currentoutlinetext) ;
+ fi ;
+ ) mfun_do_outline_options_r ; )
+enddef ;
+
+% A few helpers:
+
+numeric mfun_c_b_llx, mfun_c_b_h, mfun_c_b_w, mfun_c_b_l ;
+
+vardef checkedbounds(expr llx,lly,urx,ury) =
+ mfun_c_b_llx := min(xpart llcorner currentpicture,llx) ;
+ mfun_c_b_urx := max(xpart urcorner currentpicture,urx) ;
+ mfun_c_b_lly := min(ypart llcorner currentpicture,lly) ;
+ mfun_c_b_ury := max(ypart urcorner currentpicture,ury) ;
+ (mfun_c_b_llx,mfun_c_b_lly) --
+ (mfun_c_b_urx,mfun_c_b_lly) --
+ (mfun_c_b_urx,mfun_c_b_ury) --
+ (mfun_c_b_llx,mfun_c_b_ury) -- cycle
+enddef ;
+
+vardef checkbounds(expr llx,lly,urx,ury) =
+ setbounds currentpicture to checkedbounds(llx,lly,urx,ury) ;
+enddef ;
+
+vardef strut(expr ht,dp) =
+ setbounds currentpicture to checkedbounds(0,0,ht,dp) ;
+enddef ;
+
+vardef rule(expr wd,ht,dp) =
+ image (fill (0,-dp)--(wd,-dp)--(wd,ht)--(0,ht)--cycle)
+enddef ;
+
+
% Housekeeping
extra_beginfig := extra_beginfig & "currentgraphictext := 0 ; " ;
+extra_beginfig := extra_beginfig & "currentoutlinetext := 0 ; " ;
extra_endfig := extra_endfig & "finishsavingdata ; " ;
extra_endfig := extra_endfig & "mfun_reset_tex_texts ; " ;
@@ -1205,8 +1451,11 @@ vardef formatted(expr f, x) = textext(varfmt(f, x)) enddef ;
% new
-def eofill text t = fill t withpostscript "evenodd" enddef ;
-%%% eoclip text t = clip t withpostscript "evenodd" enddef ; % no postscripts yet
+def fillup text t = draw t withpostscript "both" enddef ; % we use draw because we need the proper boundingbox
+def eofillup text t = draw t withpostscript "eoboth" enddef ; % we use draw because we need the proper boundingbox
+def eofill text t = fill t withpostscript "evenodd" enddef ;
+def nofill text t = fill t withpostscript "collect" enddef ;
+%%% eoclip text t = clip t withpostscript "evenodd" enddef ; % no postscripts yet
% def withrule expr r =
% if (t = "even-odd") or (t = "evenodd") : withpostscript "evenodd" fi
diff --git a/metapost/context/base/mp-page.mpiv b/metapost/context/base/mpiv/mp-page.mpiv
index a6fa3fba3..2e4a2b437 100644
--- a/metapost/context/base/mp-page.mpiv
+++ b/metapost/context/base/mpiv/mp-page.mpiv
@@ -662,3 +662,34 @@ def Enlarged (expr p, d) =
urEnlarged (p,d) --
ulEnlarged (p,d) -- cycle)
enddef ;
+
+% for the moment we put these here:
+
+string RuleDirection ; RuleDirection := "" ;
+string RuleOption ; RuleOption := "" ;
+numeric RuleWidth ; RuleWidth := 0 ;
+numeric RuleHeight ; RuleHeight := 0 ;
+numeric RuleDepth ; RuleDepth := 0 ;
+numeric RuleThickness ; RuleThickness := 0 ;
+numeric RuleFactor ; RuleFactor := 0 ;
+numeric RuleOffset ; RuleOffset := 0 ;
+ def RuleColor = (.5white) enddef ;
+
+def FakeWord(expr RuleWidth, RuleHeight, RuleDepth, RuleThickness) (text RuleColor) =
+ fill unitsquare
+ xscaled RuleWidth
+ yscaled (RuleDepth-RuleThickness/2)
+ withcolor RuleColor ;
+ fill unitsquare
+ xscaled RuleWidth
+ yscaled (RuleHeight-RuleDepth-RuleThickness/2)
+ shifted (0,RuleDepth+RuleThickness)
+ withcolor RuleColor ;
+enddef ;
+
+def FakeRule(expr RuleWidth, RuleHeight, RuleDepth, RuleThickness) (text RuleColor) =
+ fill unitsquare
+ xscaled RuleWidth
+ yscaled RuleHeight
+ withcolor RuleColor ;
+enddef ;
diff --git a/metapost/context/base/mp-shap.mpiv b/metapost/context/base/mpiv/mp-shap.mpiv
index 713656510..713656510 100644
--- a/metapost/context/base/mp-shap.mpiv
+++ b/metapost/context/base/mpiv/mp-shap.mpiv
diff --git a/metapost/context/base/mp-step.mpiv b/metapost/context/base/mpiv/mp-step.mpiv
index f7a7ba5de..f7a7ba5de 100644
--- a/metapost/context/base/mp-step.mpiv
+++ b/metapost/context/base/mpiv/mp-step.mpiv
diff --git a/metapost/context/base/mp-symb.mp b/metapost/context/base/mpiv/mp-symb.mpiv
index a84c84e82..a84c84e82 100644
--- a/metapost/context/base/mp-symb.mp
+++ b/metapost/context/base/mpiv/mp-symb.mpiv
diff --git a/metapost/context/base/mp-text.mpiv b/metapost/context/base/mpiv/mp-text.mpiv
index b68e8412a..b68e8412a 100644
--- a/metapost/context/base/mp-text.mpiv
+++ b/metapost/context/base/mpiv/mp-text.mpiv
diff --git a/metapost/context/base/mp-tool.mpiv b/metapost/context/base/mpiv/mp-tool.mpiv
index e497e2f72..76459d25c 100644
--- a/metapost/context/base/mp-tool.mpiv
+++ b/metapost/context/base/mpiv/mp-tool.mpiv
@@ -330,6 +330,11 @@ vardef set_outer_boundingbox text q = % obsolete
setbounds q to outerboundingbox q;
enddef;
+% secondarydef a boundedto b = % will this cleanup ?
+% hide(picture mfun_a_b ; mfun_a_b := a ; setbounds mfun_a_b to b;)
+% mfun_a_b
+% enddef ;
+
%D Some missing functions can be implemented rather straightforward (thanks to
%D Taco and others):
@@ -817,13 +822,33 @@ def colortype(expr c) =
enddef ;
vardef whitecolor(expr c) =
- if cmykcolor c : (0,0,0,0) elseif rgbcolor c : (1,1,1) else : 1 fi
+ if cmykcolor c : (0,0,0,0) elseif rgbcolor c : (1,1,1) else : 1 fi
enddef ;
vardef blackcolor expr c =
if cmykcolor c : (0,0,0,1) elseif rgbcolor c : (0,0,0) else : 0 fi
enddef ;
+vardef complementary expr c = (
+ if cmykcolor c : (1,1,1,1) -
+ elseif rgbcolor c : (1,1,1) -
+ elseif pair c : (1,1) -
+ elseif numeric c : 1 -
+ fi c
+) enddef ;
+
+vardef complemented expr c =
+ save m ;
+ if cmykcolor c : m := max(cyanpart c, magentapart c, yellowpart c, blackpart c) ;
+ ( (m,m,m,m) -
+ elseif rgbcolor c : m := max(redpart c, greenpart c, bluepart c) ;
+ ( (m,m,m) -
+ elseif pair c : m := max(xpart c, ypart c) ;
+ ( (m,m) -
+ elseif numeric c : ( m -
+ fi c )
+enddef ;
+
%D Well, this is the dangerous and naive version:
def drawfill text t =
@@ -876,6 +901,12 @@ primarydef p rightenlarged d = ( llcorner p -- (lrcorner p) shifted (d,0) -- (u
primarydef p topenlarged d = ( llcorner p -- lrcorner p -- (urcorner p) shifted (0,d) -- (ulcorner p) shifted (0,d) -- cycle ) enddef ;
primarydef p bottomenlarged d = ( llcorner p shifted (0,-d) -- lrcorner p shifted (0,-d) -- urcorner p -- ulcorner p -- cycle ) enddef ;
+%D Handy as stepper:
+
+vardef rotation(expr i, n) =
+ if (n == 0) : 0 else : i * 360 / n fi
+enddef ;
+
%D Handy for testing/debugging:
primarydef p crossed d = (
@@ -1074,14 +1105,16 @@ def draworiginoptions (text t) = def _ori_opt_ = t enddef ; enddef ;
def drawboundoptions (text t) = def _bnd_opt_ = t enddef ; enddef ;
def drawpathoptions (text t) = def _pth_opt_ = t enddef ; enddef ;
+numeric drawoptionsfactor ; drawoptionsfactor := pt ;
+
def resetdrawoptions =
- drawlineoptions (withpen pencircle scaled 1pt withcolor .5white) ;
- drawpointoptions (withpen pencircle scaled 4pt withcolor black) ;
- drawcontroloptions(withpen pencircle scaled 2.5pt withcolor black) ;
+ drawlineoptions (withpen pencircle scaled 1.0 drawoptionsfactor withcolor .5white) ;
+ drawpointoptions (withpen pencircle scaled 4.0 drawoptionsfactor withcolor black) ;
+ drawcontroloptions(withpen pencircle scaled 2.5 drawoptionsfactor withcolor black) ;
drawlabeloptions () ;
- draworiginoptions (withpen pencircle scaled 1pt withcolor .5white) ;
+ draworiginoptions (withpen pencircle scaled 1.0 drawoptionsfactor withcolor .5white) ;
drawboundoptions (dashed evenly _ori_opt_) ;
- drawpathoptions (withpen pencircle scaled 5pt withcolor .8white) ;
+ drawpathoptions (withpen pencircle scaled 5.0 drawoptionsfactor withcolor .8white) ;
enddef ;
resetdrawoptions ;
@@ -1094,20 +1127,42 @@ enddef ;
%D Arrow.
+newinternal ahvariant ; ahvariant := 0 ;
+newinternal ahdimple ; ahdimple := 1/5 ;
+
+vardef arrowhead expr p =
+ save q, e, r ;
+ pair e ; e = point length p of p ;
+ path q ; q = gobble(p shifted -e cutafter makepath(pencircle scaled (2ahlength))) cuttings ;
+ if ahvariant > 0:
+ path r ; r = gobble(p shifted -e cutafter makepath(pencircle scaled ((1-ahdimple)*2ahlength))) cuttings ;
+ fi
+ (q rotated (ahangle/2) & reverse q rotated -(ahangle/2)
+ if ahvariant = 1 :
+ -- point 0 of r --
+ elseif ahvariant = 2 :
+ ... point 0 of r ...
+ else :
+ --
+ fi
+ cycle
+ ) shifted e
+enddef ;
+
vardef drawarrowpath expr p =
save autoarrows ; boolean autoarrows ; autoarrows := true ;
drawarrow p _pth_opt_
enddef ;
def midarrowhead expr p =
- arrowhead p cutafter (point length(p cutafter point .5 along p)+ahlength on p)
+ arrowhead p cutafter (point length(p cutafter point .5 along p) + ahlength on p)
enddef ;
vardef arrowheadonpath (expr p, s) =
save autoarrows ; boolean autoarrows ;
autoarrows := true ;
set_ahlength(scaled ahfactor) ; % added
- arrowhead p if s<1 : cutafter (point (s*arclength(p)+.5ahlength) on p) fi
+ arrowhead p if s < 1 : cutafter (point (s*arclength(p) + (ahlength/2)) on p) fi
enddef ;
%D Points.
@@ -1152,13 +1207,25 @@ def mfun_draw_controllines text t =
enddef;
boolean swappointlabels ; swappointlabels := false ;
+numeric pointlabelscale ; pointlabelscale := 0 ;
+string pointlabelfont ; pointlabelfont := "" ;
def mfun_draw_pointlabels text t =
for _i_=0 upto length(_c_) :
pair _u_ ; _u_ := unitvector(direction _i_ of _c_) rotated if swappointlabels : - fi 90 ;
pair _p_ ; _p_ := (point _i_ of _c_) ;
- _u_ := 12 * defaultscale * _u_ ;
+ begingroup ;
+ if pointlabelscale > 0 :
+ save defaultscale ; numeric defaultscale ;
+ defaultscale := pointlabelscale ;
+ fi ;
+ if pointlabelfont <> "" :
+ save defaultfont ; string defaultfont ;
+ defaultfont := pointlabelfont ;
+ fi ;
+ _u_ := 10 * drawoptionsfactor * defaultscale * _u_ ;
normaldraw thelabel ( decimal _i_, _p_ shifted if cycle _c_ and (_i_=0) : - fi _u_ ) _lab_opt_ t ;
+ endgroup ;
endfor ;
enddef;
@@ -1233,6 +1300,14 @@ def drawwholepath expr p =
drawpointlabels p ;
enddef ;
+def drawpathonly expr p =
+ drawpath p ;
+ drawcontrollines p ;
+ drawcontrolpoints p ;
+ drawpoints p ;
+ drawpointlabels p ;
+enddef ;
+
%D Tracing.
def visualizeddraw expr c =
@@ -1263,11 +1338,29 @@ def do_visualizedfill text t =
drawpointlabels _c_ ;
enddef ;
+def detaileddraw expr c =
+ if picture c : normaldraw c else : path _c_ ; _c_ := c ; do_detaileddraw fi
+enddef ;
+
+def do_detaileddraw text t =
+ drawpath _c_ t ;
+ drawcontrollines _c_ ;
+ drawcontrolpoints _c_ ;
+ drawpoints _c_ ;
+ % % for labels we need an third run (as the second will mark the numbers); i could preroll them
+ % % but then the hash needs to handle that as well (as now we keep numbering)
+ % drawpointlabels _c_ ;
+enddef ;
+
def visualizepaths =
let fill = visualizedfill ;
let draw = visualizeddraw ;
enddef ;
+def detailpaths =
+ let draw = detaileddraw ;
+enddef ;
+
def naturalizepaths =
let fill = normalfill ;
let draw = normaldraw ;
@@ -1314,7 +1407,10 @@ enddef ;
%D \METAPOST\ definitions.
vardef arrowpath expr p = % patch by Peter Rolf: supports squared pen and shifting (hh: maybe just use center of head as first)
- (p cutafter makepath(pencircle scaled 2(ahlength*cosd(.5ahangle)) shifted point length p of p))
+ (p cutafter makepath(pencircle
+ scaled (if ahvariant > 0 : (1-ahdimple)* fi 2ahlength*cosd(ahangle/2))
+ shifted point length p of p
+ ))
enddef;
% def _finarr text t =
@@ -1323,18 +1419,24 @@ enddef;
% filldraw arrowhead _apth t ;
% enddef;
-def _finarr text t =
- if autoarrows : set_ahlength (t) fi ;
- draw arrowpath _apth t ; % arrowpath added
- fill arrowhead _apth t ;
- draw arrowhead _apth t ;
-enddef;
+% def _finarr text t =
+% if autoarrows : set_ahlength (t) fi ;
+% draw arrowpath _apth t ; % arrowpath added
+% fill arrowhead _apth t ;
+% draw arrowhead _apth t ;
+% enddef;
+
+% def _finarr text t =
+% if autoarrows : set_ahlength (t) fi ;
+% draw arrowpath _apth t ; % arrowpath added
+% fill arrowhead _apth t ;
+% draw arrowhead _apth t undashed ;
+% enddef;
def _finarr text t =
if autoarrows : set_ahlength (t) fi ;
draw arrowpath _apth t ; % arrowpath added
- fill arrowhead _apth t ;
- draw arrowhead _apth t undashed ;
+ fillup arrowhead _apth t ;
enddef;
%D Handy too ......
@@ -1631,6 +1733,22 @@ enddef ;
let greyed = grayed ;
+vardef hsvtorgb(expr h,s,v) =
+ save H, S, V, x ;
+ H = h mod 360 ;
+ S = if s < 0 : 0 elseif s > 1 : 1 else: s fi ;
+ V = if v < 0 : 0 elseif v > 1 : 1 else: v fi ;
+ x = 1 - abs(H mod 120 - 60)/60 ;
+ V * ( (1-S) * (1,1,1) + S *
+ if H < 60 : (1,x,0)
+ elseif H < 120 : (x,1,0)
+ elseif H < 180 : (0,1,x)
+ elseif H < 240 : (0,x,1)
+ elseif H < 300 : (x,0,1)
+ else : (1,0,x)
+ fi )
+enddef ;
+
% yes or no: "text" infont "cmr12" at 24pt ;
% let normalinfont = infont ;
@@ -2110,7 +2228,7 @@ if unknown darkcyan : color darkcyan ; darkcyan := .625(0,1,1) fi ;
if unknown darkmagenta : color darkmagenta ; darkmagenta := .625(1,0,1) fi ;
if unknown darkyellow : color darkyellow ; darkyellow := .625(1,1,0) fi ;
if unknown darkgray : color darkgray ; darkgray := .625(1,1,1) fi ;
-if unknown lightgray : color lightgray ; lightgray := .875(1,1,1) fi ;
+if unknown lightgray : color lightgray ; lightgray := .850(1,1,1) fi ;
% an improved plain mp macro