ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: internal mptopdf conversion fails on older mps file (using MkIV, beta 2013.12.26)
Date: Thu, 02 Jan 2014 19:30:08 +0100	[thread overview]
Message-ID: <52C5B030.1050706@wxs.nl> (raw)
In-Reply-To: <87txdme06m.fsf@approx.mit.edu>

On 1/2/2014 6:57 PM, Sanjoy Mahajan wrote:
> The MkIV internal mptopdf converter fails on the following minimal example.
> Here is the tex:
>
> ------- cut test2.tex here -------------
> \enabletrackers[graphics.conversion,graphics.inclusion,fonts.mapfiles,fonts.loading,fonts.missing,fonts.mapping]
> \starttext
> \externalfigure[fig.1][frame=on]
> \blank
> \externalfigure[fig-1.pdf][frame=on]
> \stoptext
> ------- cut test2.tex here -------------
>
> And here is the figure, which was produced with mpost 0.993 (and also
> converted to fig-1.pdf using the 'mptopdf' command):
>
> -------- cut fig.1 here ------------
> %!PS-Adobe-3.0 EPSF-3.0
> %%BoundingBox: 0 0 10 10
> %%HiResBoundingBox: 0 0 9.96262 9.96262
> %%Creator: MetaPost 0.993
> %%CreationDate: 2009.10.21:1318
> %%Pages: 1
> %%BeginProlog
> /bd{bind def}bind def
> /hlw{0 dtransform exch truncate exch idtransform pop setlinewidth}bd
> /vlw{0 exch dtransform truncate idtransform setlinewidth pop}bd
> /l{lineto}bd/r{rlineto}bd/c{curveto}bd/m{moveto}bd/p{closepath}bd/n{newpath}bd
> /C{setcmykcolor}bd/G{setgray}bd/R{setrgbcolor}bd/lj{setlinejoin}bd/ml{setmiterlimit}bd
> /lc{setlinecap}bd/S{stroke}bd/F{fill}bd/q{gsave}bd/Q{grestore}bd/s{scale}bd/t{concat}bd
> /sd{setdash}bd/rd{[] 0 setdash}bd/P{showpage}bd/B{q F Q}bd/W{clip}bd
> %%EndProlog
> %%Page: 1 1
>   0.7 G
> n 0 0 m
> 0 9.96262 l
> 9.96262 4.98131 l
>   p F
> P
> %%EOF
> -------- cut fig.1 here ------------
>
> Running it through MkIV with the 2013.12.26 beta (or the stable context)
> produces an empty frame for the inclusion of fig.1, but the correct
> triangle for the inclusion of fig-1.pdf.  The empty frame has the
> correct size, so the parser is getting at least as far as the bounding
> box.
>
> If I regenerate fig.1 using a recent metapost (1.803), the mps file is
> simpler, and it is incorporated correctly by context.
>
> -------- cut fig.1 produced with recent metapost here ------------
> %!PS
> %%BoundingBox: 0 0 10 10
> %%HiResBoundingBox: 0 0 9.96262 9.96262
> %%Creator: MetaPost 1.803
> %%CreationDate: 2014.01.02:1250
> %%Pages: 1
> %%BeginProlog
> %%EndProlog
> %%Page: 1 1
>   0.7 setgray
> newpath 0 0 moveto
> 0 9.96262 lineto
> 9.96262 4.98131 lineto
>   closepath fill
> showpage
> %%EOF
> -------- cut fig.1 produced with recent metapost here ------------
>
> Here is the source file:
>
> --- cut fig.mp here -----
> def darkshaded = withgreyscale 0.70 enddef;
> beginfig(1)
>    fill (origin--(0,1)--(1,1/2)--cycle) scaled 10pt darkshaded;
> endfig;
> --- cut fig.mp here -----

weird, there used to be a procset line ... anyhow, maybe this works ok 
at your end (meta-pdf.lua):

local function parse(m_data)
     if find(m_data,"%%%%BeginResource: procset mpost") then
      -- report_mptopdf("using sparse scanner, case 1")
         lpegmatch(captures_new,m_data)
     elseif find(m_data,"%%%%BeginProlog%s*%S+(.-)%%%%EndProlog") then
      -- report_mptopdf("using sparse scanner, case 2")
         lpegmatch(captures_new,m_data)
     else
      -- report_mptopdf("using verbose ps scanner")
         lpegmatch(captures_old,m_data)
     end
end



-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2014-01-02 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-02 17:57 Sanjoy Mahajan
2014-01-02 18:30 ` Hans Hagen [this message]
2014-01-03 12:46   ` Sanjoy Mahajan

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=52C5B030.1050706@wxs.nl \
    --to=pragma@wxs.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).