Skip Menu |

This queue is for tickets about the PDF-Reuse CPAN distribution.

Report information
The Basics
Id: 119995
Status: resolved
Priority: 0/
Queue: PDF-Reuse

People
Owner: Nobody in particular
Requestors: TPLA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Windows: write_objects() tripped up by humourless findTTFont()
On Windows, application code for resolving font names such "Arial" may look like this: $fontpath = File::Spec->catdir($ENV{SYSTEMROOT}, "Fonts"); $fontfile = File::Spec->catfile($fontpath, "ARIAL.TTF"); # "C:\Windows\Fonts\ARIAL.TTF" However, the application could conceivably accept user input such as this: $fontfile = "c:/windows/fonts/arial.ttf"; On Windows, these are functionally equivalent. findTTFont() accepts different kinds of arguments but treats them as a very literal hash key. So, for path names it will create a separate hash key for each of the above examples. Eventually, this breaks PDF::Reuse::DocProxy::write_objects() which fails with the cryptic Can't use an undefined value as an ARRAY reference at Reuse.pm line 1464. Fix for findTTFont: sub findTTFont { my $selector = shift; # argument was a file path: normalize if(defined($selector) && $selector =~ m|\.ttf$|i){ $selector =~ s|\\|/|g; $selector = lc $selector; } $selector ||= $aktuellFont[foEXTNAMN];
Issue resolved, file names to be handled at application level.