Re: go from PangoGlyphItemIter to an index into a PangoLogAttr ?

2010-10-25 Thread august
 My main problem, which I have partially solved, is how to iterate
 through a layout (line by line, run by run, and then glyphitem by gitem)
 and keep the log_attributes I get from the layout in sync with my
 iteration.
 
 I noticed that when I change the set_width() of my layout, the number of
 characters in the layout/log_attr array changes.  Why is that? 
 I was surprised when I found this out...but still don't know how it
 changes the character count.  Is there now an extra char in my log_attr
 for every line or run or some mixture?  I ran some tests where I
 increment my index into the log_attr array for each line or run, but did
 not see any regularity.   My solution for now is to not set_width on the
 layout.
 
 I've also tried to get an index into the log_attr array using
 log_attr[glyphitemiter.glyph_item.glyphs.log_clusters[i]] 
 
 where i is incremented for every call to next_cluster()
 
 however, this does not work ( at least not when you set_width on the
 layout).

I think I can narrow my question down a bit.  I the pango docs for
pango_layout_get_log_attr() it says:

n_attrs: location to store the number of the attributes in the array.
(The stored value will be one more than the total number of characters
 in the layout, since there need to be attributes corresponding to both
 the position before the first character and the position after the last
 character.) 

So, when I do this, I know the number of characters in the layout.  I
can also count the number of characters in the source text fed into the
layout.  However, what I don't know is the correlation between the  #
characters in the layout and the # characters in the source text.  They
are not the same.

-august.


___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list


go from PangoGlyphItemIter to an index into a PangoLogAttr ?

2010-10-24 Thread august

Hi,

Could someone tell me how to go from a PangoGlyphItemIter to and
index into a PangoLogAttr that comes from pango_layout_get_log_attrs?

My code first gets a layout and sets the text.  Then, I do
get_log_attrs on the text.   

The pango docs say that the get_log_attrs function Retrieves an
array of logical attributes for each character in the layout. 
What does character mean in that sentence?

Then, after getting the log_attrs, I get a layout iter and step
through the text by line, run, and then by
glyphitemiter.next_cluster.

Is there no direct way to index back into my log_attrs[] array from
the glyphitemiter?


thanks for any tips.  I've been staring at this for so long now.

best -august.
___
gtk-i18n-list mailing list
gtk-i18n-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-i18n-list