Re: [Fwd: calculating text length]



ext Behdad Esfahbod wrote:
> On Thu, 2007-04-19 at 11:14 +0300, Tapani P�i wrote:
>   
>> Well this is actually more of a problem of our current browser build
>> that updates title far too often, few times in a second to be
>> exact :-)
>> And this triggers ellipsation pretty frequently ... but that reminded
>> me
>> of one feature I was experimenting with earlier, 'scrolling window
>> titles', where updating is needed and fast algorithm wanted. Also in
>> our
>> search application title displays the amount of results found, so it's
>> updated frequently.
>>     
>
> The best strategy would be to avoid duplicate work.  As long as you just
> vaguely describe your usecase and how you are calling into pango, there
> is not much we can say.
>
>   

It might be I'm asking the obvious, usecase it ellipsizing a line of
text. There are cases where I have todo this often and text can be very
long. Ideally the length would not affect the speed much.

>   
>> The real performance problem here is not exactly Pango but how it is
>> being called. So basically I'd like to know what is the quickest way
>> to get (approx) width for a string with Pango. 
>>     
>
> I've recently added a call pango_glyph_string_get_width() that is much
> faster than pango_glyph_string_extents() or
> pango_glyph_string_get_logical_widths().
>
>   

Cool, that sounds good.

// Tapani




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