summaryrefslogtreecommitdiff
path: root/metapost/context
diff options
context:
space:
mode:
Diffstat (limited to 'metapost/context')
-rw-r--r--metapost/context/base/mpiv/mp-blob.mpiv5
-rw-r--r--metapost/context/base/mpiv/mp-lmtx.mpxl23
2 files changed, 27 insertions, 1 deletions
diff --git a/metapost/context/base/mpiv/mp-blob.mpiv b/metapost/context/base/mpiv/mp-blob.mpiv
index dd147bede..8808b5df6 100644
--- a/metapost/context/base/mpiv/mp-blob.mpiv
+++ b/metapost/context/base/mpiv/mp-blob.mpiv
@@ -91,7 +91,10 @@ vardef followtext(expr pth, txt) =
at := arctime pos of pat ;
ap := point at of pat ;
ad := direction at of pat ;
- pic[i] := pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap ;
+ pic[i] := pic[i]
+ shifted (-wid/2,0)
+ if ad <> origin : rotated(angle(ad)) fi
+ shifted ap ;
draw pic[i] ;
if tracingfollowtext = 1 :
draw boundingbox pic[i] withpen pencircle scaled .25pt withcolor red ;
diff --git a/metapost/context/base/mpiv/mp-lmtx.mpxl b/metapost/context/base/mpiv/mp-lmtx.mpxl
index 543569822..1f70d0ac1 100644
--- a/metapost/context/base/mpiv/mp-lmtx.mpxl
+++ b/metapost/context/base/mpiv/mp-lmtx.mpxl
@@ -2256,3 +2256,26 @@ vardef svgtext(expr t) =
enddef ;
vardef svg expr c = lmt_svg [ code = c ] enddef ;
+
+% Fun stuff:
+
+presetparameters "poisson" [
+ width = 50,
+ height = 50,
+ initialx = 0,
+ initialy = 0,
+ distance = 1,
+ count = 20,
+ macro = "draw",
+ arguments = 2
+] ;
+
+def lmt_poisson = applyparameters "poisson" "lmt_do_poisson" enddef ;
+
+vardef lmt_do_poisson =
+ image (
+ pushparameters "poisson" ;
+ lua.mp.lmt_poisson_generate();
+ popparameters ;
+ )
+enddef ;