[poppler] test/test-gen: text.pl,1.3,1.4
Jeff Muizelaar
jrmuizel at freedesktop.org
Tue Jan 10 10:40:10 PST 2006
Update of /cvs/poppler/test/test-gen
In directory gabe:/tmp/cvs-serv16115/test-gen
Modified Files:
text.pl
Log Message:
2006-01-10 Jeff Muizelaar <jeff at infidigm.net>
* test-gen/text.pl:
* tests/text.pdf:
* tests/text.pdf-0-cairo-ref.png:
Update text.pdf to test clipping of multiple strings
in a single text object.
Index: text.pl
===================================================================
RCS file: /cvs/poppler/test/test-gen/text.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- text.pl 23 Nov 2005 21:26:11 -0000 1.3
+++ text.pl 10 Jan 2006 18:40:08 -0000 1.4
@@ -12,8 +12,6 @@
$font = Text::PDF::SFont->new($pdf, 'Helvetica', 'F0'); # Make a new font in the document
$root->add_font($font); # Tell all pages about the font
-$page->add("q\n"); #saveState
-$page->add("BT 1 0 0 1 200 600 Tm /F0 48 Tf 5 Tr (Hello World!) Tj ET\n"); # put some content on the page
my ($w,$h,$bpc,$cs,$img)=parseImage('romedalen.ppm');
my $key='IMG1';
$xo=PDFDict();
@@ -34,11 +32,23 @@
$y = 500;
$sx = $w;
$sy = $h;
+
+# draw some black text
+$page->add("0 0 1 rg\n");
+$page->add("BT 1 0 0 1 100 600 Tm /F0 48 Tf 0 Tr (Hello World!) Tj ET\n");
+
+$page->add("q\n"); #saveState
+#clip the image to the single string "Hello World!"
+$page->add("BT 1 0 0 1 100 500 Tm /F0 48 Tf 5 Tr (Hello World!) Tj ET\n");
$page->add(sprintf("%0.3f %0.3f %0.3f %0.3f %0.3f %0.3f cm\n", $sx,0,0,$sy,$x,$y));
$page->add("/$key Do\n");
$page->add("Q\n"); #restoreState
-$page->add("0 0 1 rg\n");
-$page->add("BT 1 0 0 1 100 600 Tm /F0 48 Tf 0 Tr (Hello World!) Tj ET"); # put some content on the page
+
+
+#clip the image to both strings "Hello " and "World!"
+$page->add("BT 1 0 0 1 100 400 Tm /F0 48 Tf 5 Tr (Hello ) Tj (World!) Tj ET\n");
+$page->add(sprintf("%0.3f %0.3f %0.3f %0.3f %0.3f %0.3f cm\n", $sx,0,0,$sy,100,300));
+$page->add("/$key Do");
$pdf->out_file($ARGV[0]); # output the document to a file
More information about the poppler
mailing list