ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* improper sizes with pixel unit in MPinitialisation
@ 2010-10-28 10:12 Peter Rolf
  2010-10-28 10:18 ` Taco Hoekwater
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Rolf @ 2010-10-28 10:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

Hi,

I started using 'MPinitialisation' to store some global variables. Much
easier than passing them over and over again to MP macros. Sadly this
way is inaccurate with the unit 'px' (no such problems with 'pt').
See attached example. The frame gives the exact size, showing that the
MP graphic is 'out of bounds'.

MTXrun | current version: 2010.10.22 16:46
same result for both marks


Peter



[-- Attachment #2: pixel.tex --]
[-- Type: text/plain, Size: 428 bytes --]

\setuppagenumber[state=stop]

\pdfpxdimen49336sp

\startMPinitializations
    px:= .7528125;
    fooWidth  := 600px;
    fooHeight := 400px;
\stopMPinitializations

\startuniqueMPgraphic{foo}
    fill unitsquare xyscaled(fooWidth,fooHeight) withcolor transparent(1,0.2,blue);
\stopuniqueMPgraphic

\starttext
\framed[offset=overlay,width=600px,height=400px,framecolor=darkblue]{\uniqueMPgraphic{foo}}
\stoptext

[-- Attachment #3: pixel.pdf --]
[-- Type: application/pdf, Size: 1522 bytes --]

[-- Attachment #4: Type: text/plain, Size: 486 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: improper sizes with pixel unit in MPinitialisation
  2010-10-28 10:12 improper sizes with pixel unit in MPinitialisation Peter Rolf
@ 2010-10-28 10:18 ` Taco Hoekwater
  0 siblings, 0 replies; 2+ messages in thread
From: Taco Hoekwater @ 2010-10-28 10:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 10/28/2010 12:12 PM, Peter Rolf wrote:
> Hi,
>
> I started using 'MPinitialisation' to store some global variables. Much
> easier than passing them over and over again to MP macros. Sadly this
> way is inaccurate with the unit 'px' (no such problems with 'pt').
> See attached example. The frame gives the exact size, showing that the
> MP graphic is 'out of bounds'.

Probably because metapost calculates in printer points of 72pt/in,
instead of tex's 72.27pt/in. So your mp scale factor is likely to
be a little off.

Best wishes,
Taco
___________________________________________________________________________________
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
___________________________________________________________________________________


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

end of thread, other threads:[~2010-10-28 10:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 10:12 improper sizes with pixel unit in MPinitialisation Peter Rolf
2010-10-28 10:18 ` Taco Hoekwater

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