Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Generate thumbnail and small overstruck images for web publication

by Intrepid (Deacon)
on Sep 26, 2005 at 10:38 UTC ( #495054=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Generate thumbnail and small overstruck images for web publication
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://495054]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (15)
As of 2014-10-21 17:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (106 votes), past polls