why there is not "pango_layout_iter_previous_line"

View: New views
3 Messages — Rating Filter:   Alert me  

Parent Message unknown why there is not "pango_layout_iter_previous_line"

by 王旭光 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
there is a function "pango_layout_iter_next_line" in pango. but if I want to the previous line, what can I do ?
It is used when I scroll the text.  If I frequently call  "pango_layout_get_line", is the efficiency very low ?

I think the list linking pango lines should be GList, not GSList



没有广告的终身免费邮箱,www.yeah.net

_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list@...
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Re: why there is not "pango_layout_iter_previous_line"

by David E. Hollingsworth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

=?gbk?B?zfXQ8bni?= <ninesunqian@...> writes:

> It is used when I scroll the text.  If I frequently call
> "pango_layout_get_line", is the efficiency very low ?

You probably want to be using pango_layout_get_line_readonly() unless
you're modifying the contents.  Otherwise it has to recalculate the
extents each time you ask.

Anyway, pango_layout_get_line() uses small a loop as you can get:

GSList*
g_slist_nth (GSList *list,
             guint   n)
{
  while (n-- > 0 && list)
    list = list->next;

  return list;
}

I think you'll find that even with millions of elements that's not
enough time to matter.

Obviously it's possible to use this in slow ways:

pango_layout_get_line_readonly(1000);
pango_layout_get_line_readonly(999);
...

So don't do that.  Jump backwards then walk forwards.

  --deh!

--
"I've just found the silverware and I'm sticking a fork in that square!" - N.H.
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list@...
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list

Re: why there is not "pango_layout_iter_previous_line"

by Behdad Esfahbod-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 08/07/2009 06:01 AM, 王旭光 wrote:
> there is a function "pango_layout_iter_next_line" in pango. but if I
> want to the previous line, what can I do ?
> It is used when I scroll the text. If I frequently call
> "pango_layout_get_line", is the efficiency <javascript:void(0)> very low ?

Makes sense.  Filed a bug:
http://bugzilla.gnome.org/show_bug.cgi?id=591095

behdad


> I think the list linking pango lines should be GList, not GSList
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list@...
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list