Re: scaling text

[email protected] (zentara)
Newsgroups perl.beginners
Message-ID <[email protected]>
On Wed, 21 May 2008 12:43:34 -0400, [email protected] ("R. Hicks")
wrote:

>zentara wrote:
>> On Mon, 19 May 2008 14:37:27 -0400, [email protected] (Robert L Hicks)
>> wrote:
>> 
>>> Is there an algorithm to scale text on a graphic? I have a badge 200x200 
>>> that I would like to scale text on.
>>>
>>> I have looked at a bunch of Perl image libraries ( o_O ) but I didn't 
>>> see an example.
>>>
>>> Robert
>> 
>> Play around with annotate's point size and other settings.
>> If you need realtime zooming, you will need to go to a canvas,
>> like Tk::Canvas, Tk::Zinc, or Gnome2::Canvas

>> $image->Annotate(
>>      pointsize=>40, 
>>      text=>$text, 
>>      stroke => '#C0C0C0', # Increase to make stroke more white
>>      fill => '#505050', #or red etc, Decrease to make fill more black
>>      gravity => 'center',
>>       x=> -10, # offsets
>>       y=> -10  # offsets

>> zentara

>
>I have been reading a bit. Would it be easy to just create the text as 
>an image and then scale that according to its bounding box?
>
>Robert


There are many ways to skin a cat. :-)
Do what is easiest for your purposes. I just proposed
one way of placing a point-scaled text at a position
on an existing image.

Maybe you feel more comfortable with your proposed
method. As usual with Perl, there is no "right way", unless
you are getting into some kind of mass production and
efficiencies become important. But for 50 Boy Scout badges,
or a convention of 500 people, efficiency isn't going to matter.
Do what is easiest for you to understand, and the materials
you have to work with.

You really didn't say how you are making the badges,
like is there a limited defined bounding box that each
name must fit in?  Or can you adjust the name-box size
to accomodate longer names? etc. etc.

zentara


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.