Re: error in pangoLayout->index_to_pos() ?



On Wed, Feb 28, 2007 at 07:53:40PM +0100, thom_schu gmx de wrote:
> Im trying to implement something like a TextEntry.
> So I need to compute the current position of the cursor.
> For this Im using PangoLayout::index_to_pos().
> Everything works fine, as long as the string doesnt have
> any special characters. (like ö, ä, ü, ?).
> It seems like it doesnt work with characters which have a keyval
> higher than 177.
> 
> Im building the string in the on_key_press_event with 
> text.insert(position, 1, event->keyval).

event->keyval is an *integer key code* (generally unrelated
to character codes in any common encoding).
You can only make Pango layouts from UTF-8 encoded *strings*.
So this does not make sense.

In addition inserting something as you get key events does
not work with input methods.  That is it may be impossible
to enter international text.

> I also tried to use the function move_cursor_visually, but also this
> doesnt work. For instance when I enter the letter "ä" many times,
> Im getting the positions : 0, 2, 2, 6, 2, 8, 2, 10, 2, 12, 2 ........
> but expected 0,1,2,3,4,5,6.....

If these position are byte positions, then it works exactly
as expected (ä is two bytes in UTF-8).

Yeti


--
Whatever.



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