Re: pango_layout_iter_get_char_extents()



Sven Neumann <sven gimp org> writes:

> 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 that's the case, they are buggy. A cluster is basically an internal
detail in Pango ... most operations should care about graphemes
not clusters, but to describe it more exactly:

 A cluster is the smallest unit at which the mapping between characters
 and glyphs is defined.

 A cluster can have multiple characters and one glyph 
 (character + composing accent rendered as one glyph)

 A cluster can have multiple glyphs and one character.
 (Hangul composed syllable rendered with combining Jamo)

 A cluster can have multiple glyphs and multiple characters 
 (character + composing accent rendered as base glyph plus accent
 glyph)

But all the width for the glyphs in a cluster is divided equally to 
provide the logical widths of the characters within the cluster.

Regards,
                                        Owen




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