Re: pango_layout_iter_get_char_extents()



Sven Neumann <sven gimp org> writes: 
> 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.

Yes, that's right. The reason for this is to handle empty lines or
something, I don't remember. I agree it's a bit weird.
> 
> > 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()).
> 

IIRC cluster-splitting cases may happen from time to time, if
graphemes and clusters are not identical for some reason.

That is, some languages may allow you to do the equivalent of
selecting the accent but not the letter the accent is over the top of.

Havoc




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