Re: PangoLayout and UTF8-strings




Ok, this definitely closed the problem:

g_sprintf (label, "%d °C\0", (i * 50 + 550));
pango_layout_set_text (pl,
                       g_locale_to_utf8 (label,
                                         -1,
                                         NULL,
                                         NULL,
                                         NULL),
                       -1);
points[0].x -= 45;
points[0].y -= 7;
gdk_draw_layout_with_colors (draw->window,
                             gc,
                             points[0].x,
                             points[0].y,
                             pl,
                             grigio,
                             NULL);


I think that all the problems arose from the fact that I was passing an incorrect text length to g_locale_to_utf8 and to pango_layout_set_text, calculated on the number of gchar instead of utf8 characters (>= 8 for a 8 utf8 character string :-( ).

Thank you all for the help.

Carlo

PS: this one must not be so trivial: also the brand new installer for mozilla firefox 0.9 gets some GTK run-time warnings of this kind :-)



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