Re: pango_layout_iter_get_char_extents()



Hi,

Havoc Pennington <hp redhat com> writes:

> 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.

The fact that empty clusters are added at the end of the line is 
documented and did not surprise me, but clusters are definitely
not handled as described in your first reply (you said they'd be
equivalent to a font glyph). The iterator and get_extents function
behave as if clusters were lines (at least for the case of simple
layouts without attribute changes).

> > 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.

yes probably, but the extents returned from 
pango_layout_iter_get_char_extents won't help you to visually select
(highlight or whatever) the accent since they are simply bogus values
if calculated by cluster_width / char_count. They do not even give you
to the correct extents of simple, uncombined glyphs. Better gid rid of 
this unused and unusable API functions before more people get confused.


Salut, Sven




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