[dev-context] texexec --scale=2 buglet (PATCH)

Sanjoy Mahajan sanjoy at mrao.cam.ac.uk
Wed Nov 29 13:56:16 CET 2006


Hans,

> \getfiguredimensions
> a few lines earlier will calculate the scaled width which is then used

I ran a test:

==================================================================
$ cat xyz.mp
beginfig(1)
  draw unitsquare scaled 2in;
endfig;
end

$ mpost xyz
...
$ mptopdf xyz.1
...
$ texexec --pdfcopy --scale=3000 --result=one xyz-1.pdf
...
$ pdfinfo xyz-1.pdf  /* original dimensions are 2in * 2in, plus 0.5bp margin */
Creator:        TeX
Producer:       pdfeTeX-1.30.6
CreationDate:   Wed Nov 29 07:49:43 2006
Page size:      144.5 x 144.5 pts

$ pdfinfo one.pdf  /* it's still 2in*2in despite the scale=3000 */
Creator:        ConTeXt - 2006.11.22 11:02
Producer:       pdfeTeX-1.30.6
CreationDate:   Wed Nov 29 07:50:14 2006
Page size:      144.5 x 144.5 pts

/* Also, the square is invisible, because it extends beyond the page.
   Using scale=600 also leaves the page size unchanged, but the square
   is now visible. */

==============================================================

The problem is that \getfiguredimensions doesn't yet know the scale.
Here's the lines from texexec.rb that write to the temporary source
file.  The first use of the ruby 'scale' variable is in \copypages,
but the \getfiguredimensions has already happened.

                    f << "\\starttext\n"
                    files.each do |filename|
                        result = @commandline.checkedoption('result','texexec')
                        if (filename !~ /^texexec/io) && (filename !~ /^#{result}/) then
                            report("copying file: #{filename}")
                            f <<  "\\getfiguredimensions\n"
                            f <<  "  [#{filename}]\n"
                            f <<  "  [page=1"
                            f <<  ",\n   size=trimbox" if trim
                            f <<  "]\n"
                            f <<  "\\definepapersize\n"
                            f <<  "  [copy]\n"
                            f <<  "  [width=\\figurewidth,\n"
                            f <<  "   height=\\figureheight]\n"
                            f <<  "\\setuppapersize\n"
                            f <<  "  [copy][copy]\n"
                            f <<  "\\setuplayout\n"
                            f <<  "  [page]\n"
                            f <<  "\\setupexternalfigures\n"
                            f <<  "  [directory=]\n"
                            f <<  "\\copypages\n"
                            f <<  "  [#{filename}]\n"
                            f <<  "  [scale=#{scale},\n"
                            f <<  "   marking=on,\n" if @commandline.option('markings')
                            f <<  "   size=trimbox,\n" if trim
                            f <<  "   offset=#{paperoffset}]\n"
                        end
                    end
                    f << "\\stoptext\n"
                    f.close

-Sanjoy

`Never underestimate the evil of which men of power are capable.'
         --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.



More information about the dev-context mailing list