Pango layout multibyte character problem



Hello,

I am having a problem with some multibyte characters when trying to render them via a Pango layout (using the pangomm c++ binding). Here are the details of a specific problem:

- the text string that I am trying to render is just two characters: a lower case 'x' and a superscript '2'

- internally the app uses unicode chars so these two characters have values 0x78 and 0xb2

- when converted to a UTF-8 string it now uses three bytes 0x78 0xc2 0xb2 - I have verified on other platforms that this is a correct conversion to UTF-8 - both the wide string and the UTF-8 (ustring) return the correct length of 2

- after insert this string into the Pango layout (via set_text) I setup the attributes for the text (does not seem to matter what I use for attributes) and then render the text into a Cairo context via show_in_cairo_context

In this case the x and superscript 2 get rendered correctly, but are followed by the rendering of the 'missing glyph' with the value efffff in the box. When I call get_unknown_glyphs_count it returns one.

The mystery is why the Pango layout thinks there is an unknown glyph (and subsequently renders a missing glyph) for this case. This also seems to happen for the degree symbol character 0xb0.

The same code works just fine for a range of greek letters (they seem to go through the same basic conversion to UTF-8) and render correctly.

Any ideas on what to try next?


thanks,
steve



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