On Mon, 8 Nov 1999, Marc Lehmann wrote:
> I must have misunderstood your problem: why do you want to know the ascent or
> the descent of a given string?
>
I've only been following this thread on-and-off so please forgive any
ignorance :-)
One problem with the current system that I encountered was as follows :- I
wanted to write a script-fu to generate a logo with each letter of the
string in a different color.
(See http://www.flamingtext.com/net-fu/forms/colored-logo.html)
To do this each character in the string of course has to be rendered
individually. But if you just render them one after the other, increasing
the x-offset by the width of the rendered character each time, then the
baselines are all over the place.
I worked around this problem by rendering (string-append char " " str),
where <char> is the current character and <str> is the full string
and <" "> is a bunch of spaces so that kerning doesn't leave dags
behind. After redering that string I use gimp-text-get-extents to get the
width of <char> and increase x-offset by that amount.
> > - letting the gimp_text_get_extents return two additional fields,
> > namely ($has_ascent,$has_descent).
> >
> > I favour the last ;)
>
> But that wouldn't help you... wether a given character/string has an
> ascent doesn't tell you how much it is (which is what you want to know?)
>
Yep, you're right, that info tells you didly! But if it returned the
baseline of the rendered text (as a offset from the top or bottom of the
text area) then that could be used to translate the text area if required.
-Dave
--------------------------------------------------------------
http://www.flamingtext.com/