ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* lmt_followtext crashes while standard followtext itself works
@ 2020-05-03 21:47 Gerben Wierda
  2020-05-04  8:30 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Gerben Wierda @ 2020-05-03 21:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4576 bytes --]

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.

G

[-- Attachment #1.2: Type: text/html, Size: 15800 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: lmt_followtext crashes while standard followtext itself works
  2020-05-03 21:47 lmt_followtext crashes while standard followtext itself works Gerben Wierda
@ 2020-05-04  8:30 ` Hans Hagen
  2020-05-04  9:20   ` Gerben Wierda
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2020-05-04  8:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Gerben Wierda

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: lmt_followtext crashes while standard followtext itself works
  2020-05-04  8:30 ` Hans Hagen
@ 2020-05-04  9:20   ` Gerben Wierda
  0 siblings, 0 replies; 3+ messages in thread
From: Gerben Wierda @ 2020-05-04  9:20 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

> 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

Applied and tested, it works fine.

And it also provided me with an insight about if:else:fi that was slow in coming but now that I see it, I think “Duh, you should have realised that much sooner”.

Thanks,

G

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-04  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-03 21:47 lmt_followtext crashes while standard followtext itself works Gerben Wierda
2020-05-04  8:30 ` Hans Hagen
2020-05-04  9:20   ` Gerben Wierda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).