ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Gerben Wierda <gerben.wierda@rna.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: lmt_followtext crashes while standard followtext itself works
Date: Sun, 3 May 2020 23:47:04 +0200	[thread overview]
Message-ID: <EBC0F989-EED1-4249-B72D-D2C199B6775E@rna.nl> (raw)


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

             reply	other threads:[~2020-05-03 21:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 21:47 Gerben Wierda [this message]
2020-05-04  8:30 ` Hans Hagen
2020-05-04  9:20   ` Gerben Wierda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EBC0F989-EED1-4249-B72D-D2C199B6775E@rna.nl \
    --to=gerben.wierda@rna.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).