On 5/3/2020 11:47 PM, Gerben Wierda wrote:
The following example has been extracted from my automatically generated
MP code.
\starttext
\startMPpage
string texstring;
texstring := "{\colored [r=0.00, g=0.00, b=0.00]{\definebodyfont
[9.0pt][rm][default=Regular at 9.0pt]\switchtobodyfont
[9.0pt]\setupinterlinespace [9.9pt]\tf E.g. publish/ subscribe}}";
path parpath;
parpath :=
(238,-167.00010681152344)..controls (238,-167.00010681152344) and
(238,-167.00010681152344)
..(238,-167.00010681152344)..controls (238,-166.60010673470143) and
(238,-166.20010665787942)
..(238,-165.80010658105741)..controls (238,-165.40010643392299) and
(238,-165.00010628678857)
..(238,-164.60010613965414)..controls (238,-164.2001060472048) and
(238,-163.80010595475545)
..(238,-163.40010586230611)..controls (238,-155.56353466513065) and
(231.9683162849897,-149)
..(224.2552179837387,-149)..controls (223.85521783436539,-149) and
(223.45521768499208,-149)
..(223.05521753561877,-149)..controls (222.65521740514737,-149) and
(222.255217274676,-149)
..(221.8552171442046,-149)..controls (221.45521705001735,-149) and
(221.0552169558301,-149)
..(220.65521686164286,-149)..controls (220.25521665589685,-149) and
(219.85521645015083,-149)
..(219.45521624440482,-149)..controls (219.05521631807508,-149) and
(218.65521639174534,-149)
..(218.2552164654156,-149)..controls (217.85521724037432,-149) and
(217.45521801533303,-149)
..(217.05521879029175,-149)..controls (216.6552203077878,-149) and
(216.25522182528385,-149)
..(215.85522334277991,-149)..controls (215.45522405083273,-149) and
(215.05522475888554,-149)
..(214.65522546693836,-149)..controls (214.25522550518758,-149) and
(213.8552255434368,-149)
..(213.45522558168602,-149)..controls (213.0552253720042,-149) and
(212.65522516232238,-149)
..(212.25522495264056,-149)..controls (211.8552248680295,-149) and
(211.45522478341843,-149)
..(211.05522469880736,-149)..controls (210.65522456100436,-149) and
(210.25522442320135,-149)
..(209.85522428539835,-149)..controls (209.45522414149036,-149) and
(209.05522399758237,-149)
..(208.65522385367439,-149)..controls (200.95716230583835,-149) and
(195,-155.63452868682958)
..(195,-163.48966401016395)..controls (195,-163.88966411101083) and
(195,-164.28966421185771)
..(195,-164.68966431270459)..controls (195,-165.08966445890775) and
(195,-165.4896646051109)
..(195,-165.88966475131406)..controls (195,-166.25981210471718) and
(195,-166.62995945812031)
..(195,-167.00010681152344);
picture pic;
pic := lmt_followtext [
text = texstring,
path = parpath,
spread = false,
];
\stopMPpage
\stoptext
lmt_followtext crashes on this code with:
metapost log > ! angle(0,0) is taken as zero.
metapost log > <for(1)> ...0)]shifted(-wid/2,0)rotated(angle(ad))
metapost log >
shifted.ap;draw.pic[(EXPR0...
metapost log > <argument> ...caled0.5pt.withcolor.green;fi;endfor
metapost log >
;if((autoscaleupfollowtext...
metapost log >
metapost log > image->...ture;currentpicture:=nullpicture;(TEXT3)
metapost log >
;currentpicture.if.str(SUF...
metapost log >
metapost log > followtext->...b_n;setbounds.currentpicture.to.b;)
metapost log > endgroup
metapost log > <argument> ...parameter"path"),getparameter"text")
metapost log >
;popparameters;
metapost log > image->...ture;currentpicture:=nullpicture;(TEXT3)
metapost log >
;currentpicture.if.str(SUF...
metapost log >
metapost log > lmt_do_followtext->...meter"text");popparameters;)
metapost log > endgroup
metapost log > <scantokens> lmt_do_followtext
metapost log >
metapost log > <*> ...exstring, path = parpath, spread = false, ]
metapost log > ; ;
When I adapt the parameters that create parpath in my code, other uses
of lmt_followtext crash. The same combinations of text and path so far
haven’t crashed basic followtext().
I’ve run into comparable situations in my own code where I had to add
code to handle the existence of a (0,0) direction (e.g. when I had two
identical points on a path, but that is not the case here). The above
minimal example triggers the failure.
we can patch this
if ad <> origin : rotated(angle(ad)) fi
in mp-blob.mpiv but I expect you to test if all still works then
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________