Re: pango_layout_iter_get_char_extents()



Hi,

Havoc Pennington <hp redhat com> writes:

> A cluster is a block of characters represented by a single font glyph.
> So say I have two characters, "a" and "add an accent to the previous
> char", those combine into the "a with accent" char. This is why char
> width is cluster_width/chars_in_cluster, because you divide the font
> glyph among the chars that motivated the glyph.

That's what I would have guessed. However it looks as if 
pango_layout_iter_next_cluster() iterates line by line inserting
an extra cluster at the end of the line. This is prooven by the
extents returned by pango_layout_iter_get_cluster_extents() which
alternatingly give the extents of a whole line and zero-wide 
rectangles.

> I believe PangoLayoutIter mostly returns the correct numbers since
> it's used for all the selection code in GTK - but it's quite possible
> there are some weird bugs.

judging from a grepping the source, GTK+/GDK only iterate over lines and 
runs and use pango_layout_iter_get_line_yrange() and 
pango_layout_line_get_x_ranges(). This is what I will do now too, but
someone should revisit the Pango code since I have the impression it is 
not behaving as advertised.

> A cluster is a block of characters represented by a single font glyph.
> So say I have two characters, "a" and "add an accent to the previous
> char", those combine into the "a with accent" char. This is why char
> width is cluster_width/chars_in_cluster, because you divide the font
> glyph among the chars that motivated the glyph.

if this is the case, pango_layout_iter_get_char_extents() makes no 
sense at all. The extents returned are useless and the function should 
be removed (probably together with pango_layout_iter_next_char()).


Salut, Sven







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