diff options
author | Hans Hagen <pragma@wxs.nl> | 2007-12-31 11:54:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2007-12-31 11:54:00 +0100 |
commit | f5db49f15c3f9ec7dba40d6120b89df2cd0030ff (patch) | |
tree | 46248003cc54a3c00875c0dd9fd692d9b2631ddc /metapost | |
parent | fd7a16a8cc13f71119d5fbad9a395cd3d2107d89 (diff) | |
download | context-f5db49f15c3f9ec7dba40d6120b89df2cd0030ff.tar.gz |
stable 2007.12.31 11:54
Diffstat (limited to 'metapost')
-rw-r--r-- | metapost/context/base/mp-tool.mp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/metapost/context/base/mp-tool.mp b/metapost/context/base/mp-tool.mp index 01114bfac..a98f73922 100644 --- a/metapost/context/base/mp-tool.mp +++ b/metapost/context/base/mp-tool.mp @@ -2377,6 +2377,35 @@ def break = exitif true fi ; enddef ; +%D New too: + +primarydef p xstretched w = + (p if (bbwidth (p)>0) and (w>0) : xscaled (w/bbwidth (p)) fi) +enddef ; + +primarydef p ystretched h = + (p if (bbheight(p)>0) and (h>0) : yscaled (h/bbheight(p)) fi) +enddef ; + +primarydef p snapped s = + hide ( if path p : + forever : + exitif (bbheight(p) <= s) and (bbwidth(p) <= s) ; + p := p scaled (1/2) ; + endfor ; + elseif numeric p : + forever : + exitif p <= s ; + p := p scaled (1/2) ; + endfor ; + fi ; ) + p +enddef ; + % done endinput ; + +end + +end |