pango_layout_iter_get_char_extents()



Hi Owen,

I'm trying to write a customized GtkLabel that put three dots
at the end of the visible text if the text does not fit into 
the labels allocation and I'm having some problems with Pango.

I'm using a PangoLayoutIter to iterate through the text to find
the text index where I have to cut off and place the dots that
indicate the truncated text. I have so far succeeded to find the
last line that fits into the allocation and tried to find the
x position by iterating through the characters. I have however 
found that pango_layout_iter_get_char_extents() returns some 
strange values for rect.x and rect.width. The character width 
seems to always be the same. Looking at the code I found that it 
is determined as (cluster_width / char_count). The values 
returned here are however very small (about 1/8 the character 
height). This makes pango_layout_iter_get_char_extents() pretty 
much useless for me and I wonder what it could be used for.

It would help me a lot if you could explain the differences
between run, cluster and character. I have some ideas but I'm
mostly guessing. Also, perhaps you have a better idea how to
implement a Label as described here efficiently.


Salut, Sven





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