in reply to Generate thumbnail and small overstruck images for web publication
In GrandFather's code there did appear this:
my ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_a +dvance) = $overL->QueryFontMetrics ( pointsize => $points, text => "$overText", '@C:/WINDOWS/Fonts/times.ttf', # Omit for default font );
In order to enhance portability I would suggest a mild wrapper around the font -finding parameter (untested as of this posting):
my $mswinpath; my $fontpath = ($mswinpath = $ENV{SYSTEMDIR} || $ENV{WINDIR}) ? q[@]. $mswinpath .q[/Fonts/times.ttf] : q[times]; $fontpath =~ tr:\\:/:s; my ($x_ppem, $y_ppem, $ascender, $descender, $width, $height, $max_a +dvance) = $overL->QueryFontMetrics ( pointsize => $points, text => "$overText", $fontpath );
I'm not certain that 'times' is a valid font specifier on X11 (*nix) systems, but
I suspect that it will work fairly widely.
In Section
Cool Uses for Perl