Re: How do I get X, Y pos and PangoLogAttr of each glyph in a rendered string?

> You definitely can do it with glyphs, but is that really what you want?
> There's simpler API in pango to do that per cluster.  Note that you cannot map
> a glyph to the original string (and hence PangoLogAttr).  You can only do that
> per cluster.
> Check PangoLayoutIter.
> I'm also attaching Python code that draws boxes around clusters.
> Hope that helps,
> behdad

This python code is very helpful.  How difficult would it be to add an
extra function that draws boxes around words?

I have code that does a pretty good job of finding words, but still
seems to bork on some examples.

In that same code, I have a function that can fill Cairo paths word by
word.  It is far from perfect, but works some of the time. It is only
built for text going from left to right.   Still, I was wondering if
someone had an idea why it segfaults if I set_markup on the layout
instead of set_text.  How does set_markup change the layout soe that I
cannot proceed as I am doing? 

I've been working on this word-by-word algorithm for over a year now (on
and off as I have time).   So, any suggestions you might have
would be greatly appreciated.

best -august.

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