Re: How to extract rendered glyphs (graphemes?) with Pango?



OK, thanks very much for that. I've looked at those structures and I'm still not clear how to pull the combined, shaped and rendered glyphs out in bitmap form though. Those structures appear to hold geometry and other data, but not in rendered form. i.e. I actually need to programmatically cut up the rendered glyphs out of the rendered bitmap string. or alternatively pass the data for individual graphemes (glyphs? whatever the final product is of combining multiple unicode code points and then shaping them etc) to the renderer one at a time. I will say, this process does not have to be efficient at all as it won't be used in real time, just to render and then chop up (visually) the generated letters.

So:

a.) How do I get at the rendered letters (in visual order) ?
b.) How do I separate out the diacritics also in rendered form (if at all possible) and know where to place them (in pixels) relative to the main character? c.) How do I uniquely identify each rendered letter so that I know if I encounter it a second time in the text I'm processing.

I'm guessing I do a normal render of the text using pangocairo (e.g. as per examples I've found), then somehow chop the bitmap up (or copy from it) according to position data held in the structures somewhere - but not sure of specifics! Any specifics much appreciated :)

Many thanks,
Alex

On 14/03/2011 20:56, Behdad Esfahbod wrote:
On 03/14/11 15:38, Alex Kerr wrote:
Also, I don't suppose it's possible to extract rendered diacritics is it, and
positioning information for them relative to the base character they're
attached to? Would be amazing if so :)
That's essentially what PangoGlyphString does.  Combined with the text itself,
ie, PangoGlyphItem, it gives you full information about the clusters.  Check
PangoGlyphItemIter for example, which iterates clusters withing a PangoGlyphItem.

> From a PangoLayout you can get to the GlyphItems simply by getting the lines
out of the layout and traversing line->runs which is a list of
PangoLayoutRun's.  PangoLayoutRun being a typedef to PangoGlyphItem.

Cheers,
behdad




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