Subject: | (patch provided) Font.pm malforms font pathnames in win32 |
Line 75 and 76 in font.pm prepends the font pathname with "./" when the
file path name does not start with a forward slash.
This behaviour does not work with win32 filesystems.
I've experienced this problem in Imager-0.75 -> Imager-0.77 although I
am sure this problem persists in previous versions.
I expect that this problem has been overlooked as most would use win32
fonts via facenames on win32 platforms.
My solution was to use the abs_path function to find the absolute path
in a cross platform manner (abs_path is ofcourse a core module).
I have attached a patch for Font.pm and also the already patched Font.pm
for your convience.
It seems to work fine for me in either Arch Linux, Windows 2000 and
Windows 7. Later in my project I also require Solaris support so will
test that also, but i dont anticipate any problems.
Subject: | Font.pm.patch |
--- lib/Imager/Font.pm 2010-04-12 12:23:04.000000000 +0100
+++ lib/Imager/Font.pm.new 2010-08-19 10:28:37.363816914 +0100
@@ -3,6 +3,7 @@ package Imager::Font;
use Imager::Color;
use strict;
use vars qw($VERSION);
+use Cwd 'abs_path';
$VERSION = "1.034";
@@ -72,13 +73,10 @@ sub new {
bless $self,$class;
if ($hsh{'file'}) {
- $file = $hsh{'file'};
- if ( $file !~ m/^\// ) {
- $file = './'.$file;
- if (! -e $file) {
- $Imager::ERRSTR = "Font $file not found";
- return();
- }
+ $file = abs_path($hsh{'file'});
+ if (! -e $file) {
+ $Imager::ERRSTR = "Font $file not found";
+ return();
}
$type = $hsh{'type'};
Subject: | Font.pm |
Message body is not shown because it is too large.