Subject: | top of page bug in Pod::Pdf |
This is a great module. It makes my pod documents look quite professional. It even pointed out some errors in my POD source.
While I was using it I did find one slight formatting problem. When a verbatim block (indicated by leading whitespace on each line) starts at the top of a new page, the font is not the fixed width font these blocks usually have.
I took the liberty of making a minor fix in the VRB subroutine which is the only change I needed to make the formatting work correctly. Below is that routine in its revised form. The only change was moving the setFont call to after the block which deals with the page header.
If you need any clarification, please contact me at this address. If you would rather have a valid patch against the current version on CPAN, I'll be happy to supply that instead.
Thanks for a good module which is easy to use.
Phil Crow
Version info:
Perl 5.6.1 from ActiveState
Pod-Pdf-1.2
sub VRB {
my ($str) = @_;
just ("\n");
#
# beginning of change comment
#
# This line:
# setFont('Verbatim') unless $in_verbatim;
# should probably appear below the new header block.
#
if ($ypos <= ($bottom_margin + $LF) and $more) {
pageFooter();
pageHeader($h_str, $title);
$bl = 0;
prt("/F$pt[$p][0]$pt[$p][1] $fs Tf\n");
$fonts_used{"/F$pt[$p][0]$pt[$p][1]"} = ' ';
@scratch_pad = ($pt[$p][0], $pt[$p][1]);
}
#
# This placement worked for me:
#
setFont('Verbatim') unless $in_verbatim;
# end of change comment
$j = $p = 0; $jt[0] = $pt[0] = [@scratch_pad];
$sc[$p] = 'text';
setColor();
$xpos = $cLM + $indent;
if ($in_verbatim) { $ypos -= $LF }
elsif (!$in_verbatim and $bl) { $ypos -= $WS }
$in_verbatim = 1;
$in_text = $in_tab = $bl = 0;
$zlf = 1;
just($str);
}