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 : [email protected] / 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
___________________________________________________________________________________