RE: Pango problem with 16-bit character?



> -----Original Message-----
> From: Ian
> Sent: Saturday, December 05, 2009 4:51 PM
> 
> I seem to have uncovered a problem with Pango's handling of 16-bit UTF8
> characters in certain circumstances.

Or not

> the double-left facing chevron character (ASCII 171 or 0xab).

I was in error there - it's on Windows which uses charset "CP1252" and 0xab
is the 1252 encoding of that character, not ASCII.

> Generally that works properly and the double-chevron character displays
> fine, except when that character is the last on the line of text,

Don't worry, I found the problem and it was down to something my code was
doing wrong. When it finds a line ending with this special character it adds
a Pango attribute to display the line in bold, and the code was setting the
end_index in that attribute to the end of the line - 1, and that is wrong.
This was probably trying to not include the final '\n', but Pango doesn't
include the character at end_index anyway, so setting end_index to the end
of the line would have been the correct thing to do for that. Setting it to
the end of the line - 1 puts end_index mid-way in that 16-bit UTF-8
character, and that is what was upsetting Pango.

Ian





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