rsmeineke has asked for the wisdom of the Perl Monks concerning the following question:
Found it ....
in the PDF/API2/Resource/Font/CoreFont/courier.pm file I changed
'fontname' => 'Courier',
to
'fontname' => 'Courier-New',
and I added -New, in the other three courier-related files
'fontname' => 'Courier-New,Oblique',
'fontname' => 'Courier-New,Bold',
'fontname' => 'Courier-New,BoldOblique',
and now all is right with the world!
======================%< snip >%================================I'm wondering if it is just me ...
I recently had need for the Courier font in some PDF output. I have been trying to use the corefonts in PDF::API2 but can't seem to get anything other than Courier-Oblique for output. The other corefonts seem to render fine. Here is a mini test program:
#!/usr/bin/perl use strict; use warnings; use PDF::API2; my @fonts = qw( Courier Courier-Bold Courier-BoldOblique Courier-Oblique Verdana Times Times-BoldItalic Georgia Georgia-Bold ); my $pdf = PDF::API2->new; my $page = $pdf->page; my $text = $page->text; my $y = 700; $text->translate( 100, $y ); foreach my $f (@fonts) { my $cft = $pdf->corefont($f); $text->font( $cft, 12 ); $text->text($f); $y -= 15; $text->translate( 100, $y ); } $pdf->saveas('pdftest.pdf'); $pdf->end();
I have tested this on a couple of my Linux boxes and always get the same result -- four lines of Courier-Oblique on the top. Any ideas where I might be going wrong?
Thanks, Robert M.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PDF::API2 and the Elusive Courier Font
by hippo (Archbishop) on Nov 07, 2013 at 14:02 UTC | |
by taint (Chaplain) on Nov 07, 2013 at 14:51 UTC | |
|
Re: PDF::API2 and the Elusive Courier Font
by rnewsham (Curate) on Nov 07, 2013 at 14:16 UTC | |
|
Re: PDF::API2 and the Elusive Courier Font
by kschwab (Vicar) on Nov 08, 2013 at 05:07 UTC | |
by rsmeineke (Initiate) on Nov 10, 2013 at 11:35 UTC | |
by kschwab (Vicar) on Nov 10, 2013 at 14:22 UTC | |
by rsmeineke (Initiate) on Nov 11, 2013 at 09:35 UTC |