How to figure out position of ellipse in ellipsized text?

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

How to figure out position of ellipse in ellipsized text?

by Stefan Landvogt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Let's assume, that the PangoLayout is ellipsised at the end with
PANGO_ELLIPSIZE_END.

Now the text ist too long and pango_layout_is_ellipsized
(m_PangoLayout) actually returns true.

How do I figure out, where the actual ellipse is located, and where my
text in that line ends?

When I iterate through the lines of text and look at a line with
PangoLayoutLine *pangoLayoutLine = pango_layout_get_line_readonly(
m_PangoLayout, line );
and then retrieve
pangoLayoutLine->start and pangoLayoutLine->length,
then I get a longer text, then actually displayed.

The weird thing is: The graphems that are not displayed anymore have
the width of 2.255


Any hint on how to figure out, where the ellipse is actually located
is creatly appreciated!


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

Re: How to figure out position of ellipse in ellipsized text?

by Behdad Esfahbod-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 07/13/2009 09:38 AM, Stefan Landvogt wrote:

> Let's assume, that the PangoLayout is ellipsised at the end with
> PANGO_ELLIPSIZE_END.
>
> Now the text ist too long and pango_layout_is_ellipsized
> (m_PangoLayout) actually returns true.
>
> How do I figure out, where the actual ellipse is located, and where my
> text in that line ends?
>
> When I iterate through the lines of text and look at a line with
> PangoLayoutLine *pangoLayoutLine = pango_layout_get_line_readonly(
> m_PangoLayout, line );
> and then retrieve
> pangoLayoutLine->start and pangoLayoutLine->length,
> then I get a longer text, then actually displayed.

All the rest of the text is put in one cluster, mapping to the glyph (or
glyphs) for the ellipsis.

> The weird thing is: The graphems that are not displayed anymore have
> the width of 2.255
>
>
> Any hint on how to figure out, where the ellipse is actually located
> is creatly appreciated!

This is not exposed right now.  Question is, why do you need that exactly?

behdad

>
> Kind regards,
> Stefan
_______________________________________________
gtk-i18n-list mailing list
gtk-i18n-list@...
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list