Re: Rendering text with gimp_perl and gimp_text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 29 Oct 1999, Marc Lehmann wrote:

> Yes, you could use Gimp->text_get_extents to get the position of the
> baseline, and the maximum size (measure XygjZ79 or something similar to be
> sure ;) then you can resize the layer after it was created.
> 
> Don´t ask me for details, you have to play around a bit. (btw, if you
> happen to write a sub like gimp_text_ext_iso (...) to do this I can
> include it in Gimp::Util).
> 
I came across the same problem a little while back when writing a script
to render a logo with each letter in a different color.  What I ended up
doing was using gimp-text-get-extents to get the size of each letter,
keeping track of the max height and storing the width in a array for
later.  After this pass I resized my image appropriately.

On the second pass I used gimp-text to render:

	(string-append this-char "     " str)

where, this-char is the current character, and str is the whole string.
I then clear the area after this-char by using the character width stored
from the first pass.  The spaces rendered between this-char and str are
a attempt (partially successful, still get dags sometimes) to overcome a
problem caused by different inter-character spacings.

Not exactly a elegant solution but it works (mostly).


-Dave



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux