On Wed, Jul 14, 2010 at 08:45:54PM +0930, James Moschou wrote:
I'm sorry I don't see how this is what I want. My problem is that I am
implementing a text view with a cursor that works in characters.
However I use Pango to figure out where to draw the cursor, and Pango
works in bytes, so I need to convert between the two.
I reckon I could do:
byte_offset = mystring.substring(0, character_offset).to_utf8().length;
Try: size_t byte_offset = (void*)mystring.offset(character_offset)-(void*)mystring; -- http://www.debian.org - The Universal Operating System
Attachment:
signature.asc
Description: Digital signature