Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 60509
Status: resolved
Priority: 0/
Queue: Imager

People
Owner: Nobody in particular
Requestors: paul.a.grove [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.77
Fixed in: (no value)



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.

On Thu Aug 19 05:41:08 2010, mrogmonster wrote: Show quoted text
> 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.
Thanks for this, I plan to apply this or something similar before the next release (I'm in the middle of refactoring GIF into a separate module). The "./" is added to prevent T1lib from searching its font path for the file, but there may be alternatives for that. Tony
On Thu Aug 19 05:41:08 2010, mrogmonster wrote: Show quoted text
> 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.
This is fixed in Imager 0.78, thanks for your report. Tony