then only when it would use its search mechanisms.
Imager 0.78 - unreleased
===========
+TODO: fix i_giflib_version()
+
- add each library-directory/pkgconfig/ to the pkg-config search path
in Imager::Probe.
Thanks to Justin Davis.
directory. Thanks to Justin Davis.
https://rt.cpan.org/Ticket/Display.html?id=60491
+ - only prepend ./ to font filenames when passing them to T1Lib and
+ then only when it would use its search mechanisms.
+ https://rt.cpan.org/Ticket/Display.html?id=60509
+
+
Imager 0.77 - 11 Aug 2010
===========
if ($hsh{'file'}) {
$file = $hsh{'file'};
- if ( $file !~ m/^\// ) {
- $file = './'.$file;
- if (! -e $file) {
- $Imager::ERRSTR = "Font $file not found";
- return();
- }
- }
$type = $hsh{'type'};
if (!defined($type) or !$drivers{$type} or !$drivers{$type}{enabled}) {
$Imager::ERRSTR = "Type 1 fonts not supported in this build";
return;
}
- unless ($hsh{file} =~ m!^/! || $hsh{file} =~ m!^\./!) {
+ # we want to avoid T1Lib's file search mechanism
+ unless ($hsh{file} =~ m!^/!
+ || $hsh{file} =~ m!^\.\/?/!
+ || $^O =~ /^(MSWin32|cygwin)$/ && $hsh{file} =~ /^[a-z]:/) {
$hsh{file} = './' . $hsh{file};
}
$Imager::ERRSTR = "Afm file $hsh{afm} not found";
return;
}
- unless ($hsh{afm} =~ m!^/! || $hsh{afm} =~ m!^\./!) {
+ unless ($hsh{afm} =~ m!^/!
+ || $hsh{afm} =~ m!^\./!
+ || $^O =~ /^(MSWin32|cygwin)$/ && $hsh{file} =~ /^[a-z]:/) {
$hsh{file} = './' . $hsh{file};
}
} else {
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
use strict;
-use Test::More tests => 94;
-BEGIN { use_ok(Imager => ':all') }
+use Test::More;
+use Imager ':all';
use Imager::Test qw(diff_text_with_nul is_color3);
+use Cwd qw(getcwd abs_path);
#$Imager::DEBUG=1;
+i_has_format("t1")
+ or plan skip_all => "t1lib unavailble or disabled";
+
+plan tests => 95;
+
init_log("testout/t30t1font.log",1);
-my $deffont = './fontfiles/dcr10.pfb';
+my $deffont = 'fontfiles/dcr10.pfb';
my $fontname_pfb=$ENV{'T1FONTTESTPFB'}||$deffont;
my $fontname_afm=$ENV{'T1FONTTESTAFM'}||'./fontfiles/dcr10.afm';
+-f $fontname_pfb
+ or skip_all("cannot find fontfile for type 1 test $fontname_pfb");
+-f $fontname_afm
+ or skip_all("cannot find fontfile for type 1 test $fontname_afm");
+
SKIP:
{
- if (!(i_has_format("t1")) ) {
- skip("t1lib unavailable or disabled", 93);
- }
- elsif (! -f $fontname_pfb) {
- skip("cannot find fontfile for type 1 test $fontname_pfb", 93);
- }
- elsif (! -f $fontname_afm) {
- skip("cannot find fontfile for type 1 test $fontname_afm", 93);
- }
-
print "# has t1\n";
#i_t1_set_aa(1);
is_color3($colors[0], 0, 0, 0, "check we got black");
is_color3($colors[1], 255, 0, 0, "and red");
}
+
+ SKIP:
+ { # RT 60509
+ # checks that a c:foo or c:\foo path is handled correctly on win32
+ my $type = "t1";
+ $^O eq "MSWin32" || $^O eq "cygwin"
+ or skip("only for win32", 2);
+ my $dir = getcwd
+ or skip("Cannot get cwd", 2);
+ if ($^O eq "cygwin") {
+ $dir = Cygwin::posix_to_win_path($dir);
+ }
+ my $abs_path = abs_path($deffont);
+ my $font = Imager::Font->new(file => $abs_path, type => $type);
+ ok($font, "found font by absolute path")
+ or print "# path $abs_path\n";
+ undef $font;
+
+ $^O eq "cygwin"
+ and skip("cygwin doesn't support drive relative DOSsish paths", 1);
+ my ($drive) = $dir =~ /^([a-z]:)/i
+ or skip("cwd has no drive letter", 2);
+ my $drive_path = $drive . $deffont;
+ $font = Imager::Font->new(file => $drive_path, type => $type);
+ ok($font, "found font by drive relative path")
+ or print "# path $drive_path\n";
+ }
}
#malloc_state();
#!perl -w
use strict;
-use Test::More tests => 187;
+use Test::More tests => 189;
+use Cwd qw(getcwd abs_path);
++$|;
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
init_log("testout/t38ft2font.log",2);
+my $deffont = "fontfiles/dodge.ttf";
+
my @base_color = (64, 255, 64);
SKIP:
{
- i_has_format("ft2") or skip("no freetype2 library found", 186);
+ i_has_format("ft2") or skip("no freetype2 library found", 188);
print "# has ft2\n";
- my $fontname=$ENV{'TTFONTTEST'}||'./fontfiles/dodge.ttf';
+ my $fontname=$ENV{'TTFONTTEST'} || $deffont;
- -f $fontname or skip("cannot find fontfile $fontname", 186);
+ -f $fontname or skip("cannot find fontfile $fontname", 188);
my $bgcolor=i_color_new(255,0,0,0);
ok(Imager::i_img_diff($im->{IMG}, $imcopy->{IMG}),
"make sure we drew the '0'");
}
+
+ SKIP:
+ { # RT 60509
+ # checks that a c:foo or c:\foo path is handled correctly on win32
+ my $type = "ft2";
+ $^O eq "MSWin32" || $^O eq "cygwin"
+ or skip("only for win32", 2);
+ my $dir = getcwd
+ or skip("Cannot get cwd", 2);
+ if ($^O eq "cygwin") {
+ $dir = Cygwin::posix_to_win_path($dir);
+ }
+ my $abs_path = abs_path($deffont);
+ my $font = Imager::Font->new(file => $abs_path, type => $type);
+ ok($font, "found font by absolute path")
+ or print "# path $abs_path\n";
+ undef $font;
+
+ $^O eq "cygwin"
+ and skip("cygwin doesn't support drive relative DOSsish paths", 1);
+ my ($drive) = $dir =~ /^([a-z]:)/i
+ or skip("cwd has no drive letter", 2);
+ my $drive_path = $drive . $deffont;
+ $font = Imager::Font->new(file => $drive_path, type => $type);
+ ok($font, "found font by drive relative path")
+ or print "# path $drive_path\n";
+ }
+
}
sub align_test {