ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* mp to pdf inline conversion adds whitespace (2006.09.26 beta)
@ 2006-09-26 18:31 Sanjoy Mahajan
  2006-09-26 19:44 ` Hans Hagen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sanjoy Mahajan @ 2006-09-26 18:31 UTC (permalink / raw)


I'm using the 2006.09.26 beta, and noticed an extra gap before some
external metapost figures.  Here is a small test:

============================ test.mp =================
beginfig(1)
  draw fullcircle scaled (0.75in) xscaled 1.5;
endfig;
end
======================================================

With this test file, there is a whitespace of about 1cm between the
first hairline and the ellipse:
=================== test.tex (has 1cm gap) ===========
\starttext
\hrule
\placefigure[force,none]{}{\externalfigure[test.1]}
\hrule
\stoptext
======================================================

If I convert test.1 to test-1.pdf and include that, all is fine:
=================== test.tex (works) =================
\starttext
\hrule
\placefigure[force,none]{}{\externalfigure[test-1.pdf]}
\hrule
\stoptext
======================================================

If test.mp draws a square or rectangle instead of an ellipse, then
there's no difference (both versions of test.tex work).

-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   -- Bertrand de Jouvenal

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

* Re: mp to pdf inline conversion adds whitespace (2006.09.26 beta)
  2006-09-26 18:31 mp to pdf inline conversion adds whitespace (2006.09.26 beta) Sanjoy Mahajan
@ 2006-09-26 19:44 ` Hans Hagen
  2006-09-26 20:05   ` Hans Hagen
  2006-09-26 19:45 ` Hans Hagen
  2006-09-26 20:04 ` Hans Hagen
  2 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2006-09-26 19:44 UTC (permalink / raw)


Sanjoy Mahajan wrote:
> I'm using the 2006.09.26 beta, and noticed an extra gap before some
> external metapost figures.  Here is a small test:
>
> ============================ test.mp =================
> beginfig(1)
>   draw fullcircle scaled (0.75in) xscaled 1.5;
> endfig;
> end
> ======================================================
>
> With this test file, there is a whitespace of about 1cm between the
> first hairline and the ellipse:
> =================== test.tex (has 1cm gap) ===========
> \starttext
> \hrule
> \placefigure[force,none]{}{\externalfigure[test.1]}
> \hrule
> \stoptext
> ======================================================
>
> If I convert test.1 to test-1.pdf and include that, all is fine:
> =================== test.tex (works) =================
> \starttext
> \hrule
> \placefigure[force,none]{}{\externalfigure[test-1.pdf]}
> \hrule
> \stoptext
> ======================================================
>
> If test.mp draws a square or rectangle instead of an ellipse, then
> there's no difference (both versions of test.tex work).
>   
that's indeed weird, any hypothesis to start from?

Hans

-- 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: mp to pdf inline conversion adds whitespace (2006.09.26 beta)
  2006-09-26 18:31 mp to pdf inline conversion adds whitespace (2006.09.26 beta) Sanjoy Mahajan
  2006-09-26 19:44 ` Hans Hagen
@ 2006-09-26 19:45 ` Hans Hagen
  2006-09-27  4:31   ` Sanjoy Mahajan
  2006-09-26 20:04 ` Hans Hagen
  2 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2006-09-26 19:45 UTC (permalink / raw)


Sanjoy Mahajan wrote:
>
> If test.mp draws a square or rectangle instead of an ellipse, then
> there's no difference (both versions of test.tex work).
>   
looks like a bbox error 

Hans  

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: mp to pdf inline conversion adds whitespace (2006.09.26 beta)
  2006-09-26 18:31 mp to pdf inline conversion adds whitespace (2006.09.26 beta) Sanjoy Mahajan
  2006-09-26 19:44 ` Hans Hagen
  2006-09-26 19:45 ` Hans Hagen
@ 2006-09-26 20:04 ` Hans Hagen
  2 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2006-09-26 20:04 UTC (permalink / raw)


Hi

in core-fig.tex patch:

\def\dogetfiguresizeeps
  
{\dogetEPSboundingbox\wantedfigurefullname\!!widtha\!!heighta\!!widthb\!!heightb
   \xdef\analyzedfigurewidth {\the\!!widthb}%
   \xdef\analyzedfigureheight{\the\!!heightb}}

somehow i assumed that i was dealing with bbox values

thanks for testing the beta

Hans 


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: mp to pdf inline conversion adds whitespace (2006.09.26 beta)
  2006-09-26 19:44 ` Hans Hagen
@ 2006-09-26 20:05   ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2006-09-26 20:05 UTC (permalink / raw)


btw, a convenient way to visualize such thing sis:


\placefigure[force,none]{}{\externalfigure[test.1][frame=on]}
\placefigure[force,none]{}{\externalfigure[test-1.pdf][frame=on]}

i.e. it was not related to spacing around the float, but a problem in 
the rewrite of core-fig

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

* Re: mp to pdf inline conversion adds whitespace (2006.09.26 beta)
  2006-09-26 19:45 ` Hans Hagen
@ 2006-09-27  4:31   ` Sanjoy Mahajan
  2006-09-27  8:05     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Sanjoy Mahajan @ 2006-09-27  4:31 UTC (permalink / raw)


Hans Hagen <pragma@wxs.nl> wrote:
> > If test.mp draws a square or rectangle instead of an ellipse, then
> > there's no difference (both versions of test.tex work).

> looks like a bbox error 

I didn't think so, because after mptopdf got hold of the figure, the
whitespace around the figure was right and mptopdf should have used the
bbox in the figure.  So my only guess was that the internal conversion
to pdf was getting confused somewhere.

>> If test.mp draws a square or rectangle instead of an ellipse, then
>> there's no difference (both versions of test.tex work).
> that's indeed weird, any hypothesis to start from?

My hypothesis was refuted by testing the rectangle.  I had hoped (if
that's the right word) that the internal conversion was using the width
where it should have used the height, which is why the ellipse would
cause problems.  Which is why I tried the square, and it was fine --
more evidence for the theory.  But the rectangle was fine, so my theory
died.

> in core-fig.tex patch:
> \def\dogetfiguresizeeps
> {\dogetEPSboundingbox\wantedfigurefullname\!!widtha\!!heighta\!!widthb\!!heightb
>   \xdef\analyzedfigurewidth {\the\!!widthb}%
>   \xdef\analyzedfigureheight{\the\!!heightb}}
> somehow i assumed that i was dealing with bbox values

That fixes it here, thanks.  I see what happened with my test cases now.
The ellipse had its lower left corner away from the origin, so the old
analyzedfigureheight was larger than it should have been.  But the
rectangle and square start at the origin, so you don't see the effect.

> btw, a convenient way to visualize such thing sis:
> \placefigure[force,none]{}{\externalfigure[test.1][frame=on]}
> \placefigure[force,none]{}{\externalfigure[test-1.pdf][frame=on]}

Good to know.  Plus I was wondering how to do that anyway.

-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   -- Bertrand de Jouvenal

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

* Re: mp to pdf inline conversion adds whitespace (2006.09.26 beta)
  2006-09-27  4:31   ` Sanjoy Mahajan
@ 2006-09-27  8:05     ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2006-09-27  8:05 UTC (permalink / raw)


Sanjoy Mahajan wrote:
>
> My hypothesis was refuted by testing the rectangle.  I had hoped (if
> that's the right word) that the internal conversion was using the width
> where it should have used the height, which is why the ellipse would
> cause problems.  Which is why I tried the square, and it was fine --
> more evidence for the theory.  But the rectangle was fine, so my theory
> died.
>   
try a fullsquare instead of a unitsquare -)

fullcircle circle around the origin

draw origin withpen pencircle scaled 1mm ;
>
> Good to know.  Plus I was wondering how to do that anyway.
>   
\ruledhbox{something} 

also works ok  

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

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

end of thread, other threads:[~2006-09-27  8:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-26 18:31 mp to pdf inline conversion adds whitespace (2006.09.26 beta) Sanjoy Mahajan
2006-09-26 19:44 ` Hans Hagen
2006-09-26 20:05   ` Hans Hagen
2006-09-26 19:45 ` Hans Hagen
2006-09-27  4:31   ` Sanjoy Mahajan
2006-09-27  8:05     ` Hans Hagen
2006-09-26 20:04 ` Hans Hagen

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).