#40383 mgp2ps can write outside paper

Package:
mgp
Source:
mgp
Description:
MagicPoint — an X11-based presentation tool
Submitter:
Yann Dirson
Date:
2005-07-18 03:58:30 UTC
Severity:
normal
#40383#5
Date:
1999-06-28 20:32:25 UTC
From:
To:
mgp2ps, on a slideshow that mgp itself renders correctly on-screen,
can write the last lines of long pages partly off-paper.

As demonstrated by "mgp -o", the existing mgp algorithm can adapt
font-size so that it does not occur on-screen for any screen-format
when it does not for one screen-format.  It should be the same for the
printout.

#40383#10
Date:
1999-11-29 16:37:16 UTC
From:
To:
Hi,

Does mgp 1.06a or later has this bug?
If so, would you give me the sample mgp file to investigate this bug, please?

Thanks,
Fumitoshi UKAI

#40383#13
Date:
1999-11-29 16:37:16 UTC
From:
To:
Hi,

Does mgp 1.06a or later has this bug?
If so, would you give me the sample mgp file to investigate this bug, please?

Thanks,
Fumitoshi UKAI

#40383#22
Date:
2001-05-11 11:49:27 UTC
From:
To:
Since Yann hasn't replied anymore and I planned to submit a new bug,
I'll step forward.  The bug is still present.  mgp2ps constantly
writes lines and graphics below the lower page border if the page
is filled up entirely.

To demonstrate this, I have extracted an ugly example from one of
my presentations where I've noticed the problem again.  Please find
the files at:

http://people.debian.org/~joey/stuff/mgp/free-software.mgp
http://people.debian.org/~joey/stuff/mgp/free-software.ps

This bug is still present in version 1.07a-2.

Btw. a new version of MagicPoint has been released and is at
ftp://ftp.mew.org/pub/MagicPoint/magicpoint-1.08a.tar.gz

I tried to test if the bug is still present but that version
somehow fails to build:

checking for VFlib library/header... /usr/lib and no
checking for VF_Init in -lVFlib2... no
Fatal: libVFlib2.so.24.0.3 not found

And I'm lacking enough time to investigate it.  The changelog
looks promising though:

Bugs fixed:
        - Some. :-)

Err... not that one, but this one:

New features:
        - Enhancing "mgp2ps"
                * Supporting "cont", "mark", "again"
                * Resizing image

Regards,

	Joey

#40383#27
Date:
2001-05-11 16:49:42 UTC
From:
To:
At Fri, 11 May 2001 13:49:27 +0200,
Martin Schulze wrote:

I've build mgp 1.08a-1 and uploaded now. But, this bug is still present...

However, I've found some contributed script posted on mgp mailing-lists,
written by maeda@tokyo.pm.org.  This script dump screenshot as png and
convert it to PS (6 slides/page) by using tgif.  It simply captures image
displayed by mgp, so it will generate the same image as mgp displays.
I've not tried this yet.  How about this?

Regards,
Fumitoshi UKAI

#!/usr/bin/perl

# Copyright (C) 2000, 2001 Kaoru Maeda.
# All rights reserved.

# This file can be freely distributed
# under the same condition as Perl.

$stem = shift;
$stem =~ s/\.mgp?//;

$tmpdir = "PRINT6";

@PAGES = glob("$tmpdir/mgp00???.eps");

if (!-d $tmpdir || !@PAGES) {

    if (-d $tmpdir) {
	system("rm -rf $tmpdir");
    }
    mkdir $tmpdir, 0777;

    system("mgp -D $tmpdir -E png -o -g 800x600+0+0 -X ppmraw+ $stem.mgp");

    @PNGS = glob("$tmpdir/mgp00???.png");
    for $png (@PNGS) {
	($eps = $png) =~ s/\.png/.eps/;
	print STDERR "$png -> $eps\n";
	system("pngtopnm $png | ppmtopgm | perl -pe 'tr/\\372/\\377/' | pnmtops -dpi 600 -scale 0.6 -noturn > $eps");
    }

    @PAGES = glob("$tmpdir/mgp00???.eps");
}

$pages = 0;
$o = 0;
@LOC = ('48,128,509,474',
	'544,128,1005,474',
	'48,576,509,922',
	'544,576,1005,922',
	'48,1024,509,1370',
	'544,1024,1005,1370',
	);

while (@PAGES) {
    @P = splice(@PAGES, 0, scalar @LOC);
    $pages++;
    push(@out, qq[page($pages,"",1,'').\n]);
    @loc = @LOC;
    for $file (@P) {
	$mtime = (stat $file)[9];
	$mtime = localtime($mtime);
	$loc = shift(@loc);
	$x = <<EOL;
group([
xbm('black','',$loc,0,OBJID,0,461,346,0,0,1,75000,208000,536000,554000,1,0,0,0,0,0,0,
    "$mtime","$file",[
]),
box('black','',$loc,0,1,1,OBJID,0,0,0,0,0,'1',0,[
])
],
OBJID,0,0,[
]).
EOL
    ;
	$x =~ s/OBJID/$o++/ge;
	push(@out, $x);
    }
}

unshift(@out, <<'EOL');
%
% @(#)$Header: /home/kaoru/work/perl/PerlRuby2000/Regex/RCS/mkp6.pl,v 1.3 2000/11/30 14:19:54 kaoru Exp kaoru $
% %W%
%
unit("1 pixel/pixel").
color_info(12,65535,0,[
	"magenta", 65535, 0, 65535, 65535, 0, 65535, 1,
	"red", 65535, 0, 0, 65535, 0, 0, 1,
	"green", 0, 65535, 0, 0, 65535, 0, 1,
	"blue", 0, 0, 65535, 0, 0, 65535, 1,
	"yellow", 65535, 65535, 0, 65535, 65535, 0, 1,
	"pink", 65535, 49931, 53052, 65535, 49344, 52171, 1,
	"cyan", 0, 65535, 65535, 0, 65535, 65535, 1,
	"CadetBlue", 22885, 40569, 42649, 24415, 40606, 41120, 1,
	"white", 65535, 65535, 65535, 65535, 65535, 65535, 1,
	"black", 0, 0, 0, 0, 0, 0, 1,
	"DarkSlateGray", 10402, 19764, 18724, 12079, 20303, 20303, 1,
	"AntiqueWhite2", 61374, 57213, 53052, 61166, 57311, 52428, 1
]).
script_frac("0.6").
fg_bg_colors('black','AntiqueWhite2').
EOL
    ;

    unshift(@out, <<EOL);
%TGIF 4.1.39
state(0,37,100.000,0,0,2,8,1,9,1,1,0,0,1,0,1,0,'Helvetica',0,80640,0,0,0,10,0,0,1,0,0,16,0,0,$pages,$pages,1,1,1050,1485,1,0,2880,0).
EOL
    ;


    open (OUT, ">$stem-6.obj");
    print OUT @out;
    close OUT;

    system("tgif4 -print -ps $stem-6.obj");
__END__

#40383#32
Date:
2001-05-11 19:28:31 UTC
From:
To:
Thanks, will try script and mgp tomorrow, ,  no linux box here, not
home at the moment.

Regards,

	Joey

#40383#37
Date:
2001-05-12 21:40:59 UTC
From:
To:
Fumitoshi UKAI wrote:

Yes, just tested it, it is still present.  Did you forward the bug
description upstream?  If not, please do so.

Converting Images to .PS is evil, all the time.  But dumping the slides
into some graphic format is a good alternative.

Looks good, although I'd like to see some additions:

  1. make it accept additional parameters for mgp, e.g. I have to use `-x vflib'

  2. make it not remove *.png, i.e. maybe call it mgp2png and only let it do
     .png files (they can be converted to anything with convert from ImageMagick)

  3. let me specify the resolution, i.e. if I held the talk at 1024x786 the
     slides are "optimized" for that resolution.  MagicPoint doesn't render
     them good for other resolutions normally, so specifying the resolution
     if it's other than 800x600 (default in the script) sounds proper.

But except for that, please enclude it, even if you are reluctant to modify
it, put it into /usr/share/doc/mgp/examples or similar, so people can actually
use it without being subscribed to the mgp list.


Thanks,

	Joey

#40383#42
Date:
2001-05-13 12:22:45 UTC
From:
To:
Fumitoshi UKAI wrote:

The other bug that I've reported was modified.  Please check the
eps image I've provided, ps code is now rendered properly, though
it has a white background, all the time, which looks bad if the
slides have a colored background already.

While "playing" with exporting slides I encountered another problem.
With the new 1.08 mgp some of my slides seem to be larger than the
screen.  Apparently the new mgp adds more space between lines, and
maybe the font is slightly larger.  Please check these two screenshots
from the same presentation:

http://people.debian.org/~joey/stuff/mgp00004-newmgp.png
http://people.debian.org/~joey/stuff/mgp00004-oldmgp.png

For the moment I've switched back to the potato version and put it
on hold since that version works best.

Since the EPS files are only bit images, I'll use the image part
of it for the moment.  Here's a slightly modified version.

#! /usr/bin/perl

# Copyright (C) 2000, 2001 Kaoru Maeda.
# All rights reserved.

# This file can be freely distributed
# under the same condition as Perl.

$argc = 0;
$opt_resolution = "800x600";
$opt_opts = "";
while ($argc <= $#ARGV) {
    if ($ARGV[$argc] eq "-h" || $ARGV[$argc] eq "--help") {
	"mgp2png [-g WIDTHxHEIGHT] \n";
        exit;
    } elsif ($ARGV[$argc] eq "-g") {
	if (($argc < $#ARGV) && ($ARGV[$argc+1] !~ /^-/)) {
	    $opt_resolution = $ARGV[++$argc];
	}
    } elsif ($ARGV[$argc] eq "-o") {
	if (($argc < $#ARGV)) {
	    $opt_opts = $ARGV[++$argc];
	}
    } else {
	$stem = $ARGV[$argc];
	$stem =~ s/\.mgp?//;
    }
    $argc++;
}

$tmpdir = "PRINT6";

@PAGES = glob("$tmpdir/mgp00???.eps");

if (!-d $tmpdir || !@PAGES) {

    if (-d $tmpdir) {
	system("rm -rf $tmpdir");
    }
    mkdir $tmpdir, 0777;

    system("mgp -D $tmpdir -E png -o -g $opt_resolution+0+0 -X ppmraw+ $opt_opts $stem.mgp");

    @PNGS = glob("$tmpdir/mgp00???.png");
    for $png (@PNGS) {
	($eps = $png) =~ s/\.png/.eps/;
	print STDERR "$png -> $eps\n";
	system("pngtopnm $png | ppmtopgm | perl -pe 'tr/\\372/\\377/' | pnmtops -dpi 600 -scale 0.6 -noturn > $eps");
    }

    @PAGES = glob("$tmpdir/mgp00???.eps");
}

$pages = 0;
$o = 0;
@LOC = ('48,128,509,474',
	'544,128,1005,474',
	'48,576,509,922',
	'544,576,1005,922',
	'48,1024,509,1370',
	'544,1024,1005,1370',
	);

while (@PAGES) {
    @P = splice(@PAGES, 0, scalar @LOC);
    $pages++;
    push(@out, qq[page($pages,"",1,'').\n]);
    @loc = @LOC;
    for $file (@P) {
	$mtime = (stat $file)[9];
	$mtime = localtime($mtime);
	$loc = shift(@loc);
	$x = <<EOL;
group([
xbm('black','',$loc,0,OBJID,0,461,346,0,0,1,75000,208000,536000,554000,1,0,0,0,0,0,0,
    "$mtime","$file",[
]),
box('black','',$loc,0,1,1,OBJID,0,0,0,0,0,'1',0,[
])
],
OBJID,0,0,[
]).
EOL
    ;
	$x =~ s/OBJID/$o++/ge;
	push(@out, $x);
    }
}

unshift(@out, <<'EOL');
%
% @(#)$Header: /home/kaoru/work/perl/PerlRuby2000/Regex/RCS/mkp6.pl,v 1.3 2000/11/30 14:19:54 kaoru Exp kaoru $
% %W%
%
unit("1 pixel/pixel").
color_info(12,65535,0,[
	"magenta", 65535, 0, 65535, 65535, 0, 65535, 1,
	"red", 65535, 0, 0, 65535, 0, 0, 1,
	"green", 0, 65535, 0, 0, 65535, 0, 1,
	"blue", 0, 0, 65535, 0, 0, 65535, 1,
	"yellow", 65535, 65535, 0, 65535, 65535, 0, 1,
	"pink", 65535, 49931, 53052, 65535, 49344, 52171, 1,
	"cyan", 0, 65535, 65535, 0, 65535, 65535, 1,
	"CadetBlue", 22885, 40569, 42649, 24415, 40606, 41120, 1,
	"white", 65535, 65535, 65535, 65535, 65535, 65535, 1,
	"black", 0, 0, 0, 0, 0, 0, 1,
	"DarkSlateGray", 10402, 19764, 18724, 12079, 20303, 20303, 1,
	"AntiqueWhite2", 61374, 57213, 53052, 61166, 57311, 52428, 1
]).
script_frac("0.6").
fg_bg_colors('black','AntiqueWhite2').
EOL
    ;

    unshift(@out, <<EOL);
%TGIF 4.1.39
state(0,37,100.000,0,0,2,8,1,9,1,1,0,0,1,0,1,0,'Helvetica',0,80640,0,0,0,10,0,0,1,0,0,16,0,0,$pages,$pages,1,1,1050,1485,1,0,2880,0).
EOL
    ;


    open (OUT, ">$stem-6.obj");
    print OUT @out;
    close OUT;

    system("tgif -print -ps $stem-6.obj");
    unlink("$stem-6.obj");
__END__



Regards,

	Joey