http://www.perlmonks.org?node_id=994943

daviekiernan has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I am creating headers of different width i.e. 1 to 8 columns wide, but am trying to scale the font to be wider as the columns get wider but can;t find anything online as to how this is done using postscript::simple, I have managed to manually manipulate a postscript file to do this but wondering where anyone knows how to do this using postscript::simple; Has anyone any ideas? Below is the main part of the perl

Thanks Dave

while ($counter <= $number_of_columns)
{#start counting columns
# Build up measure e.g. total width for 6-col is 6 x number of cols + 5 x gutters
$measure = ($column_width * $counter) + ($gutter * ($counter-1));
$center_point = $measure/2; # Used for centering lines of type
use PostScript::Simple;
# create a new PostScript object
$p = new PostScript::Simple(portrait => 1,
xsize => $measure,
ysize => $depth,
colour => 0,
reencode => undef,
eps => 0,
units => "pt");
# create a new page
$p->newpage;
# draw lines or other shapes
$p->setlinewidth( 1.00 );
$p->box(.25,.25, $measure,$depth);
$p->setcolour("black");
$p->box( {filled => 1},0,0,$measure,$depth);
$p->setlinewidth( 0 );
$p->box(.25,.25, $measure,$depth-1.75);
$p->setcolour("white");
$p->box( {filled => 1},.25,.25,$measure,$depth-2);
# add text
$p->setcolour("black");
$p->setfont("FlamaNewsMedium", 9);
#$p->setfont("FlamaNewsMedium", 15);
$p->text( {align => 'center'},$center_point,$depth/3, "$categories{$cat_number}");
# write the output to as many files as you need
$p->output("100\\in\\${cat_number}\-${counter}x${cm_depth}.ps");
$counter++;
}
}

Replies are listed 'Best First'.
Re: postscript::simple scalefont
by AnomalousMonk (Archbishop) on Sep 21, 2012 at 18:03 UTC

    Hi, daviekiernan. Welcome to the Monastery!
    I see you're getting your money's worth out of the  <br> tag.
    Do yourself a favor and investigate the  <code> ... </code> and shorthand  <c> ... </c> tags.
    Please see Markup in the Monastery.