diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-05-31 09:46:19 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-05-31 09:46:19 +0200 |
commit | a274872832cdd1e71ce4b019858c61c5a77c6b98 (patch) | |
tree | 31aac20468007968eb094db54e530a00a7fec5ff /metapost | |
parent | 66f653890a45d1275826d56798071a97468d88be (diff) | |
download | context-a274872832cdd1e71ce4b019858c61c5a77c6b98.tar.gz |
2016-05-31 09:07:00
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mpiv/mp-abck.mpiv | 38 | ||||
-rw-r--r-- | metapost/context/base/mpiv/mp-mlib.mpiv | 2 |
2 files changed, 39 insertions, 1 deletions
diff --git a/metapost/context/base/mpiv/mp-abck.mpiv b/metapost/context/base/mpiv/mp-abck.mpiv index abd7d8848..68706b1d9 100644 --- a/metapost/context/base/mpiv/mp-abck.mpiv +++ b/metapost/context/base/mpiv/mp-abck.mpiv @@ -267,3 +267,41 @@ enddef ; def anchor_box (expr n,x,y,w,h,d) = currentpicture := currentpicture shifted (-x,-y) ; enddef ; + +vardef shaped (suffix p) = + save l ; pair l[] ; + save r ; pair r[] ; + save i ; i := 1 ; + save n ; n := 0 ; + forever : + exitif unknown p[i] ; + n := n + 1 ; + l[n] := ulcorner p[i] ; + r[n] := urcorner p[i] ; + n := n + 1 ; + l[n] := llcorner p[i] ; + r[n] := lrcorner p[i] ; + i := i + 1 ; + endfor ; + for i = 3 upto n : + if xpart r[i] < xpart r[i-1] : + r[i] := (xpart r[i],ypart r[i-1]) ; + elseif xpart r[i] > xpart r[i-1] : + r[i] := (xpart r[i],ypart r[i-1]) ; + fi ; + if xpart l[i] < xpart l[i-1] : + l[i] := (xpart l[i],ypart l[i-1]) ; + elseif xpart l[i] > xpart l[i-1] : + l[i] := (xpart l[i],ypart l[i-1]) ; + fi ; + endfor ; + if n > 0 : + simplified ( + for i = 1 upto n : r[i] -- endfor + for i = n downto 1 : l[i] -- endfor + cycle + ) + else : + origin -- cycle + fi +enddef ; diff --git a/metapost/context/base/mpiv/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv index 326342b70..c4f447d41 100644 --- a/metapost/context/base/mpiv/mp-mlib.mpiv +++ b/metapost/context/base/mpiv/mp-mlib.mpiv @@ -842,7 +842,7 @@ vardef mfun_do_outline_text_f (expr n, x, y) (text t) = 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 + fill i shifted(x,y) mfun_do_outline_options_f withpen pencircle scaled 0 else : nofill i shifted(x,y) fi ; |