Subject: | tiny bug (and fix) in PDF::Reuse 0.35 |
Date: | Thu, 10 Apr 2014 17:37:10 -0600 |
To: | bug-PDF-Reuse [...] rt.cpan.org |
From: | Jarom Smith <jarom [...] jaromsmith.net> |
Hello:
I've found and fixed what I believe is a bug in PDF::Reuse version 0.35.
The use case is: text printed with a rotation (in my case, rotation = 90,
but I don't know whether or not the problem exists for other rotations) has
too much word spacing. I don't know how or where this extra word-spacing
is being set (I didn't try to figure it out), but the fix for it was
straightforward: I just added "0 Tw " to set the word spacing to zero for
rotated text. Something like this
jarom@serverpronto:/usr/local/lib/perl5/site_perl/5.18.1/PDF >diff -u -ibw
Reuse.pm /usr/local/share/perl/5.10.1/PDF/Reuse.pm
--- Reuse.pm 2014-04-10 17:32:04.000000000 -0600
+++ /usr/local/share/perl/5.10.1/PDF/Reuse.pm 2014-04-10
16:47:48.000000000 -0600
@@ -510,6 +510,7 @@
# . "/Gs0 gs\n" # reset
graphic mode
. "$Cos $Sin $negSin $Cos $xPos $yPos cm\n" #
rotation/translation in the CM
. "\nBT /$Font $fontSize Tf "
+ . "0 Tw "
. "$x_align_offset 0 Td $encText Tj ET\n" # text @ 0,0
. "Q\n"; # close the
stack frame
}
Hope that helps, and I hope this makes it into a future release of
PDF::Reuse (if any), because if not my (locally-modified) copy will break
when updated.
Thanks!
jarom smith
tech go-to guy